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

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Bunkai
Posts: 22
Joined: 2007-01-15T07:37:59-07:00

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

Post 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..
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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" );
Bunkai
Posts: 22
Joined: 2007-01-15T07:37:59-07:00

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

Post 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..
Post Reply