Page 1 of 1

convert to PPM autoselects type P6 in 6.3.7.9.dfsg1-2+b2 ?

Posted: 2008-06-11T09:12:28-07:00
by Kasreyn
Runnin Debian testing I came across something i believe is a change in the default behaviour for the latest ImageMagick 6.3.7.9.dfsg1-2+b2. I use convert on PNGs to create PPMs. I read these with a routine that is very picky about format. I'm no expert on image formats but compared to the files created by ImageMagick 6.2.4.5.dfsg1-0.14, the filesize is doubled and Compress ratio is stated as 200% in gqview.

This is the commandline I am using: convert file.png -resize 154x106! file.ppm

I have tried the same commandline on both versions of ImageMagick and they produce different results. You can find them here:

http://brn.ath.cx/img/imagemagick.troub ... 1-0.14.ppm
http://brn.ath.cx/img/imagemagick.troub ... 1-2+b2.ppm

Can someone suggest a command line option ? Something that forces ImageMagick to output PPMs in the "other" format.

Re: convert to PPM autoselects type P6 in 6.3.7.9.dfsg1-2+b2 ?

Posted: 2008-06-11T11:00:46-07:00
by magick
Try this command:
  • convert file.png -resize 154x106! -compress none file.ppm

Re: convert to PPM autoselects type P6 in 6.3.7.9.dfsg1-2+b2 ?

Posted: 2008-06-12T04:05:25-07:00
by Kasreyn
"-compress none" does not work. Somehow this produces images that are much larger and of different sizes, where without -compress all the images are the same size.

Sample of "-compress none":
http://brn.ath.cx/img/imagemagick.troub ... 1-2+b2.ppm

Running a hexeditor on the files you can see something interesting, these are headers in ascii:

6.3.7.9.dfsg1-2+b2 with -compress none: P3.154 106.65535.0 145 1
6.3.7.9.dfsg1-2+b2 without -compress none: P6.154 106.65535.....9..
6.2.4.5.dfsg1-0.14 without -compress none: P6.154 106.255...9..<..=

Now, P3 is what is refered to "plain format" PPM. So obviously the new imagemagick selects the same format (P6), still something is different. Looking further into the header, old imagemagick writes "106.255". Is it possible the new ImageMagick defaults to a wider colorspace ?

Re: convert to PPM autoselects type P6 in 6.3.7.9.dfsg1-2+b2 ?

Posted: 2008-06-12T04:27:09-07:00
by Kasreyn
When I try to use -storage-type char it gives me "convert: unrecognized option `-storage-type'."

I was hoping this could be the solution :?

*edit: i later discovered convert does not support -storage-type. however, stream does.

Re: convert to PPM autoselects type P6 in 6.3.7.9.dfsg1-2+b2 ?

Posted: 2008-06-12T05:14:57-07:00
by Kasreyn
this is what identify has to say about the files:

PNM 154x106 154x106+0+0 DirectClass 16-bit 95.6641kb
PNM 154x106 154x106+0+0 DirectClass 8-bit 47.8965kb

PNM seems to be 16-bit in the newer version and they are 8-bit in the old version. Question is, can the tools still create 8-bit PNM files? Is there perhaps another tool that can? I've seen people use ufraw-batch for this but it want's some kind of RAW image format I don't know how to create.

Re: convert to PPM autoselects type P6 in 6.3.7.9.dfsg1-2+b2 ?

Posted: 2008-06-12T05:25:17-07:00
by Kasreyn
*Solved* by adding -depth 8 to convert commandline :D