Michael von Aichberger wrote:
> 
> > 'Massage' the 24-bit image first, thinking out loud:
> > Make another image object the same size that is some appropriate shade of
> grey
> > Copy the second image onto the first using an appropriate ink (probably
> blend, lighten or darken)
> > Copy the resulting image into a 1-bit image
> 
> Hi Carl,
> 
> thanks for your answer, I have played a lot with these inks, but I just
> don't get it.
> If you or someone else could be a little more specific, I'd really
> appreciate it.

Works on my machine:

on makemask mem, thresh
-- thresh is the threshhold value where the mask changes from black to white (0..256)
  original = member(mem)
  hite = original.height
  wdth = original.width
  thresh = thresh + 4  -- fudge factor, dunno why, but it works
  amount = abs(128 - thresh)
  theInk = [33,35][1 + (thresh > 128)]   -- either Add Pin or Subtract Pin
  
  tempImage = image(wdth, hite, 32)
  tempImage = original.image.duplicate()
  
  greyImage = image(wdth, hite, 32)
  greyimage.fill(original.rect, rgb(amount,amount,amount))
  
  
  tempImage.copypixels(greyImage, original.rect, original.rect, [#ink:theInk])
  
  maskmem = new(#bitmap)
  maskmem.Image = image(wdth, hite, 1)
  maskmem.image.copyPixels(tempimage, original.rect, original.rect)
 
  tempImage = void
  greyimage = void
  
end

You could even skew the mask toward different colors by messing with the rgb value 
greyImage gets filled with.

-- 
Carl West   [EMAIL PROTECTED]   http://eisen.home.attbi.com

I have no superfluous leisure; my stay must be stolen out
of other affairs; but I will attend you awhile.
           - Isabella, Measure for Measure, Act 3 Scene 1
[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