Forcing to Save RGBA Type Images.

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
Bunkai.Satori
Posts: 9
Joined: 2010-10-06T04:05:37-07:00
Authentication code: 8675308

Forcing to Save RGBA Type Images.

Post by Bunkai.Satori » 2011-03-10T15:19:57-07:00

Dear all,

I use Imagemagick to prepare textures for my OpenGL ES 2.0 application, which loads the images. The image format supplied to OpenGL ES is supposed to be 8bit RGBA (32-bit).

My problem is, that when I supply Grayscale images(.png/grayscale format) to ImageMagick for processing, the Imagemagick output is a Grayscale image. However, grayscale image can not be loaded by OpenGL ES 2.0.

This is, how I load, process and save .png images:

Code: Select all

// image instance for image to be resized
Image my_image;
Geometry my_Geometry;

// read image
my_image.read(imageSource.GetImageFilePath().c_str());

// trim image
my_image.trim();


// force RGBA image type
my_image.modifyImage();
my_image.type(TrueColorMatteType);
my_image.write((_TCHAR*)strngTrimmedFileFullPath.c_str());
My question is, how to force imagemagick to save 8Bit RGBA(32-bit) image format regardless of input, please? The above attempt with image.type(TrueColorMatteType); was not apparently helpful.

I use Visual C++, process only .png format, and use 32 bit version of ImageMagick.

Thank you.

User avatar
magick
Site Admin
Posts: 10697
Joined: 2003-05-31T11:32:55-07:00

Re: Forcing to Save RGBA Type Images.

Post by magick » 2011-03-10T17:01:51-07:00

You can force 32-bit RGBA PNG images with the png32 format modifier. For example, your output image filename is image.png. Use 'png32:image.png' as the filename.

Bunkai.Satori
Posts: 9
Joined: 2010-10-06T04:05:37-07:00
Authentication code: 8675308

Re: Forcing to Save RGBA Type Images.

Post by Bunkai.Satori » 2011-03-10T18:32:41-07:00

Dear Magick,

I am happy to confirm, that it does work! Thank you. ImageMagick is fabulous tool.

Best regards.

Post Reply