The ImageAnalyzer opens image files and displays the visual contents of the file along with a summary of the data in the image file. The user can make adjustments to various elements of the image such as scaling and Alpha blending and can save these changes to a file.
If the Example Launcher is installed, select the Image Analyzer item from the Standalone category and click Run.
Otherwise, install and run the example manually as per the
Standalone Examples Manual Setup instructions. The executable class is
org.eclipse.swt.examples.imageanalyzer.ImageAnalyzer
.
The ImageAnalyzer will load and display image files of type GIF, JPEG, BMP, ICO, and PNG. To open a file, use the File->Open... menu item, and select the image file in the FileDialog.
If the file is an interlaced GIF or PNG or a progressive JPEG, and Incremental Display is selected, then the ImageAnalyzer displays the image increments as they are being loaded.
If the file contains an animated GIF, then the Next, Previous, and Animate buttons become enabled, and they can be used to cycle through the images in the file, or animate them. If a GIF defines a background color, as many animated GIFs do, selecting Background will use the GIF's background color.
If the image has transparency (possible with GIF, PNG, or ICO), then selecting Display Mask will draw the image's transparency mask to the right of the image. You can change the background color of the ImageAnalyzer to see the transparency work. To turn off the transparency, deselect Display Transparency.
After an image is loaded, it can be scaled or have alpha transparency applied, using the Scale and Alpha-K combos, and the Alpha menu. File->Reopen restores scaling and Alpha to their default values and reloads the current image file.
File->Save As... can be used to save the currently loaded image to another type of image file. If the image has transparency, File->Save Mask As... saves the image's transparency mask.
When SWT loads an image file, an instance of org.eclipse.swt.graphics.ImageData is created. (In the case of an ICO file or multi-image GIF, an array of ImageData instances is created). The ImageAnalyzer displays all of the data stored in the ImageData instance(s) for the currently loaded image file, including the pixel data. Hovering over a pixel in the image display will show the RGB color data for that pixel. For certain images (particularly animated GIFs) additional data is stored in the org.eclipse.swt.graphics.ImageLoader instance used to load the image. The ImageAnalyzer displays this data as well.