[英]Compress image using JPEG Lossless and convert the image to Base64Encoded String
We have a requirement to compress an image which will be of size around 50 KB - 75 KB within 25KB limit.我们需要压缩大小在 50 KB 到 75 KB 左右的图像,限制在 25 KB 以内。 We were following the example given in http://examples.javacodegeeks.com/desktop-java/imageio/compress-a-jpeg-file/ .我们遵循http://examples.javacodegeeks.com/desktop-java/imageio/compress-a-jpeg-file/ 中给出的示例。 by specifying the quality as 0.1f we are able to reduce the size of the image below 25 KB.通过将质量指定为 0.1f,我们能够将图像的大小减小到 25 KB 以下。 But the image looses its quality.但图像失去了它的质量。
We need your suggestion on:我们需要您的建议:
We need your help in resolving this.我们需要您的帮助来解决这个问题。 Please help.请帮忙。
JPEG does not support lossless compression. JPEG 不支持无损压缩。 Your best bet will be to use the new Google WebP format .您最好的选择是使用新的Google WebP 格式。 It compresses pretty good and is lossless.它压缩得很好而且是无损的。 There is no point in converting it to Base64.将其转换为 Base64 毫无意义。 That is a ridiculous operation when you are trying to keep the data as small as possible.当您试图保持数据尽可能小时,这是一个荒谬的操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.