Programmatically Reducing JPEG file size

后端 未结 4 955
再見小時候
再見小時候 2021-01-12 07:36

Apologies for any ignorance, but I have never worked with jpeg images (let alone any types of images) in Java before.

Supposing I want to send a jpeg image from a we

4条回答
  •  囚心锁ツ
    2021-01-12 07:52

    Have a look at the ImageIO class. As for reducing file size: since the image would already be a JPEG the only things you could do is reduce the quality or the image size.

    Another thing to keep in mind: if the image is a CMYK jpeg it might be bigger. Unfortunately ImageIO can't handle those, but you can try JAI ImageIO to convert from CMYK to RGB (which should be much smaller).

提交回复
热议问题