Have Magick++ operating on an existing uint16_t (*Image)[3]

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
jdla

Have Magick++ operating on an existing uint16_t (*Image)[3]

Post by jdla »

I have a probably trivial and simple question, but I don't find the answer nor do I get it working.

I want to use Magick++ as a library supporting image manipulations on an existing application.

That application stores a 16bit RGB image as uint16_t (*Image)[3].

Is there any way to construct an IM image along the lines of :
Magick::Image IM_Image(Width,Height,"RGB",ShortPixel,Image);
and then have IM does a transformation like
IM_Image.normalize() operating on the original data ?

Or do I need to go through a copy-in / copy-out based on setPixels etc ... ?

Thanks for clarification and/or (pointer to) sample code.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Have Magick++ operating on an existing uint16_t (*Image)[3]

Post by magick »

You can import an image like you described from a memory buffer. There is no need to iterate over the pixels.
jdla

Re: Have Magick++ operating on an existing uint16_t (*Image)[3]

Post by jdla »

That's what I would have thought. However, the simple sequence :

uint16_t (*m_Image)[3];
... constructing some m_Image ...

Magick::Image IM_Image(Width,Height,"RGB",ShortPixel,m_Image);
IM_Image.normalize();

Seems to leave the image (m_Image) unaltered, while the iteration-over-pixels does work.

Where am I going wrong ?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Have Magick++ operating on an existing uint16_t (*Image)[3]

Post by magick »

Read your image with both methods and write it to different files on disk and display the results. We assume they produce two different renderings. Perhaps you need to set the endian, either LSBEndian or MSBEndian.
Post Reply