I had a situation when I wanted to display thumbnails of the images that my user had uploaded to my web application. A straightforward way could be to return the images in its entirety and use css techniques to scale down the image into a thumbnail. However, this is costly for my users who mainly access my web application from mobile devices.
One strategy for optimizing the web experiences of my users would be to generate the thumbnails at the server end so as to reduce the sizes of the HTTP responses that my server sends back to the mobile devices. And to reduce bloat from external libraries, I decided to use the facilities provided from Java standard libraries.
This post documents how I create a thumbnail from an image without using external Java libraries. For the sake of brevity, let’s assume that we had downloaded an image via HTTP GET from a web server and saved that image to the path /images/sample.jpg.
Follow us