How to reduce image depth / reduce image size in Java ME?

I need to transfer an image from a mobile phone to a server. I can shrink the screen size but not the memory size. I understand that I have to deal with color depth. J2ME doesn't seem to offer any scaling method that is available in J2SE:

image rescaled = image.getScaledInstance(thumbWidth, thumbHeight,  Image.SCALE_AREA_AVERAGING);
BufferedImage biRescaled = toBufferedImage(rescaled, thumbWidth, thumbHeight, BufferedImage.TYPE_INT_RGB);

      

How would I go about it? I would like to reduce the memory size of the image before being sent to the server.

+1


source to share


1 answer


Take a look at this ( GEAR Java Mobile Framework ). There is a utility package with the ImageHelper class. It contains some ways to scale the image and thus reduce its size. It works well on mobile devices and runs fairly quickly. If your image is still large or you don't want to lose too much data, consider using a compression algorithm. zlib offers a very good solution and an implementation for J2ME will be implemented there.



+1


source







All Articles