aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes How can I reduce the image size of a PNG file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "How can I reduce the image size of a PNG file" Watch "How can I reduce the image size of a PNG file" New topic
Author

How can I reduce the image size of a PNG file

ying lam
Ranch Hand

Joined: May 17, 2004
Posts: 85
Hi,

I am using the following code to convert an image to a PNG file:



I would like to know how can I reduce the file size of the converted file.
I read there is a trick which can reduce the color map of the result image without losing much image quality.

Can you please tell me how can I do that in java?

Thank you.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39576
    
  27
There's example code that shows how to compress an image to a JPEG here. It's possible that it works out of the box with PNGs as well (I'm not sure about the algorithms PNG uses), or -worst case- you can write a JPEG in the desired quality/compression, read it back into memory, and then write it as a PNG.


Ping & DNS - updated with new look and Ping home screen widget
ying lam
Ranch Hand

Joined: May 17, 2004
Posts: 85
Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I reduce the image size of a PNG file
 
Similar Threads
Crop an Image
How can I merge 18 images to 1 images?
Error in Dowlnoading
Writing Image onto a WordDoc
Showing JSP output in XSL