Page 1 of 2

JPG file failed to convert with new version of Image Magick

Posted: 2018-12-13T03:04:28-07:00
by long.to
Hi,

I'm using ImageMagick CLI version 7.0.7.24 in Windows, now I want to upgrade the version to 7.0.8.16 - the lastest version but there are some issues with the new one. When using new version and try to convert a jpg file to bmp file, I got an error log like below:
convert.exe: CorruptImageProfile `xmp' @ warning/profile.c/SetImageProfileInternal/1746.
convert.exe: memory allocation failed `D:\1e7f62069f7440c983950023090c0a3a.jpg' @ error/jpeg.c/ReadProfile/803.
convert.exe: Improper call to JPEG library in state 201 `D:\1e7f62069f7440c983950023090c0a3a.jpg' @ error/jpeg.c/JPEGErrorHandler/333.
But in version 7.0.7.24, there is no error and converted file is ok. My command is just:

Code: Select all

convert.exe input_file.jpg output_file.bmp
Below is my sample: https://drive.google.com/file/d/1NpBt3F ... -pDFW/view

Please check. Thanks you

Re: JPG file failed to convert with new version of Image Magick

Posted: 2018-12-13T03:27:52-07:00
by snibgo
v7.0.7-28 also converts with no problem. Exiftool says the file has a massive document history, and perhaps more recent IM has a bug that doesn't allocate enough memory.

Re: JPG file failed to convert with new version of Image Magick

Posted: 2018-12-13T18:54:34-07:00
by GeeMack
I get the same error described in the OP using ImageMagick 7.0.8-16 Q16 x64 HDRI on Windows 10.

Re: JPG file failed to convert with new version of Image Magick

Posted: 2018-12-13T20:58:58-07:00
by fmw42
I get the same error described in the OP using ImageMagick 7.0.8-16 Q16 x64 HDRI on Mac OSX Sierra

Re: JPG file failed to convert with new version of Image Magick

Posted: 2018-12-14T01:38:04-07:00
by maruno
Looking into this issue it looks like the code in this commit might be causing the behaviour:
https://github.com/ImageMagick/ImageMag ... 6407286d7d

It's trying to parse some XMP profile, however it fails at this when there is a lot of XMP-metadata in the file. We're currently working around this issue by stripping Adobe's metadata before feeding the file to ImageMagick. Only stripping Adobe's metadata, which is the biggest chunk of the embedded XMP-metadata in our files, seems not to be enough always so it seems the XMP-limit is rather low.

Re: JPG file failed to convert with new version of Image Magick

Posted: 2018-12-14T04:33:59-07:00
by lukasruzicka
Same issue after upgrade to ImageMagick 6.9.10-16 Q16 x86_64 2018-12-11 on Centos.

Code: Select all

identify 165273680.jpg
identify: CorruptImageProfile `xmp' @ warning/profile.c/SetImageProfileInternal/1727.
identify: memory allocation failed `165273680.jpg' @ error/jpeg.c/ReadProfile/777.
identify: Improper call to JPEG library in state 201 `165273680.jpg' @ error/jpeg.c/JPEGErrorHandler/328.
Samle image here: https://drive.google.com/file/d/1TFUUV1 ... jyC7M/view

Thank you

Re: JPG file failed to convert with new version of Image Magick

Posted: 2018-12-14T09:11:21-07:00
by maruno
maruno wrote: 2018-12-14T01:38:04-07:00 Looking into this issue it looks like the code in this commit might be causing the behaviour:
https://github.com/ImageMagick/ImageMag ... 6407286d7d
We've build ImageMagick with this commit reverted and we can confirm that this solves our problems with conversions with large sets of XMP-metadata.

Re: JPG file failed to convert with new version of Image Magick

Posted: 2018-12-14T13:37:50-07:00
by magick
Over the last year we have added checks in ImageMagick to help prevent security issues (e.g. aborts, uninitialized values, integer overflow). One new check is that the XMP profiles are compliant. The exception you received suggests that your image has a XMP profile that does not validate. If so, ImageMagick won't process it. If it compliant, it could be a bug in ImageMagick. We'll need a day or two to determine if its a bad profile or a bug in ImageMagick. Stand by.

Re: JPG file failed to convert with new version of Image Magick

Posted: 2018-12-14T19:33:35-07:00
by fmw42
I am having the same issue with IM 6.9.10.16 Q16 Mac OSX with an image from a client who is running one of my scripts.

Image

Code: Select all

identify cushion_design.jpg
identify: CorruptImageProfile `xmp' @ warning/profile.c/SetImageProfileInternal/1727.
identify: memory allocation failed `cushion_design.jpg' @ error/jpeg.c/ReadProfile/777.
identify: Improper call to JPEG library in state 201 `cushion_design.jpg' @ error/jpeg.c/JPEGErrorHandler/328.

Re: JPG file failed to convert with new version of Image Magick

Posted: 2018-12-15T07:29:14-07:00
by magick
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://www.imagemagick.org/download/beta/ by sometime tomorrow.

Re: JPG file failed to convert with new version of Image Magick

Posted: 2018-12-17T07:47:30-07:00
by maruno
magick wrote: 2018-12-15T07:29:14-07:00 Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://www.imagemagick.org/download/beta/ by sometime tomorrow.
Thanks. Is this the commit that fixes it? https://github.com/ImageMagick/ImageMag ... 9adaf7508e

Is there a chance this can get into ImageMagick6 as well? The fix didn't seem to get cherry-picked over.

Re: JPG file failed to convert with new version of Image Magick

Posted: 2018-12-19T21:59:10-07:00
by dlemstra
My bad @maruno. I forgot to also patch IM6. Pushed the patches a couple hours ago. We will try to publish a new release soon.

Re: JPG file failed to convert with new version of Image Magick

Posted: 2019-03-25T01:27:34-07:00
by rasved
It seems as this error is back in both version 7.0.8-33 and ..-34

I'm converting from a pdf to any format. When converting back from "any format" to pdf, I don't get the error.

Re: JPG file failed to convert with new version of Image Magick

Posted: 2019-03-25T03:29:17-07:00
by magick
We cannot reproduce the problem. Post a command-line and a link to an image we can use to reproduce the problem. If we do, we'll seek a patch to fix the problem.

Re: JPG file failed to convert with new version of Image Magick

Posted: 2019-03-27T12:55:28-07:00
by maxjac
Having the same issue. I'm using this in a PHP script:

exec('/usr/bin/convert test5p.pdf[1] -scale 800 -flatten image.jpg')
PDF here: http://maximejacques.com/pdf/test5p.pdf

Using version:
ImageMagick.x86_64 - 7.0.8-35
ImageMagick-libs.x86_64 - 7.0.8-35

Error Message:
test5p.pdf[1]convert: CorruptImageProfile `xmp' @ warning/profile.c/SetImageProfileInternal/1749