Today to say picture compression technology, why use image compression, image upload is not finished it? Yes, that's what you can say a few years ago, because not so much concurrency as it was a few years ago, and it's not so focused on performance.
Today, many mobile phones, many people are access to the Internet through the mobile phone or app, and then call the interface will certainly be more or less browse the picture, especially out of the WiFi situation, you can see a lot of software show will show a small picture, this small picture is compressed pictures, click to enlarge, as follows:
This approach can minimize the mobile phone side of the picture display pressure, because a picture for the uploader may be hundreds of k, there may be a few trillion, so the pressure on the end of the mobile phone will be relatively large, but also consumes a lot of traffic, so in today's mobile phone Internet under the circumstances must do this image compression processing.
See no, so compression can save a lot of traffic
Image compression I have encountered two types, the first is not said, is the use of Java swing to do, not recommended, the recommendation of the second, is the Thumbnailator component, very practical, and has been updated
Add the following configuration to the Pom
<!--image Util--
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>${thumbnailator.version}</version>
</dependency>
Scale by length width, etc.
In addition, this component also has in accordance with the image quality promotion or reduction, watermark, rotation and other functions, interested friends may wish to play a game!
Java back-end implementation of image compression technology