Accessing index for palette with MagickExportImagePixels
Posted: 2014-04-07T07:35:04-07:00
I need to access indexes with MagickExportImagePixels, but the possible maps don't seem to have index in them, there is R, G, B, C, M, Y, K, Alpha, Opacity, Padding (?) and Intensity.
I tried with intensity but it doesn't seem to return an index, instead returns an odd number for a paletted image.
Help appreciated!
Below is the first problem I had, now fixed with MagickExportImagePixels:
I tried with intensity but it doesn't seem to return an index, instead returns an odd number for a paletted image.
Help appreciated!
Below is the first problem I had, now fixed with MagickExportImagePixels:
Greetings.
I am wondering if it is possible to access packed raw pixel information using MagickWand.
The following code does what I want when using MagickCore. It gets a pointer to a row of packed pixel data stored in an array or PixelPackets (and IndexPackets).I am wondering if it's possible to do the same using MagickWand. Using PixelWands doesn't really get me what I need, since the PixelWands are big, contain information I do not need and are not necessarily next to each other.Code: Select all
PixelPacket *pixels; IndexPacket *index_pixels; ImageInfo *image_info; ExceptionInfo *exception_info; Image *image; // Generate MagickCoreGenesis(*argv,MagickTrue); if (IsMagickCoreInstantiated() != MagickTrue) return -1; image_info = AcquireImageInfo(); GetImageInfo(image_info); exception_info = AcquireExceptionInfo(); GetExceptionInfo(exception_info); // Read image CopyMagickString(image_info->filename,fname,MaxTextExtent); image = ReadImage(image_info,exception_info); // Get read only pixels pixels = GetVirtualPixels(image,(ssize_t)0,(ssize_t)row,(size_t)cols,(size_t)1,exception_info); if (pixels == (const PixelPacket *) NULL) // Throw error if (image->colorspace == CMYKColorspace) { index_pixels = GetVirtualIndexQueue(image); if (index_pixels == (const IndexPacket *) NULL) // Throw error } ...
Do I need to stick to MagickCore or is it somehow possible?Code: Select all
PixelWand **pixel_wands; size_t read; PixelIterator *pixel_iterator = NewPixelIterator(some_wand...); pixel_wands = PixelGetNextIteratorRow(pixel_iterator,&read);