Can not convert gray PSD file to another format correctly

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.
Post Reply
dima2000star
Posts: 2
Joined: 2013-09-16T11:47:00-07:00
Authentication code: 6789

Can not convert gray PSD file to another format correctly

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

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

Post by snibgo »

With a variety of IM version, "identify GRAY_sample.psd" crashes.

Gimp opens the file without complaint.
snibgo's IM pages: im.snibgo.com
dima2000star
Posts: 2
Joined: 2013-09-16T11:47:00-07:00
Authentication code: 6789

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

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

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

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

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

Post 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.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick »

We'll get a patch in ImageMagick Subversion trunk by sometime tomorrow. Thanks.
Post Reply