Page 1 of 1

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

Posted: 2009-08-22T11:03:27-07:00
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...

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

Posted: 2009-08-22T12:05:59-07:00
by magick
Use page() rather than size().

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

Posted: 2009-08-22T12:10:50-07:00
by Bunkai
page() worked. Thank you :-)