jgraphictools
download     |    JThumbnailer     |    ImageResizer     |    feedback     |    juniverse.org

j-graphic-tools (jgt) is a easy to use Java-API and a collection of usefull tools for graphic manipulation. It is released under a Apache-styled license. At the moment only jpg images are supported, other graphic formats will follow. jgt includes the following tools/libs:
  • JThumbnailer: Creates a html page with thumbnails of your images
  • ImageResizer: Resize graphics (tool and Api)
jgt uses the JIMI-API from Sun (http://java.sun.com/products/jimi).
JThumbnailer

JThumbnailer is a commandline tool. You can start it with the following command:

    java org.juniverse.jgraphictools.JThumbnailer <path_to_properties_file>

Make sure that jgraphictools.jar and jimiproclasses.jar are in your classpath! In the specified properties file, you need to include the following attributes:
  • SOURCE_DIR: the place where your original images are stored (they will not be modified)
  • TARGET_DIR: the directory, where the html file and the thumbnails will be saved
  • THUMBNAIL_DIR: the subdirectory for the thumbnails
  • HTML_TEMPLATE: the name of the html template that will be used
  • TABLE_HEADER: the header of the table, in which the thumbnails will be displayed
  • TABLE_FOOTER: the footer of the table, in which the thumbnails will be displayed
  • IMAGE_TAG: the string, that will be replaced by the image table
  • TABLE_COLS: the number of columns in the table
  • TARGET_WIDTH: the width of the thumbnails
  • TARGET_HEIGHT: the height of the thumbnails
You can find an example for an properties file here. Please not that you have to use a slash / instead of an backslash \ for any path (yes, on windows too).

You can setup the layout of your html page with every tool you like. Simple insert an tag like <images/> on that location in your page, where the thumbnails should be insert. Specifiy the tag in the IMAGE_TAG property.

If you specify only one of the values TARGET_WIDTH and TARGET_HEIGHT, the other one will be computed by the JThumbnailer (set the second parameter simple to -1).

^ top
ImageResizer

As Java-API you can use the ImageResizer like this:

If you like to resize a single graphic:

import org.juniverse.jgraphictools.ImageResizer;

ImageResizer.resize("C:/source.jpg", "C:/target.jpg", 800, 600);


If you like to resize all graphics in an directory:

import org.juniverse.jgraphictools.ImageResizer;

ImageResizer ir = new ImageResizer();
ir.setSourceDir("C:/source");
ir.setTargetDir("C:/target");
ir.setTargetWidth(640);
ir.setTargetHeight(480);
ir.resize();


As commandline tool, you use it like the JThumbnailer:

    java org.juniverse.jgraphictools.ImageResizer <path_to_properties_file>

Make sure that jgraphictools.jar and jimiproclasses.jar are in your classpath! In the specified properties file, you need to include the following attributes:
  • SOURCE_DIR: the place where your original images are stored (they will not be modified)
  • TARGET_DIR: the directory, where the html file and the thumbnails will be saved
  • TARGET_WIDTH: the width of the thumbnails
  • TARGET_HEIGHT: the height of the thumbnails
Please not that you have to use a slash / instead of an backslash \ for any path (yes, on windows too).

If you specify only one of the values TARGET_WIDTH and TARGET_HEIGHT, the other one will be computed by the ImageResizer (set the second parameter simple to -1).

^ top
Feedback

Any feedback is welcome! Please write to juniverse AT users.sourceforge.net.



^ top


SourceForge.net Logo   JOrganizer