mini
mini

Reputation: 855

How to reduce BufferedImage Size without losing quality

As I am working on images and to improve the performance of the application need to reduce the size of the image data without loosing quality.

For example : if original Buffered Image size is 50kb, dimensions 1024*768 After apply reducing alog: size is < 30kb, dimensions 1024* 768 with same quality as original image.

Could you please tell me how to reduce the buffered image without reducing quality.

Thanks & Regards mini.

Upvotes: 2

Views: 1722

Answers (2)

umlum
umlum

Reputation: 1137

You need to define your measure of quality :-) An image may be compressed in a way that a human observer does not see any loss in quality, even though the image data changed slightly. This is lossy compression. In lossless compression, you will be able to reconstruct the original data bit for bit.

Lossless compression

Works by "intelligently repackaging data". Classic algorithms here are Huffman Coding or Run-Length Coding. The .png format or some flavors of .tiff store images losslessly.

Unfortunately, there are limits on how much lossless coding can do: Data carries a certain amount of information, which puts a lower bound on how small your file can get.

Lossy compression

Works by reordering data into "important" and "uninportant" parts, and drops the unimportant ones. Examples for this reordering are Vector Quantization or Discrete Cosine Transform. The most popular format for lossy image compression is .jpeg.

In lossy compression, there is no strict lower bound on how small your file size can get. However, there is a threshold where human observers start seeing compression artifacts. Still, for many image types, lossy algorithms achive smaller file sizes than lossless ones without a noticeable drop in quality.

Upvotes: 1

user166566
user166566

Reputation:

Beside the standard losless compressions available, I guess, you can't do very much.

But: What color depth are you using? Is it really necessary, that the images are available in 24bit? There are very good dithering algorithms out there, which will reduce the color depth to a palette of colors. Usually you can achieve very good results. It surely depends on what images you got as source and what the customers expects as result.

Upvotes: 1

Related Questions