On 9/11/07, Anthony Thyssen <[EMAIL PROTECTED]> wrote:
> "Mathieu Malaterre" on  wrote...
> | Hello,
> |
> |   I am having some issue with a 16bits pgm file. Are those steps
> | supposed to work:
> |
> |
> | $ wget http://samples.mplayerhq.hu/jpegls/test16.pgm
> | $ identify test16.pgm
> | test16.pgm PNM 256x256 PseudoClass 4096c 128kb
> | $ convert test16.pgm test16.gray
> | $ convert -depth 16 -size 256x256 test16.gray test16-2.pgm
> | $ diff test16.pgm test16-2.pgm
> | Binary files test16.pgm and test16-2.pgm differ
> | $ md5sum test16.pgm test16-2.pgm
> | 7a4c2d943148520d2f0da1882b2be204  test16.pgm
> | 2da0da03b6eb03a7ecc401c0be70d639  test16-2.pgm
> | $ identify test16-2.pgm
> | test16-2.pgm PNM 256x256 PseudoClass 65536c 128kb
> |
> | Technically I'd like to know what is the command line to produce a
> | valid 16bits pgm file from a raw grayscale little endian 16bits file.
> |
>
> Also the original pgm file is a 12bit depth.
> IM will not save 12bit PGM files,  not at this time at least
> I have put in a proposal for this to be fixed.
>
> Then there is the matter of if it is a compressed (binary) or
> uncompressed (text) PGM file.

Hi Anthony,

  I think I now understand. When converting a grayscale 16bits one
*has* to specify the endian encoding of the raw image. ImageMagick is
simply assuming the raw image is big endian. Thus the correct command
to convert a 16bits LSB grayscale image into pgm is:

$ convert -endian LSB -depth 16 -size 3064x4664 MG.gray MG.pgm

but

$ convert -depth 16 -size 3064x4664 MG.gray MG.tiff

<feature request>
 It would be nice if convert would warn that some file format require
big endian encoding (pgm).
</feature request>


Thanks,
-- 
Mathieu
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to