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

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
Kasreyn

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

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick »

Try this command:
  • convert file.png -resize 154x106! -compress none file.ppm
Kasreyn

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

Post 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 ?
Kasreyn

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

Post 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.
Last edited by Kasreyn on 2008-06-12T05:30:00-07:00, edited 1 time in total.
Kasreyn

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

Post 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.
Kasreyn

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

Post by Kasreyn »

*Solved* by adding -depth 8 to convert commandline :D
Post Reply