LitDev Extension API
LDImage
Provides methods to modify and image process images stored in ImageList.
Any effect parameter can be defaulted to "".
Add(image,red,green,blue)
Add colour values to image.
An image has pixels with R,G,B in the range 0 to 255.
image The ImageList image to modify.
red Red value to add.
green Geen value to add.
blue Blue value to add.
AddImages(image1,image2)
Add 2 images together.
An image has pixels with R,G,B in the range 0 to 255.
Both images must be the same dimension.
image1 The first ImageList image to add.
image2 The second ImageList image to add.
returns A new ImageList image with the result or "" on failure.
AddText(imageName,text,x,y,colour)
Annotate an image with text, using current GraphicsWindow font.
imageName An existing ImageList image.
text The text to add
x The left position of the text.
y The Top position of the text.
colour The text colour.
CloseWorkingImage(image)
Close and reset the image from a temporary working image.
image The working image, previously opened with OpenWorkingImage.
ColorMatrix(image,matrix)
Performs a colour matrix transformation on an image.
This can be used for all sorts of colour transformations.
See http://msdn.microsoft.com/en-us/library/a7xw19wh%28v=vs.110%29.aspx.
image The ImageList image to modify.
matrix A 5*5 2D matrix.
Sepia Example:
matrix[1] = "1=0.393;2=0.349;3=0.272;4=0;5=0"
matrix[2] = "1=0.769;2=0.686;3=0.534;4=0;5=0"
matrix[3] = "1=0.189;2=0.168;3=0.131;4=0;5=0"
matrix[4] = "1=0;2=0;3=0;4=1;5=0"
matrix[5] = "1=0;2=0;3=0;4=0;5=1"
Copy(image)
Copy an image from the ImageList.
image The ImageList image to copy.
returns A new ImageList image or "" on failure.
Crop(image,x,y,width,height)
Crop an image from the ImageList.
The crop region must be entirely within the target image.
image The ImageList image to crop.
x The left position of the cropped image in pixels (indexed from 0).
y The top position of the cropped image in pixels (indexed from 0).
width The width of the cropped image in pixels.
height The height of the cropped image in pixels.
DifferenceImages(image1,image2)
Difference 2 images.
An image has pixels with R,G,B in the range 0 to 255.
Both images must be the same dimension.
image1 The first ImageList image to difference.
image2 The second ImageList image to difference.
returns A new ImageList image with the result or "" on failure.
EffectAccent(image,hue,range)
Converts to colour accent effect.
image The ImageList image to modify.
hue Accent Hue (0 o 360, default 0 (red)).
range Accent range (default 40).
EffectBlocks(image,size)
Converts to block effect.
image The ImageList image to modify.
size Blocking size factor (default 5).
EffectBlue(image)
Converts to blue colour.
image The ImageList image to modify.
EffectBulge(image,factor)
Converts to bulge effect (similar to FishEye).
image The ImageList image to modify.
factor Bulge factor, may be less than 1 for pinch effect (default 2).
EffectCartoon(image,radius,levels,inverse)
Converts to cartoon effect.
image The ImageList image to modify.
radius Cartoon radius (odd number, default 7).
levels Cartoon levels (default 10).
inverse Cartoon inverse threshold (default 40).
EffectCharcoal(image)
Converts to charcoal effect.
image The ImageList image to modify.
EffectContrast(image,contrast)
Converts to high contrast effect.
image The ImageList image to modify.
contrast Contrast factor (default 2), less than 1 reduces contrast.
EffectCyan(image)
Converts to cyan colour.
image The ImageList image to modify.
EffectDefaults
Get or set an array of default effect parameters.
EffectEdge(image)
Converts to Prewitt edge effect.
image The ImageList image to modify.
EffectFishEye(image,factor)
Converts to fisheye effect.
image The ImageList image to modify.
factor FishEye factor, should be greater than 1 (default 2).
EffectFuzzy(image,size)
Converts to fuzzy effect.
image The ImageList image to modify.
size Pixel region to make fuzzy (default 4).
EffectGamma(image,gamma)
Converts to gamma effect.
image The ImageList image to modify.
gamma Gamma factor, values less than 1 lighten and greater than 1 darken (default 2).
EffectGray(image)
Converts to gray scale.
image The ImageList image to modify.
EffectGreen(image)
Converts to green colour.
image The ImageList image to modify.
EffectHue(image,hue)
Converts to modify Hue.
image The ImageList image to modify.
hue Hue shift (0 to 360, default 180).
EffectInverse(image)
Converts to inverse colour.
image The ImageList image to modify.
EffectJagged(image,size)
Converts to jagged effect.
image The ImageList image to modify.
size Pixel region size to make jagged (default 4).
EffectLightness(image,lightness)
Converts to modify Lightness.
image The ImageList image to modify.
lightness Lightness multiplier (default 2).
EffectMagenta(image)
Converts to magenta colour.
image The ImageList image to modify.
EffectNoiseRemoval(image)
Converts to noise removal effect.
image The ImageList image to modify.
EffectOilPaint(image,radius,levels)
Converts to oil paint effect.
image The ImageList image to modify.
radius Oil paint radius (odd number, default 7).
levels Oil paint levels (default 20).
EffectPixelate(image,size)
Converts to pixelate effect.
image The ImageList image to modify.
size Pixelating size factor (default 16).
EffectPosterise(image,level)
Converts to posterise effect.
image The ImageList image to modify.
level Posterise level (default 50).
EffectRed(image)
Converts to red colour.
image The ImageList image to modify.
EffectReflect(image,flip)
Converts to X or Y reflection effect.
image The ImageList image to modify.
flip 0 to flip X and 1 to flip Y (default 0).
EffectRotate(image,rotation)
Converts to 90 degree rotation effect.
image The ImageList image to modify.
rotation 0 for +90, 1 for 180 and 2 for 270(-90) degree rotation (default 0).
EffectSaturation(image,saturation)
Converts to modify Saturation.
image The ImageList image to modify.
saturation Saturation multiplier (default 2).
EffectSepia(image,threshold)
Converts to sepia effect.
image The ImageList image to modify.
threshold Sepia threshold (default 30).
EffectSketch(image)
Converts to pen sketch effect.
image The ImageList image to modify.
EffectSnow(image,level)
Converts to snow effect.
image The ImageList image to modify.
level 1 in level pixels are randomly snow (default 25).
EffectSolarise(image,power)
Converts to solarise effect.
image The ImageList image to modify.
power Solarise power (default 2, quadratic).
EffectSwirl(image,factor)
Converts to swirl effect.
image The ImageList image to modify.
factor Swirl factor (default 1).
EffectYellow(image)
Converts to yellow colour.
image The ImageList image to modify.
GetEffects()
Get an array of the available image and webcam effects.
returns An array of effects, indexed by the effect number.
GetImagePixels(image)
Get a 2D array filled with all the pixels in an image.
image The ImageList image.
returns An array of hex based image pixel colours indexed by [x][y].
GetPixel(image,x,y)
Get a pixel colour.
image The ImageList image.
x The x pixel (indexed from 1).
y The y pixel (indexed from 1).
returns The pixel colour.
GetWorkingImagePixel(image,x,y)
Get the colour of a pixel from a temporary working image.
image The working image, previously opened with OpenWorkingImage.
x The x pixel coordinate (indexed from 1).
y The y pixel coordinate (indexed from 1).
returns The pixel colour or "" on failure.
GetWorkingImagePixelARGB(image,x,y)
Get the colour of a pixel from a temporary working image.
image The working image, previously opened with OpenWorkingImage.
x The x pixel coordinate (indexed from 1).
y The y pixel coordinate (indexed from 1).
returns The pixel colour, an array of A,R,G,B components indexed by "A", "R", "G", "B" or "" on failure.
HeightMap2NormalMap(image,scale)
Create a normal map image from a height map. The height is given by the brightness of each pixel.
image The height map ImageList image.
scale A scale factor for the elevation (default 1).
returns A new ImageList image with the resulting normal map.
Histogram(image)
Get histograms of colour pixel values.
image The ImageList image.
returns An array of colour histograms, indexed by 1,2,3 for R,G,B and 0 to 255.
LoadImage(fileNameOrURL)
Replacement for default method of the same name. Handles image downloads from Flickr.
Loads an image from a file or the Internet into memory (Imagelist).
fileNameOrURL The file name to load the image from. This could be a local file or a URL to the Internet location.
returns Returns the name of the image that was loaded.
LoadSVG(fileName)
Load an SVG file as an ImageList image.
fileName The SVG file.
returns The ImageList image.
MakeTransparent(image,colour)
Modify an ImageList image to make a selected colour transparent.
image The ImageList image.
colour The colour to make transparent.
MetaData(imageFile)
Get an array of image metadata.
imageFile The image file (not an ImageList image).
returns An array of metadata values indexed by hex id (Use quotes for indices with a to f in the hex values).
See https://msdn.microsoft.com/en-us/library/System.Drawing.Imaging.propertyitem.id%28v=vs.110%29.aspx for a list of ids.
Multiply(image,red,green,blue)
Multiply colour values of image.
An image has pixels with R,G,B in the range 0 to 255.
image The ImageList image to modify.
red Red value to multiply by.
green Geen value to multiply by.
blue Blue value to multiply by.
NewImage(width,height,colour)
Create a new single colored 32bitARGB image in ImageList.
width The width of the new image.
height The height of the new image.
colour The colour of the new image.
returns The Name of the new created ImageList image on success, else "".
NormalMap(shapeName,sourceX,sourceY,sourceZ,texture,ambient,intensity)
Modify an image to show a gray scale (or modified image if texture is set) shadow effect based on a normal map image.
shapeName An image shape normal map (R,G,B colours represent normal vecors of a 3D image).
This is an image shape created using Shapes.AddImage containing the normal map image.
sourceX The x position of a light source relative to the image.
sourceY The y position of a light source relative to the image.
sourceZ The z position of a light source relative to the image, this is the height abouve the image.
This can be used to alter the effective contrast of the shadow effect.
texture An optional ImageList image or "" with texture (colour) to modify, it should be the same dimensions as the normal map image.
The texture image may be changed on subsequent calls.
ambient Optional ambient light intensity if texture is set (default 0.3).
intensity Optional light intensity if texture is set (default 2).
OpenWorkingImage(image)
Open a temporary working image for fast pixel level manipulation.
After the temporary working image is finished with it should be set to the image using CloseWorkingImage.
image The ImageList image to open as a temporary working image.
Remove(image)
Remove an image from the ImageList.
image The ImageList image to delete.
ReplaceColour(image,colourFrom,colourTo,tolerance)
Replace one colour in an ImageList image with another.
image The ImageList image.
colourFrom The colour to replace.
colourTo The replacement colour to apply.
tolerance A tolerance for the colour to match (default 0 - exact match).
ARGB pixel values all within the tolerance will be replaced.
Resize(image,width,height)
Resize an image from the ImageList.
image The ImageList image to resize.
width The width in pixels.
height The height in pixels.
Rotate(image,angle)
Rotate an image.
image The ImageList image to modify.
angle The angle to rotate the image clockwise by in degrees.
Save(image,fileName)
Save an image from the ImageList as a jpg.
image The ImageList image to save.
fileName The file to save the image as.
SaveAs(image,fileName)
Save an image from the ImageList in different formats set by the file extension.
image The ImageList image to save.
fileName The file to save the image as.
Accepted file type extensions include *.bmp, *.gif, *.jpg, *.png, *.tiff or *.ico.
SetImagePixels(pixels)
Create a new image from a 2D array of pixel colour values - see GetImagePixels for format of pixels.
pixels An array of hex based image pixel colours indexed by [x][y].
returns An ImageList image created from the pixels.
SetPixel(image,x,y,colour)
Set a pixel colour.
image The ImageList image.
x The x pixel (indexed from 1).
y The y pixel (indexed from 1).
colour The colour to set the pixel.
SetWorkingImagePixel(image,x,y,colour)
Set the colour of a pixel in a temporary working image.
image The working image, previously opened with OpenWorkingImage.
x The x pixel coordinate (indexed from 1).
y The y pixel coordinate (indexed from 1).
colour The colour to set the pixel to.
SplitImage(imageName,countX,countY)
Creates an array of subdivided images from an input image.
imageName The image file (local or network) to load.
Can also be an ImageList image.
countX The number of sub-images in the X direction.
countY The number of sub-images in the Y direction.
returns A 2D array of resulting images saved in ImageList.
Statistics(image)
Get the minimum, maximum, mean and STD for colour pixel values.
image The ImageList image.
returns An array of statistics values (0 to 255), indexed by "Min", "Max", "Mean", "STD" and 1,2,3 for R,G,B.
To32bitARGB(image)
Converts an ImageList image to Format ARGB (Alphachannel with 32bit/Pxl) if needed.
image The ImageList image.
returns "SUCCESS" or "FAILED".
UseFastPixelMethods
Use a fast pixel manipulation method (default "True").
This method can be turned off using this property.