Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to generate thumbnails automatically by Java

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of "how to automatically generate thumbnail pictures in Java". The editor shows you the operation process through an actual case. The method of operation is simple and fast, and it is practical. I hope that this article "how to automatically generate thumbnail pictures in Java" can help you solve the problem.

First, the method of automatically generating thumbnails:

Package writeimg; import java.awt.geom.AffineTransform;import java.awt.image.AffineTransformOp;import java.awt.image.BufferedImage;import java.io.File;import java.io.IOException;import javax.imageio.ImageIO; public class JpegTool {private boolean isInitFlag = false; / / whether the object has been initialized private String pic_big_pathfilename = null; / / defines the file name of the path directory where the source picture is located private String pic_small_pathfilename = null / / the file name of the directory with the storage path for generating small images is private int smallpicwidth = 0; / / define the width and height of the generated small images, and give it one: private int smallpicheight = 0; private int pic_big_width=0; private int pic_big_height=0; private double picscale = 0 / / define the ratio of a small picture to the original image / * constructor * @ param has no parameter * / public JpegTool () {this.isInitFlag = false } / * private function, reset all parameters * @ param no parameters * @ return no return parameters * / private void resetJpegToolParams () {this.picscale = 0; this.smallpicwidth = 0; this.smallpicheight = 0 This.isInitFlag = false;} / * * @ param scale sets the size ratio of the thumbnail image to the source image, such as 0.5 * @ throws JpegToolException * / public void SetScale (double scale) throws JpegToolException {if (scale)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report