Page 1 of 1

Can not convert gray PSD file to another format correctly

Posted: 2013-09-16T11:52:03-07:00
by dima2000star
Hi,

I'm trying to convert PSD with gray color scheme to jpeg or something else, but always getting it wrong.
IM version is 6.8.6-6
Here the sample picture and output result(1.jpg):
https://www.dropbox.com/s/fg2vw3ga747be ... sample.zip
Thank you for looking into it.

Re: Can not convert gray PSD file to another format correctl

Posted: 2013-09-16T12:34:02-07:00
by snibgo
With a variety of IM version, "identify GRAY_sample.psd" crashes.

Gimp opens the file without complaint.

Re: Can not convert gray PSD file to another format correctl

Posted: 2013-09-16T13:03:12-07:00
by dima2000star
it works on my machine(Macos Lion):
identify /temp/gray_sample.psd
/temp/gray_sample.psd PSD 1236x2968 1236x2968+0+0 16-bit Gray 256c 7.358MB 0.040u 0:00.039
The file saved from Adobe Photoshop CS6

Re: Can not convert gray PSD file to another format correctl

Posted: 2013-09-16T13:24:43-07:00
by fmw42
I get the same bad jpg result using

convert GRAY_sample.psd -strip +profile "*" -depth 8 -type grayscale tmp.jpg

on IM 6.8.6.9 Q16 Mac OSX Snow Leopard.

It works fine if you expert the PSD as 8-bit grayscale and then use

convert GRAY_sample_8bit.psd tmp.jpg

It does look to me like a bug in IM decoding 16-bit grayscale PSD.

Re: Can not convert gray PSD file to another format correctl

Posted: 2013-09-16T15:10:49-07:00
by dlemstra
I can confirm this is a bug in ImageMagick. When I make the change below to line 854 of psd.c the problem seems to be fixed.

Code: Select all

if (AcquireImageColormap(image, psd_info.depth != 16 ? 256 : 65536) == MagickFalse)
Line 660 of psd.c can use an index that is higher then 256 and this will result in a crash. I am not sure of this is the correct way to solve the issue so I will let magick commit the change.

Re: Can not convert gray PSD file to another format correctl

Posted: 2013-09-16T15:30:23-07:00
by magick
We'll get a patch in ImageMagick Subversion trunk by sometime tomorrow. Thanks.