1.主要内容:
压缩图片,像素改变,内存改变,位深度不变.
2.用到的技术:
idea+java1.8+ssm+io.
3.代码:
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGEncodeParam;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
import org.junit.Test;
import javax.swing.*;
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import java.text.SimpleDateFormat;
/*
compressedPictureTest:压缩图片像素,位深度不变
@param originalImage:图片源文件
*/
@Test
public void compressedPictureTest() throws Exception {
//https://blog.csdn.net/u010913106/article/details/46914259
//https://blog.csdn.net/ShadowerWArden/article/details/82629079
//https://blog.csdn.net/sky1373516909/article/details/84000519
//图片源文件originalImage
File originalImage = new File("D:\\img\\yyb_com.transtive.yundao.png");