Magick++ : How to get 10 bit raw data from 16 bit TIFF

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
celios

Magick++ : How to get 10 bit raw data from 16 bit TIFF

Post by celios »

I have a set of 16 bit TIFF and need to convert it to 10 bit, take the raw pixel data, then assign the 10 bit raw data
to my company's proprietary video format which is 10 bit.
How do I get the 10 bit raw data using Magick++ (MagickWand implementation is also welcomed) ?

So far I have tried :
1. calling Image::depth() with parameter 10
2. either one of these :
- use Image::getPixels() to get PixelPacket pointer to pixel data
- write to a blob and use Blob::data() to get pixel data
3. do memcpy to my pixel buffer (10 bit Red, Green, Blue) or assign individual pixel color from PixelPacket to my pixel buffer.
The end result looks strange.
The colors do not match the original image. I did not do any color change.
It's not just because Red and Blue swapped. Seems like there is a lot of Mozaic effects.

Celios
Last edited by celios on 2007-10-05T18:38:46-07:00, edited 1 time in total.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Magick++ : How to get 10 bit raw data from 16 bit TIFF

Post by magick »

There will be some color variation going from 16 to 10 bits since 6-bits is lopped off each color component. After you run your program, write the image to disk to a file called image.tif. Next type
  • identify -verbose image.tif
Does it report that the color depth is 10 bits? Are you using a modern version of ImageMagick? The latest release is 6.3.6-1.
celios

Re: Magick++ : How to get 10 bit raw data from 16 bit TIFF

Post by celios »

I used 6.3.4-Q16.
Just now I updated to 6.3.6-Q16.

The identify command confirmed that color depth is 10 bit.
Post Reply