Here you go:

on makeBlueScaleImageFromGrayscale anImage
  --pre: anImage is an 8-bit grayscale or a 32-bit representation of a 
grayscale image
  --post: a new "bluescale" image is returned
  width = anImage.width
  height = anImage.height
  newImage = image(width, height, 32, TRUE)

  is8bit = (anImage.depth = 8)

  height = height - 1
  width = width - 1

  repeat with j = 1 to height
    repeat with i = 1 to width
      if is8bit then anInteger = 255 - anImage.getPixel(i, j, #integer)
      else anInteger = anImage.getPixel(i, j).blue
      multiplier = anInteger / 255.0
      aPixel = color(multiplier * anInteger, multiplier * anInteger, anInteger)
      newImage.setPixel(i, j, aPixel)

    end repeat
  end repeat

  return newImage
end makeBlueScaleImageFromGrayscale


Regards,

Daniel
[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 
lingo-l@penworks.com  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to