description | features | samples | manual | download | buy | |||
Please view complete list of samples
The sample shows how to load JPEG image from file, convert it to Palette image and change colors of all pixels where red value is less than 72 to black transparent color
Threshold.vbs
Dim im Set im = CreateObject("ActiveImage.Images.1") 'im.CreateImagePalette 300,400 im.SetImageType 1 im.ReadFromFile "C:\AI\rose.jpg" im.ConvertToPaletteNoAlpha width = im.GetWidth height = im.GetHeight colorbk_r = 0 colorbk_g = 0 colorbk_b = 0 Threshold = 72 For x = 0 to width for y = 0 to height r = im.GetPixelRed(x,y) g = im.GetPixelGreen(x,y) b = im.GetPixelBlue(x,y) if r < Threshold then im.SetColor colorbk_r, colorbk_g, colorbk_b im.SetPixel x,y end if next next im.SetColor colorbk_r, colorbk_g, colorbk_b im.SetTransparent 1 im.SetSaveAlpha 0 im.SetImageType 3 im.WriteToFile "C:\AI\Threshold.gif" im.SetImageType 0 im.WriteToFile "C:\AI\Threshold.png" im.DestroyImage Set im = Nothing |
Picture 1. rose.jpg (size - 6,3Kb) | Picture 1. Threshold.gif (size - 11,4Kb) | |
If you have any questions or bug reports, write to support@tonec.com for technical support.
Privacy Policy | |
© 1999-2005. Tonec, Inc. All rights reserved. |