Page 1 of 1

Posted: 2006-11-22T20:35:26-07:00
by anthony
Photoshop saved resolution in a non-standard way in TIF files. That is the problem.

Posted: 2006-11-23T11:22:04-07:00
by el_supremo
FWIW: I used the command line "convert" to convert a JPG, which "identify" says has a resolution of 300x300 dpi, to a PCT which identify says is 72x72 with undefined units.

I've had a look at the pict.c coder and I think there are two problems.
ReadPICTImage uses the ReadPixmap macro to read the x and y resolution from the file header but it doesn't seem to do anything with this information which would result in default resolution and units no matter what resolution was written in the file header.
There may also be a bug in WritePICTImage. When it writes out the x and y resolution it does it like this:

Code: Select all

  (void) WriteBlobMSBShort(image,(unsigned short) x_resolution);
  (void) WriteBlobMSBShort(image,0x0000);
  (void) WriteBlobMSBShort(image,(unsigned short) y_resolution);
  (void) WriteBlobMSBShort(image,0x0000);
whereas the ReadPixmap macro reads them in like this:

Code: Select all

  pixmap.horizontal_resolution=ReadBlobMSBLong(image); \
  pixmap.vertical_resolution=ReadBlobMSBLong(image); \
I suspect that WritePICTImage should either write the 0x0000 before the resolutions (because it is MSB first) or do this:

Code: Select all

  (void) WriteBlobMSBLong(image,(unsigned long) x_resolution);
  (void) WriteBlobMSBLong(image,(unsigned long) y_resolution);

Pete

Posted: 2006-11-23T12:08:15-07:00
by el_supremo
thank you for checking this out el_supremo
You're welcome.
I´ll have to wait till someone else fixes it... (If it will ever be done)
The IM guys are very good at fixing up reported bugs and issuing a new release of the code, so if you can recompile from source you may have a fix in a few days.
the GIMP can't open PCT pics
The problem I noted, with the way that WritePICTImage seems to write out the resolutions, may explain why PSP X cannot open the .pct file produced by "convert". It just says "An error has occurred while trying to read from the file" and gives up. It may be seeing the original 300dpi resolution as 300*65536 dpi and barfing.

Pete

Posted: 2006-11-27T16:44:38-07:00
by el_supremo
I figured out and posted a patch to the Bugs list. No reply, but it appears that the patch was accepted and is now in the sources for 6.3.0-7.

Pete

Posted: 2006-11-28T08:53:08-07:00
by el_supremo
I'm afraid I can't help you with that Haffi. I'm using Windows :oops:

Pete