Page 1 of 1

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

Posted: 2009-09-28T13:49:12-07:00
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.

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

Posted: 2009-09-28T16:51:21-07:00
by magick
You can import an image like you described from a memory buffer. There is no need to iterate over the pixels.

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

Posted: 2009-09-28T22:52:46-07:00
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 ?

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

Posted: 2009-09-29T05:54:31-07:00
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.