This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes PERFORMANCE problem in ENCODING java.awt.Image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "PERFORMANCE problem in ENCODING java.awt.Image" Watch "PERFORMANCE problem in ENCODING java.awt.Image" New topic

PERFORMANCE problem in ENCODING java.awt.Image


Joined: Jun 08, 2006
Posts: 24
Hi Friends, We are having a performace problem in encoding java.awt.Image in to any of the PNG or DIB or GIF formats. The problem is the size of the image is more than expected. We are getting 22 kb to 27 kb PNG image. But our requirement is 10 - 11 kb only. Here I am attaching the class file, which is actually doing encoding part. If any one can give valuable suggestion it will be great help to us. Thanq.
[ December 20, 2006: Message edited by: kvel murugan ]
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
So is 10-11 KB a size that is reasonably to be expected for the image you have, or do you require an image of that size? Those are two different things.

Have you had a look at the javax.imageio.ImageWriteParam.setCompressionQuality method? It can be used to set the compression level (and hence the quality and size of the resulting file).
I agree. Here's the link:
subject: PERFORMANCE problem in ENCODING java.awt.Image
It's not a secret anymore!