Java Image Processing Utilities
This packages provides a scripting language for Image Processing.
It may be run as a Java Servlet, a CGI web program, or just a plain old-fashioned command-line applicatipon.
You will need Java to run this application.
You can load an image from a file, and save it in a variable:sphinx = /home/paul/cager.image/smallsphinx.gifOr the image could be loaded from a URL:
sphinx = http://www.paulcager.org/smallsphinx.gifImages may be saved back to files:
save(sphinx, "MyImage.png")Or displayed in a pop-up window:
show(sphinx)There is a set of built-in functions and operators:
halfSize = scale(sphinx, 0.5);
clip = subImage(sphinx, 20, 40) // Return a sub-image whose origin is coordinate (20,40).
clip = subImage(sphinx, 20, 40, 10, 15) // As above, but subImage is clipped to width 10 height 15.
rot = rotate(sphinx, 45, RED) // Rotate 45 degrees, filling in newly-created blank spaces with Red.
bordered = border(sphinx, 4, BLUE) // Add a 4-pixel blue border.
bordered = border(sphinx, 4, 3, 2, 1, BLUE) // Add left, top, right, bottom borders of specified thickness.
clip = cut(sphinx, 4, 3, 2, 1) // Remove specified pixels from the left, top, right, and bottom sides of the image.
newImage = image(12, 24, blue) // Create a new 12x24 image, filled with blue.
newImage = row(image1, image2, image3) // Create a new image from the 3 specified images laid together in a row.
newImage = col(image1, image2, image3) // As above, but laid together vertically.
newImage = matrix(img00, img10, img20;
img01, img11, img21) // Create a 3x2 matrix of images. The ";" delimits rows.
newImage = [img00, img10, img20;
img01, img11, img21] // Alternative syntax for a matrix.
blended = blend(img1, img2, img3) // Blend a list of images.
mirror = mirrorVertically(sphinx) // Return a (vertically) mirrored image.
mirror = mirrorHorizontally(sphinx) // Return a (horizontally) mirrored image.
rotated = sphinx @ 45 // Rotate by 45 degrees.
halfSize = sphinx / 2 // Scale by 0.5.
doubleSize = sphinx * 2 // Scale by 2
blended = img1 | img2 | img3 // Alternative syntax for blending.
split(sphinx, 5, 5, "MyFile-%x-%y.png") // Splits the image into 5x5 pixel tiles, and saves the tiles
// in file names whose format is specified by the last argument.
tile(sphinx, 5, 5, "MyFile-%x-%y.png") // Similar to "split", but specifies the number of tiles you want
// rather than the tile size. This example will produce 25 tiles.
Usual String and numeric arithmetic is suported:
img = scale(img, 1.0 / 4)Functions and operators may be nested in the usual way:
show(scale(border(sphinx, 10, RED), 2))Variables may be set to control behaviour:
set proxyServer = "123.456.789.012" // Set the HTTP proxy's server name and port. set proxyPort = 8080
Linking To Other Image Manipulation Packages.
You may also link to other, third-party, image processing packages, and call functions within those packages from your script. This is done using a properties file to define the mapping from function names in the script to Java class names.
The download includes Jerry Huxtable's excellent Image filter Classes, which provide a vast number of image manipulation functions. Take a look at his site for more information.
Examples of some of these functions:
img = ripple(sphinx) img = blur(sphinx) img = sparkle(sphinx, amount=0.4) img = oil(sphinx, levels=2, range=4)
Refer to Jerry's site for details, or just experiment!