Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Show Recordset's Current Record
Quck Fill
Tint bitmap behaviour
Spaceship Move by keypress
Snow Falling
Animate Text Shadow
AppActive
CD Everywhere
BinFileIO Xtra
Open MIAW
MediaMacros Xtras Mall
 

 

 

Behavior Sharpen Filter - Imaging Lingo

Added on 8/23/2005

 

Compatibilities:
behavior D8 D8_5 D9 Mac Parent PC Shockwave

This item has not yet been rated

Author: Chunick (website)

This algorithm will sharpen an image. It's equivalent to the sharpen filter in Photoshop.

-- Sharpen Image Algorithm
-- ©2005 by Josh Chunick (josh@chunick.com)
-- This code is free to use in commercial applications
-- or however you want.If you use this code you
-- must keep the comments, including this message,
-- intact. Feel free to add any changes or make
-- improvements.

-- anImage is an image object
-- theAmount is an integer, higher values sharpen more

on sharpenImage (theImage, theAmount)
  
  theWidth = theImage.width - 1
  theHeight = theImage.height - 1
  newImage = theImage.duplicate()
  -- the look-up table for the original image (done for speed purposes)
  listX = []
  listY = []
  repeat with x = 0 to theWidth
    repeat with y = 0 to theHeight
      listY.add(theImage.getPixel(x,y))
    end repeat
    listX.add(listY)
    listY = []
  end repeat
  -- draw each pixel in the new image
  repeat with y1 = 2 to theHeight
    repeat with x1 = 2 to theWidth
      
      -- get the 2 pixels we need for sharpening
      theColour1 = listX[x1][y1]
      theColour2 = listX[x1 - 1][y1 - 1]
      
      newColour = theColour1 + theAmount * (theColour1 - theColour2)
      
      --Set this pixel into the new image
      newImage.setPixel(point(x1 - 1,y1 - 1), newColour)
      
    end repeat
  end repeat
  
  return newImage
  
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail