Michael von Aichberger <[EMAIL PROTECTED]> wrote:
> Imagine a 24-bit color image.
> 
> If I copyPixel this image into a 1-bit image, then I get kind of a mask,
> some pixels are white, others are black. It seems that all pixels above a
> threshold have been turned to white and below that threshold they have been
> turned to black.
> 
> The threshold seems to be a medium gray.
> 
> Now to my question: How can I achieve the same effect, but define another
> threshold for the separation, lets say a very bright grey?

Hi Michael,

Here's my first stab at this.  It works by darkening or lightening the
initial image before making the 1-bit mask.  The handler below allows you to
choose among 248 levels of gray for the cut off point, but not all 255.  If
255 levels are important, then you might like to test techniques using other
inks.

Cheers,

James

----------------------------------------------------------------------------

on makeMask(anImage, aCutOff)
  tRect   = anImage.rect
  tWidth  = tRect.width
  tHeight = tRect.height
  
  tMask   = image(tWidth, tHeight, 1)
  tTemp = anImage.duplicate()
  tFilter = image(tWidth, tHeight, 8, #grayscale)
  
  if aCutOff <= 127 then
    tColor   = 124 - aCutOff
    tColor   = rgb(tColor, tColor, tColor)
    tOptions = [#ink: #addPin]
    
  else -- aCutOff > 127 then
    tColor   = aCutOff - 123
    tColor   = rgb(tColor, tColor, tColor)
    tOptions = [#ink: #subtractPin]
  end if
  
  tFilter.fill(0, 0, tWidth, tHeight, tColor)
  tTemp.copyPixels(tFilter, tRect, tRect, tOptions)
  
  tMask.copyPixels(tTemp, tRect, tRect)
  
  return tMask
end makeMask

[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