Reputation: 671
I need to transmit the image from the mobile phone to the server. I am able to reduce the image screen size but not the memory size. I understand i have to deal with the color depth. J2ME does not seem to offer any scaling method which 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 I would I tackle this ? I would like to reduce the image memory size before i transmit to the server.
Upvotes: 1
Views: 2837
Reputation: 2261
Take a look to this (GEAR Java Mobile Framework). There is an utility package with a class named ImageHelper. It contains some methods to scale an image and thus reduce it's size. It works good on mobile devices and it's reasonably fast to execute. If your image is still a big one or you don't want to loose too much data, consider using a compression algorithm. zlib offers a very good solution and there's an implementation for J2ME ready to be used.
Upvotes: 1