Atitit. Image processing JPG image compression cleanup junk image Java version

Source: Internet
Author: User
Tags image processing library

Atitit. image Processing jpg image compression cleanup trash picture Java version

1. Clean picture compressed picture size 1

2. So to use ImageWriter 1

3. Thumbnails quality compression builder. outputquality (0.9); 2

4. handling of the Attilax framework Code 2

5. To an article that mentions how to control the quality of JPG images after compression 3

6. Reference 4

1. Clear the image compressed image size

Target :: 300kb>>>10kb.

Process Flow : £º scale, outputquality (0.5)

Cut crop,only top half ....

On the upload to a cloud disk , CP processing : SYSN

Work out a mini version of pic folder . was with a Ori Large Size Folder sync.. Remove the other don't ...

In the middle of not a picture to remove the k - lan ...

Author:: Old Wow's paw attilax Ayron, email:[email protected]

Reprint please indicate source: Http://blog.csdn.net/attilax

2.so to useImageWriter

ImageIO can support output in selected formats

But you can't set the quality yourself.

Iwp.setcompressionmode (imagewriteparam.mode_explicit); //Set whether to compress

3.ThumbnailsMass CompressionBuilder.outputquality(0.9);

00001. builder. outputquality (0.9); //parameter is floating point, between 0-1

Mass compression

00001. builder. outputquality (0.9); //parameter is floating point, between 0-1

4. Attilaxprocessing of the frameworkCode

Atibrow

Public void scale4clr (string jpg, string deboxjpg, int width)

throws IOException {

Image img = imageio.read (new File (jpg));

int width2 = img. getwidth (null);

if (width2<width+2)

{System. out. println ("--skip:"+jpg);

return;

}

// int wid = width2-(Border * 2);

Double Scale_perst= (double)width/(double)width2;

Double nowhit=img. getheight (null);

Double Nowwit=scale_perst*width2;

int Nowhit_haf= (int) img. getheight (null)/2;

// int Hit = Img.getheight (null)-(Border * 2);

Thumbnails.of (jpg). Scale (Scale_perst). Sourceregion (positions. Top_left, (int) width2, nowhit_haf). OutputFormat ("JPG"). Outputquality ( 0.5). ToFile (deboxjpg);

}

5.to an article that mentions how to control the quality of JPG images after compression


http://www.universalwebservices.net/web-programming-resources/java/adjust-jpeg-image-compression-quality-when-saving-images-in-java/
The point is, I'm proposing here .
imagewriter writer;//Get ImageWriter Object yourself
Imagewriteparam IWP = Writer.getdefaultwriteparam ();
Iwp.setcompressionmode (imagewriteparam.mode_explicit);
//Parameters are 0 and 1
//1 To set minimum compression to maintain maximum picture quality
iwp.setcompressionquality (1);
File File = new file (OUTPUTFILE);
fileimageoutputstream output = new Fileimageoutputstream (file);
writer.setoutput (output);
iioimage image = new Iioimage (bufferedimage, NULL, NULL);
//write pictures
writer.write (null, image, IWP);
writer.dispose ()

6. Reference

JAVA Image Processing Library thumbnails-The Hadron it blog. htm

Image compression by mass, converted to character array summary-Kfhzy's Column-Blog channel-CSDN.NET.htm

How to adjust JEPG image compression with Java? -Java-know. htm

The picture in Java is compressed by quality again summary--iteye technology website. htm

Atitit. Image processing JPG image compression cleanup junk image Java version

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.