Image::Trim() not updating Image().Size().xOff() and yOff()

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

Image::Trim() not updating Image().Size().xOff() and yOff()

Post by Bunkai »

Dear Imagemagick representative,

I have many game sprites rendered with backgrounds that need to be cut off. Therefore, I use Image::Trim() to get rid of transparent backgrounds. I need to record how many colums were removed for future computations. However, I see that Image::Trim() does not updates xOff and yOff values:

Version used: ImageMagick-6.5.4-Q8

Image my_image;
Geometry my_Geometry;
my_image.read(strFullFilePathAnsi);
my_image.trim();
my_Geometry = my_image.size();
vFolderTree[nPos].nTrimmedRctXOffset = my_Geometry.xOff(); // value is always 0 althought it is wrong
vFolderTree[nPos].nTrimmedRctYOffset = my_Geometry.yOff(); // value is always 0 althought it is wrong


Is there any other method to know how many colums and rows were trimmed?

With regards...
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Image::Trim() not updating Image().Size().xOff() and yOff()

Post by magick »

Use page() rather than size().
Bunkai
Posts: 22
Joined: 2007-01-15T07:37:59-07:00

Re: Image::Trim() not updating Image().Size().xOff() and yOff()

Post by Bunkai »

page() worked. Thank you :-)
Post Reply