At 16:06 Uhr +0100 14.02.2005, Michael von Aichberger wrote:
Hi List,

I have an image object img1 and perform this command:

img2 = img1.trimWhiteSpace()

Is there a way to have the coordinates of the img2.rect relative to
img1.rect?

Any ideas? Thanks in advance!


you need trimwhitespace twice (unfortunately because trimwhitespace is slow)
basically you draw a dotin the upper left corner and compare the resulting rects.


if img.getPixel(1, 1) = rgb(255, 255, 255) then

  img.setPixel(1, 1, rgb(0,0,0))
  i = img.trimwhitespace()
  r1 = i.rect
  i.setPixel(1, 1, rgb(255, 255, 255))
  r2 = (i.trimwhitespace()).rect
  realtiveRect = r2.offset((r1.width - r2.width), (r1.height - r2.height))

else -- the image has a non white pixel at the top left so it will crop only to bottom right anyway

  realtiveRect = (img.trimwhitespace()).rect

end if


--

  |||
a�ex
 --

[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [email protected] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]

Reply via email to