How to Properly Create High-Quality Thumbnails

"When creating thumbnails, Snowbound provides a powerful convenience method, IMG_create_thumbnail(xsize,ysize)," said Bill Slack, Senior Software Engineer at Snowbound. "This method will call the highest quality resizing method appropriate for either black and white or color images."

Here is an example that demonstrates how to create a high-quality thumbnail 100 pixels wide:

...

Snowbnd image = new Snowbnd(); Snowbnd thumbnail = null;

...

image.IMG_decompress_bitmap(“example.jpg”, 0); // create at correct aspect ratio thumbnail = image.IMG_create_thumbnail(100, (100/image.getWidth())*image.getHeight());

...

"In order to create thumbnails even more quickly, IMG_resize_bitmap(xsize,ysize) can be used instead," said Slack. "This will generate much lower image quality, however, and is only recommended when speed is more important than image quality.

How to Create Thumbnails From the Current Image

"Coming in the next release of RasterMaster for Java™ is the addition of a new feature that is useful for an application developer creating thumbnail previews: the copy constructor," said Slack. "This enables developers to create an exact, and completely independent, copy of the current Snowbound image, including all image data and meta data. Thumbnails created with the copy constructor are used in Snowbound next-generation VirtualViewer web viewer to create preview images in the Info dialog and Picture Controls dialog."

Here is an example that demonstrates how to make a copy of the current image and create a thumbnail:

...

Snowbnd mainImage = new Snowbnd();

...

Snowbnd thumbnail = new Snowbnd(mainImage); // reset zoomed area thumbnail.set_crop_rect(0,0,thumbnail.getWidth(), thumbnail.getHeight()); thumbnail = thumbnail.IMG_create_thumbnail(100, (100/image.getWidth())*image.getHeight());

...

Learn More In addition to our Tech Tips section, our document and image Solutions Section provides business application examples and industry-specific examples including image conversion, image compression and web viewing.

Category:

Online Demo