error corrupted file ImageMagick - imagemagick

I am trying to use ImageMagick to convert a CMYK image to a RGB image using the following command:
convert inputimage.jpg -colorspace RGB outputimage.jpg
If the inputimage is a CMYK image, I get the following error:
lcms: Error #12288; Pointer error; probably corrupted file
I am using ImageMagick 6.8.8-5 Q16 i686 on Debian.
Any ideas how to fix this error?
Thanks in advance

Related

Animation is lost after converting png to webp

I have an animated PNG image but after I convert it to webP - I get the static image without animation.
I've tried cwebp
$ cwebp -q 100 1.png -o 1.webp
$ cwebp -version
1.0.0
and the same with imagemagick
$ magick 1.png -quality 100 -define webp:lossless=true 1.webp
$ magick --version
Version: ImageMagick 7.0.10-29 Q16 x64 2020-09-05 http://www.imagemagick.org
How can I convert to save the animation?
As discovered, cwebp does not support conversion with animation. Possible solution is to extract the individual frames (using ffmpeg or imagemagick for instance) and use img2webp to generate the animation.

ImageMagick generates corrupted PDF file

When I try to convert an image to PDF using ImageMagick by executing the command
mogrify -format pdf ImageMagick.png
the resulting PDF is corrupted. When I try to open it using MuPDF it fails:
error: cannot recognize version marker
warning: trying to repair broken xref
warning: repairing PDF document
error: name too long
warning: skipping ahead to next token
error: invalid key in dict
error: invalid key in dict
error: name too long
warning: skipping ahead to next token
error: no objects found
mupdf: error: cannot open document
The output of ImageMagick using the -verbose-flag is:
ImageMagick.png PNG 600x621 600x621+0+0 8-bit sRGB 123261B 0.020u 0:00.009
ImageMagick.png=>ImageMagick.pdf PNG 600x621 600x621+0+0 8-bit sRGB 122974B 0.070u 0:00.060
The problem with the PDF file seems to be, that the first bytes of the file aren't %PDF-.
This is my input-file
And this is the resulting PDF
My system:
Arch Linux
ImageMagick 7.0.8-8 Q16 x86_64 2018-08-01 (installed by executing pacman -S imagemagick)
The problem was, that ghostscript wasn't installed. ImageMagick doesn't seem to throw an error when ghostscript isn't installed.
To install ghostscript use
pacman -S ghostscript
Your command is just rewriting a PNG over itself. I don't know how the ImageMagick.pdf file was generated, but it really is just a PNG image with a PDF filename. Try one of the following...
convert ImageMagick.png ImageMagick.pdf
... or ...
mogrify -format PDF -path ./ ImageMagick.png

ImageMagick no encode delegate

I used to be able to convert text to an image using ImageMagick but now I get this error message:
$ echo text | convert -background none text:- file
convert: no encode delegate for this image format `TEXT' # error/constitute.c/WriteImage/1167.
ImageMagick was installed using Homebrew
imagemagick: stable 7.0.7-10 (bottled), HEAD
Tools and libraries to manipulate images in many formats
https://www.imagemagick.org/
/usr/local/Cellar/imagemagick/7.0.7-10 (1,523 files, 23.1MB) *
Poured from bottle on 2017-11-10 at 15:46:33
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/imagemagick.rb
In IM 7, convert is replaced by magick. You also have not specified an output image format for "file". Try this:
echo "text" | magick -background none text:- file.png
or
echo "text" | magick -background none text:- PNG32:file
That works for me on IM 7.0.7.10 Q16 Mac OSX
What do you get from
magick -version
Does it include freetype?
If not, then you probably need to install Freetype with ImageMagick via Homebrew

imagemagick -- convert: no decode delegate for this image format `TIFF'

I'm trying to convert an image "img.tif" to "img.jpg" with the following command:
convert img.tif img.jpg
And this error arises:
convert: no decode delegate for this image format `TIFF' # error/constitute.c/ReadImage/501.
I've trawled the web for answers, but nothing is working.
The suggestions from previous people with this problem have been:
brew reinstall imagemagick --with-libtiff
, which I have done, to no avail. The call:
convert -list configure
still gives the following for DELEGATES:
DELEGATES bzlib mpeg png x xml zlib
ANY other suggestions would be appreciated.
Even another way to convert from .tif to .jpg from the command line.
I know it's not exactely the right solution of your problem but it can "do the job".
You could convert from tif to jpg by adding a PNG (which is lossless) converting step:
tif→PNG→jpg
inkscape --export-png=img.png img.tif
then
convert img.png img.jpg
For me, the command
convert -list configure | grep DELEGATES
returns:
DELEGATES bzlib djvu fftw fontconfig freetype jbig jpeg jng jp2 lcms2 lqr lzma openexr pango png rsvg tiff x11 xml wmf zlib
And I didn't do something special during install so I don't understand why you don't have the "tif" nor the "jpeg" part…
Maybe you can try to install "libtiff-tools" "libjpeg" and "libjpeg-turbo".
The delegates could be found here:
Imagemagic Delegates

lcms error using ImageMagick compare on JPEGs with colour profile

When running compare
compare -metric MSE some-image-1.jpg some-image-2.jpg /dev/null
1) When images are identical (OK)
0 (0)
This is what I would expect to see.
2) When images differ (OK)
Error: Command failed: 13.1266 (0.000200299)
I can get the data that I want, but I'm not sure why it's presented as an error.
3) When image is a JPEG with a Photoshop colour profile (ISSUE)
Error: Command failed: lcms: Error #12288; Corrupted memory profile
This is the real issue, and only happens on JPEG images with a Photoshop colour profile - can anyone point me to why this would happen?
Environment
OS X 10.9.4
GhostScript 9.07 at /opt/Ghostscript
compare at /opt/ImageMagick/bin/compare
Version: ImageMagick 6.8.8-6 Q16 x86_64 2014-02-17 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC
Delegates: bzlib fftw jng jpeg lcms lzma png tiff webp xml zlib
Thank you for your time.

Resources