Page 1 of 1

Possible 64-bit issue with PSD files.

Posted: 2010-07-27T14:49:49-07:00
by jyelloz
Hello.

It seems that 64-bit builds of ImageMagick hang when processing some PSD files.
I filed a bug a while ago with Ubuntu because I thought it was distribution-specific but I did some more testing and it works properly on 32-bit Linux installations and doesn't work on 64-bit, I tried Ubuntu, Debian, and Gentoo with consistent results. On Mac OS X 10.5, 32-bit builds work fine for this and 64-bit builds cause a disk full warning when loading the example image.
The bug is https://bugs.launchpad.net/ubuntu/+sour ... bug/597469 and it includes a sample file and all the instructions.

Re: Possible 64-bit issue with PSD files.

Posted: 2010-07-27T15:37:59-07:00
by fmw42
FYI:

I have been working with some PSD files for a project and just tried to convert this file to .mpc on IM 6.6.3-1 Q16 Mac OSX Tiger (G4 PowerPC) and get errors.


convert ubuntu-imagemagick-hang.psd ubuntu-imagemagick-hang.mpc

convert: unable to extend cache `ubuntu-imagemagick-hang.mpc': No space left on device @ error/cache.c/OpenPixelCache/4164.
convert: unable to persist pixel cache `ubuntu-imagemagick-hang.mpc' @ error/mpc.c/WriteMPCImage/1401.


When converting to jpg, 3 files are created, but the last cannot be opened.


identify ubuntu-imagemagick-hang-2.jpg

identify: Premature end of JPEG file `ubuntu-imagemagick-hang-2.jpg' @ warning/jpeg.c/EmitMessage/230.
identify: JPEG datastream contains no image `ubuntu-imagemagick-hang-2.jpg' @ error/jpeg.c/EmitMessage/235.

Re: Possible 64-bit issue with PSD files.

Posted: 2010-07-28T02:12:30-07:00
by Drarakel
fmw42 wrote:convert ubuntu-imagemagick-hang.psd ubuntu-imagemagick-hang.mpc

convert: unable to extend cache `ubuntu-imagemagick-hang.mpc': No space left on device @ error/cache.c/OpenPixelCache/4164.
convert: unable to persist pixel cache `ubuntu-imagemagick-hang.mpc' @ error/mpc.c/WriteMPCImage/1401.
I think you would need a 8 Terabyte hard disk to be able to convert this file to MPC. :mrgreen:
Because ImageMagick reads the properties as follows:
identify +ping ubuntu-imagemagick-hang.psd
ubuntu-imagemagick-hang.psd[0] PSD 350x350 350x350+0+0 8-bit DirectClass 730KB 0.094u 0:00.093
ubuntu-imagemagick-hang.psd[1] PSD 133x123 133x123+108+97 8-bit DirectClass 730KB 0.094u 0:00.093
ubuntu-imagemagick-hang.psd[2] PSD 241x4294967294 241x4294967294+0+0 8-bit DirectClass 730KB 0.094u 0:00.093
jyelloz wrote:it works properly on 32-bit Linux installations
And what do you get as output file for the layer 2? It seems unlikely that you get a good output, as this last layer looks invalid - or at least there's no regular image in that layer (only a mask?).

The height value in this layer is 0xFFFFFFFF. I'm not sure what's the right thing to do in such a case.. (By the way: It seems that there's also an error in reading or displaying unsigned long values - as 0xFFFFFFFF would be 4294967295, not 4294967294. The highest value that gets correctly read seems to be 0x493E0 - this gets converted to the decimal value 300000. The next value, 0x493E1, shows as 300000, too!)
So, IM apparently reads it as unsigned long integers, but perhaps it should read it as signed values - and discard the layer if there's a negative value.(?) With signed values, the properties of this layer would be 241x-1+0+0. When trying to open the file with Gimp, it shows the message "Error loading PSD file: Unsupported or invalid layer height: -1" (and outright refuses to open it).

The workaround would be to just read the 'good' layers - here with "ubuntu-imagemagick-hang.psd[0-1]".

Re: Possible 64-bit issue with PSD files.

Posted: 2010-07-28T10:01:04-07:00
by fmw42

Code: Select all

I think you would need a 8 Terabyte hard disk to be able to convert this file to MPC.  
Because ImageMagick reads the properties as follows:
identify +ping ubuntu-imagemagick-hang.psd
ubuntu-imagemagick-hang.psd[0] PSD 350x350 350x350+0+0 8-bit DirectClass 730KB 0.094u 0:00.093
ubuntu-imagemagick-hang.psd[1] PSD 133x123 133x123+108+97 8-bit DirectClass 730KB 0.094u 0:00.093
ubuntu-imagemagick-hang.psd[2] PSD 241x4294967294 241x4294967294+0+0 8-bit DirectClass 730KB 0.094u 0:00.093
Good catch. That does explain it.

I did not even look as the image filesize was reasonable (716 Kb)