On Mon, 02 Feb 2009 07:16:38 -0500 (Eastern Standard Time) Robert Funnell <[email protected]> wrote:
| On Mon, 2 Feb 2009, Anthony Thyssen wrote: | | > On Sun, 01 Feb 2009 08:58:36 -0500 (Eastern Standard Time) | > [email protected] wrote: | > | > | I am trying to convert 16-bit GRAY files to 8-bit JPEG or PNG format. | > | Since the original images are actually 12-bit, I assume that I need to | > | right-shift each pixel, so I'm using a command like | > | | > | convert -size 512x512+3416 -depth 16 -evaluate RightShift 4 -endian LSB gray:c_vf1169.fre c_vf1169_rs4_lsb.png | > | | > | The effect seems to be that the high-order byte is simply ignored when | > | the right-shift is done. Could someone please explain what I'm doing | > | wrong? I'm using IM 6.2.4 Q16 as distributed by Debian. | > | | > | I apologize if this is really obvious, but I haven't been able to | > | figure it out or find an answer. | > | | > perhaps the 12 bit values in 16 bit integers are already left shifted? | | The 12 bits are indeed right shifted in their 16-bit representation. | What I wanted to do was to right shift the 12 bits into an 8-bit value | for use in an 8-bit PNG. | | In looking into this further in response to your response, I've | discovered that PNG does support 16-bit greyscale, but I don't want | that. I've tried some additional manoeuvres but without success, and I | haven't figured out how to tell IM whether to produce 8-bit or 16-bit | PNG. | | - Robert | Note that IM will only use the most significate bits if the output image format is only using 8 bits values. So you will not need to right shift them. That is if the 12 bit value are currently converted to 16 bit values either by -evaluate LeftShift, or by IM itself. then IM will handle any further processing correctly. Try saving using -depth 8 output.png or using png8:output.png for a 8bit palette PNG image. Anthony Thyssen ( System Programmer ) <[email protected]> ----------------------------------------------------------------------------- Windows Multitasking :- Start a download, Get a Coke, Fly a kite. ----------------------------------------------------------------------------- Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/ _______________________________________________ Magick-users mailing list [email protected] http://studio.imagemagick.org/mailman/listinfo/magick-users
