Page 1 of 1

Magick++ image::extent() - undesired green color fill

Posted: 2009-08-18T05:48:02-07:00
by Bunkai
Dear Everybody,

I am in a need to dynamically increase canvas size in Image Magick++. Probably the best image method is:

Magick++ image::extent()

However, after increasing the image size, and saving it say as .png, I still get green color of the canvas, although I manually set background to transparent. Is this a bug?

// Create output image
Image imgOutput("1x1!", "transparent");

// to increase canvas size by the height of
myGeo.height(myGeo.height() + vFolderTree[nPosX].nTrimmedHeight);

// increase canvas size
imgOutput.backgroundColor("transparent");
myGeo.aspect(true);
imgOutput.extent(myGeo);

After this operation the background of the image s green and I can not get rid of it.

Best regards..

Re: Magick++ image::extent() - undesired green color fill

Posted: 2009-08-18T13:55:12-07:00
by magick
We're using ImageMagick 6.5.4-10, the latest release. It returns the expected results (an all transparent background) with this code:

Code: Select all

      Image imgOutput("1x1!", "transparent");
      Geometry myGeo;
      myGeo.width(myGeo.width()+100);
      myGeo.height(myGeo.height()+100);
      myGeo.aspect(true);
      imgOutput.backgroundColor("transparent");
      imgOutput.extent(myGeo);
      imgOutput.write( "image.png" );

Re: Magick++ image::extent() - undesired green color fill

Posted: 2009-08-22T11:59:06-07:00
by Bunkai
Thank you very much for your advice. Meanwhile I solved the same problem with Image::resize(). It did not return that green semitransparent background.

However, I will test your advice shortly, when I get to similar problem again.

Best regards..