JPG file failed to convert with new version of Image Magick

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
long.to
Posts: 7
Joined: 2018-11-01T19:31:14-07:00
Authentication code: 1152

JPG file failed to convert with new version of Image Magick

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

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

Post by GeeMack »

I get the same error described in the OP using ImageMagick 7.0.8-16 Q16 x64 HDRI on Windows 10.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post by fmw42 »

I get the same error described in the OP using ImageMagick 7.0.8-16 Q16 x64 HDRI on Mac OSX Sierra
maruno
Posts: 4
Joined: 2018-09-25T04:17:57-07:00
Authentication code: 1152

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

Post 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.
User avatar
lukasruzicka
Posts: 3
Joined: 2016-04-07T06:47:00-07:00
Authentication code: 1151

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

Post 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
maruno
Posts: 4
Joined: 2018-09-25T04:17:57-07:00
Authentication code: 1152

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

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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.
maruno
Posts: 4
Joined: 2018-09-25T04:17:57-07:00
Authentication code: 1152

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

Post 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.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post 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.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
rasved
Posts: 1
Joined: 2019-03-25T01:25:27-07:00
Authentication code: 1152

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

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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.
maxjac
Posts: 3
Joined: 2019-03-27T12:49:04-07:00
Authentication code: 1152

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

Post 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
Post Reply