- 浏览: 2869821 次
- 性别:
- 来自: 武汉
文章分类
- 全部博客 (1173)
- 名言警句 (5)
- 心情随笔 (50)
- 数据库 (57)
- Java基础 (241)
- J2EE框架 (91)
- 数据结构 (12)
- 程序设计 (21)
- WEB技术 (128)
- 网络日志 (12)
- IT资讯 (247)
- linux (64)
- solaris (2)
- 其它 (143)
- WebService (4)
- 日语学习 (2)
- 机器人 (5)
- Android (5)
- cgywin (3)
- Game (1)
- DWR (1)
- spring (8)
- canvas (1)
- Guava (3)
- Modbus (5)
- 测试 (6)
- mongodb (9)
- Quartz (2)
- Cron (1)
- windows (2)
- 持续集成 (1)
- bootstrap (3)
- 结对编程 (1)
- nodejs (1)
- Netty (1)
- 安全 (3)
- webstorm (2)
- sparkline (1)
- Job (1)
- git (3)
- Maven (3)
- knockout (5)
- jquery (1)
- bower (1)
- docker (1)
- confluence (4)
- wiki (1)
- GoogleMap (1)
- jekyll (10)
- ruby (2)
- npm (3)
- browserify (1)
- gulp (3)
- openwrt (1)
- discuz (3)
- 输入法 (1)
- JPA (1)
- eclipse (2)
- IntelliJ (1)
- css (1)
- 虚拟机 (1)
- 操作系统 (1)
- azkaban (2)
- scrum (1)
最新评论
-
pangxiea_:
你好, 想请问一下 Linux下 这么使用rxtxcomm 在 ...
使用Java进行串口通信 -
abababudei:
请教一下,这个您是怎么解决的:/dev/ttyS2enteri ...
Java应用程序的MODBUS通讯 -
xuniverse:
hannibal005 写道楼主,我问下 request.se ...
用javascript与java进行RSA加密与解密 -
atxkm:
找了一下午,终于找到了
gulp 拷贝文件时如何移除文件目录结构 -
kalogen:
gtczr 写道非常感谢,经过我自己的修改,已经完美实现。发出 ...
用javascript与java进行RSA加密与解密
ScaleImage.java
import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO; //生成等比例高质量缩略图 public class ScaleImage { private int width; private int height; private int scaleWidth; double support = (double) 3.0; double PI = (double) 3.14159265358978; double[] contrib; double[] normContrib; double[] tmpContrib; int startContrib, stopContrib; int nDots; int nHalfDots; /** *//** * Start: Use Lanczos filter to replace the original algorithm for image * scaling. Lanczos improves quality of the scaled image modify by :blade */ public static void main(String[] args) { ScaleImage is = new ScaleImage(); try { is.saveImageAsJpg("d:/firefox.jpg", "d:/test.jpg", 768, 680); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } // fromFileStr原图片地址,saveToFileStr生成缩略图地址,formatWideth生成图片宽度,formatHeight高度 public void saveImageAsJpg(String fromFileStr, String saveToFileStr, int formatWideth, int formatHeight) throws Exception { BufferedImage srcImage; File saveFile = new File(saveToFileStr); File fromFile = new File(fromFileStr); srcImage = javax.imageio.ImageIO.read(fromFile); // construct image int imageWideth = srcImage.getWidth(null); int imageHeight = srcImage.getHeight(null); int changeToWideth = 0; int changeToHeight = 0; if (imageWideth > 0 && imageHeight > 0) { // flag=true; if (imageWideth / imageHeight >= formatWideth / formatHeight) { if (imageWideth > formatWideth) { changeToWideth = formatWideth; changeToHeight = (imageHeight * formatWideth) / imageWideth; } else { changeToWideth = imageWideth; changeToHeight = imageHeight; } } else { if (imageHeight > formatHeight) { changeToHeight = formatHeight; changeToWideth = (imageWideth * formatHeight) / imageHeight; } else { changeToWideth = imageWideth; changeToHeight = imageHeight; } } } srcImage = imageZoomOut(srcImage, changeToWideth, changeToHeight); ImageIO.write(srcImage, "JPEG", saveFile); } public BufferedImage imageZoomOut(BufferedImage srcBufferImage, int w, int h) { width = srcBufferImage.getWidth(); height = srcBufferImage.getHeight(); scaleWidth = w; if (DetermineResultSize(w, h) == 1) { return srcBufferImage; } CalContrib(); BufferedImage pbOut = HorizontalFiltering(srcBufferImage, w); BufferedImage pbFinalOut = VerticalFiltering(pbOut, h); return pbFinalOut; } /** *//** * 决定图像尺寸 */ private int DetermineResultSize(int w, int h) { double scaleH, scaleV; scaleH = (double) w / (double) width; scaleV = (double) h / (double) height; // 需要判断一下scaleH,scaleV,不做放大操作 if (scaleH >= 1.0 && scaleV >= 1.0) { return 1; } return 0; } // end of DetermineResultSize() private double Lanczos(int i, int inWidth, int outWidth, double Support) { double x; x = (double) i * (double) outWidth / (double) inWidth; return Math.sin(x * PI) / (x * PI) * Math.sin(x * PI / Support) / (x * PI / Support); } private void CalContrib() { nHalfDots = (int) ((double) width * support / (double) scaleWidth); nDots = nHalfDots * 2 + 1; try { contrib = new double[nDots]; normContrib = new double[nDots]; tmpContrib = new double[nDots]; } catch (Exception e) { System.out.println("init contrib,normContrib,tmpContrib" + e); } int center = nHalfDots; contrib[center] = 1.0; double weight = 0.0; int i = 0; for (i = 1; i <= center; i++) { contrib[center + i] = Lanczos(i, width, scaleWidth, support); weight += contrib[center + i]; } for (i = center - 1; i >= 0; i--) { contrib[i] = contrib[center * 2 - i]; } weight = weight * 2 + 1.0; for (i = 0; i <= center; i++) { normContrib[i] = contrib[i] / weight; } for (i = center + 1; i < nDots; i++) { normContrib[i] = normContrib[center * 2 - i]; } } // end of CalContrib() // 处理边缘 private void CalTempContrib(int start, int stop) { double weight = 0; int i = 0; for (i = start; i <= stop; i++) { weight += contrib[i]; } for (i = start; i <= stop; i++) { tmpContrib[i] = contrib[i] / weight; } } // end of CalTempContrib() private int GetRedValue(int rgbValue) { int temp = rgbValue & 0x00ff0000; return temp >> 16; } private int GetGreenValue(int rgbValue) { int temp = rgbValue & 0x0000ff00; return temp >> 8; } private int GetBlueValue(int rgbValue) { return rgbValue & 0x000000ff; } private int ComRGB(int redValue, int greenValue, int blueValue) { return (redValue << 16) + (greenValue << 8) + blueValue; } // 行水平滤波 private int HorizontalFilter(BufferedImage bufImg, int startX, int stopX, int start, int stop, int y, double[] pContrib) { double valueRed = 0.0; double valueGreen = 0.0; double valueBlue = 0.0; int valueRGB = 0; int i, j; for (i = startX, j = start; i <= stopX; i++, j++) { valueRGB = bufImg.getRGB(i, y); valueRed += GetRedValue(valueRGB) * pContrib[j]; valueGreen += GetGreenValue(valueRGB) * pContrib[j]; valueBlue += GetBlueValue(valueRGB) * pContrib[j]; } valueRGB = ComRGB(Clip((int) valueRed), Clip((int) valueGreen), Clip((int) valueBlue)); return valueRGB; } // end of HorizontalFilter() // 图片水平滤波 private BufferedImage HorizontalFiltering(BufferedImage bufImage, int iOutW) { int dwInW = bufImage.getWidth(); int dwInH = bufImage.getHeight(); int value = 0; BufferedImage pbOut = new BufferedImage(iOutW, dwInH, BufferedImage.TYPE_INT_RGB); for (int x = 0; x < iOutW; x++) { int startX; int start; int X = (int) (((double) x) * ((double) dwInW) / ((double) iOutW) + 0.5); int y = 0; startX = X - nHalfDots; if (startX < 0) { startX = 0; start = nHalfDots - X; } else { start = 0; } int stop; int stopX = X + nHalfDots; if (stopX > (dwInW - 1)) { stopX = dwInW - 1; stop = nHalfDots + (dwInW - 1 - X); } else { stop = nHalfDots * 2; } if (start > 0 || stop < nDots - 1) { CalTempContrib(start, stop); for (y = 0; y < dwInH; y++) { value = HorizontalFilter(bufImage, startX, stopX, start, stop, y, tmpContrib); pbOut.setRGB(x, y, value); } } else { for (y = 0; y < dwInH; y++) { value = HorizontalFilter(bufImage, startX, stopX, start, stop, y, normContrib); pbOut.setRGB(x, y, value); } } } return pbOut; } // end of HorizontalFiltering() private int VerticalFilter(BufferedImage pbInImage, int startY, int stopY, int start, int stop, int x, double[] pContrib) { double valueRed = 0.0; double valueGreen = 0.0; double valueBlue = 0.0; int valueRGB = 0; int i, j; for (i = startY, j = start; i <= stopY; i++, j++) { valueRGB = pbInImage.getRGB(x, i); valueRed += GetRedValue(valueRGB) * pContrib[j]; valueGreen += GetGreenValue(valueRGB) * pContrib[j]; valueBlue += GetBlueValue(valueRGB) * pContrib[j]; // System.out.println(valueRed+"->"+Clip((int)valueRed)+"<-"); // // System.out.println(valueGreen+"->"+Clip((int)valueGreen)+"<-"); // System.out.println(valueBlue+"->"+Clip((int)valueBlue)+"<-"+"-->"); } valueRGB = ComRGB(Clip((int) valueRed), Clip((int) valueGreen), Clip((int) valueBlue)); // System.out.println(valueRGB); return valueRGB; } // end of VerticalFilter() private BufferedImage VerticalFiltering(BufferedImage pbImage, int iOutH) { int iW = pbImage.getWidth(); int iH = pbImage.getHeight(); int value = 0; BufferedImage pbOut = new BufferedImage(iW, iOutH, BufferedImage.TYPE_INT_RGB); for (int y = 0; y < iOutH; y++) { int startY; int start; int Y = (int) (((double) y) * ((double) iH) / ((double) iOutH) + 0.5); startY = Y - nHalfDots; if (startY < 0) { startY = 0; start = nHalfDots - Y; } else { start = 0; } int stop; int stopY = Y + nHalfDots; if (stopY > (int) (iH - 1)) { stopY = iH - 1; stop = nHalfDots + (iH - 1 - Y); } else { stop = nHalfDots * 2; } if (start > 0 || stop < nDots - 1) { CalTempContrib(start, stop); for (int x = 0; x < iW; x++) { value = VerticalFilter(pbImage, startY, stopY, start, stop, x, tmpContrib); pbOut.setRGB(x, y, value); } } else { for (int x = 0; x < iW; x++) { value = VerticalFilter(pbImage, startY, stopY, start, stop, x, normContrib); pbOut.setRGB(x, y, value); } } } return pbOut; } // end of VerticalFiltering() int Clip(int x) { if (x < 0) return 0; if (x > 255) return 255; return x; } }
-------------------------------------------------------------------------------------------------
ImageScale.java
import java.awt.image.BufferedImage; public class ImageScale { private int width; private int height; private int scaleWidth; double support = (double) 3.0; double PI = (double) 3.14159265358978; double[] contrib; double[] normContrib; double[] tmpContrib; int startContrib, stopContrib; int nDots; int nHalfDots; /** * Start: * Use Lanczos filter to replace the original algorithm for image scaling. Lanczos improves quality of the scaled image * modify by :blade * */ public BufferedImage imageZoomOut(BufferedImage srcBufferImage, int w, int h) { width = srcBufferImage.getWidth(); height = srcBufferImage.getHeight(); scaleWidth = w; if (DetermineResultSize(w, h) == 1) { return srcBufferImage; } CalContrib(); BufferedImage pbOut = HorizontalFiltering(srcBufferImage, w); BufferedImage pbFinalOut = VerticalFiltering(pbOut, h); return pbFinalOut; } /** * 决定图像尺寸 * */ private int DetermineResultSize(int w, int h) { double scaleH, scaleV; scaleH = (double) w / (double) width; scaleV = (double) h / (double) height; //需要判断一下scaleH,scaleV,不做放大操作 if (scaleH >= 1.0 && scaleV >= 1.0) { return 1; } return 0; } // end of DetermineResultSize() private double Lanczos(int i, int inWidth, int outWidth, double Support) { double x; x = (double) i * (double) outWidth / (double) inWidth; return Math.sin(x * PI) / (x * PI) * Math.sin(x * PI / Support) / (x * PI / Support); } // end of Lanczos() // // Assumption: same horizontal and vertical scaling factor // private void CalContrib() { nHalfDots = (int) ((double) width * support / (double) scaleWidth); nDots = nHalfDots * 2 + 1; try { contrib = new double[nDots]; normContrib = new double[nDots]; tmpContrib = new double[nDots]; } catch (Exception e) { System.out.println("init contrib,normContrib,tmpContrib" + e); } int center = nHalfDots; contrib[center] = 1.0; double weight = 0.0; int i = 0; for (i = 1; i <= center; i++) { contrib[center + i] = Lanczos(i, width, scaleWidth, support); weight += contrib[center + i]; } for (i = center - 1; i >= 0; i--) { contrib[i] = contrib[center * 2 - i]; } weight = weight * 2 + 1.0; for (i = 0; i <= center; i++) { normContrib[i] = contrib[i] / weight; } for (i = center + 1; i < nDots; i++) { normContrib[i] = normContrib[center * 2 - i]; } } // end of CalContrib() //处理边缘 private void CalTempContrib(int start, int stop) { double weight = 0; int i = 0; for (i = start; i <= stop; i++) { weight += contrib[i]; } for (i = start; i <= stop; i++) { tmpContrib[i] = contrib[i] / weight; } } // end of CalTempContrib() private int GetRedValue(int rgbValue) { int temp = rgbValue & 0x00ff0000; return temp >> 16; } private int GetGreenValue(int rgbValue) { int temp = rgbValue & 0x0000ff00; return temp >> 8; } private int GetBlueValue(int rgbValue) { return rgbValue & 0x000000ff; } private int ComRGB(int redValue, int greenValue, int blueValue) { return (redValue << 16) + (greenValue << 8) + blueValue; } //行水平滤波 private int HorizontalFilter(BufferedImage bufImg, int startX, int stopX, int start, int stop, int y, double[] pContrib) { double valueRed = 0.0; double valueGreen = 0.0; double valueBlue = 0.0; int valueRGB = 0; int i, j; for (i = startX, j = start; i <= stopX; i++, j++) { valueRGB = bufImg.getRGB(i, y); valueRed += GetRedValue(valueRGB) * pContrib[j]; valueGreen += GetGreenValue(valueRGB) * pContrib[j]; valueBlue += GetBlueValue(valueRGB) * pContrib[j]; } valueRGB = ComRGB(Clip((int) valueRed), Clip((int) valueGreen), Clip((int) valueBlue)); return valueRGB; } // end of HorizontalFilter() //图片水平滤波 private BufferedImage HorizontalFiltering(BufferedImage bufImage, int iOutW) { int dwInW = bufImage.getWidth(); int dwInH = bufImage.getHeight(); int value = 0; BufferedImage pbOut = new BufferedImage(iOutW, dwInH, BufferedImage.TYPE_INT_RGB); for (int x = 0; x < iOutW; x++) { int startX; int start; int X = (int) (((double) x) * ((double) dwInW) / ((double) iOutW) + 0.5); int y = 0; startX = X - nHalfDots; if (startX < 0) { startX = 0; start = nHalfDots - X; } else { start = 0; } int stop; int stopX = X + nHalfDots; if (stopX > (dwInW - 1)) { stopX = dwInW - 1; stop = nHalfDots + (dwInW - 1 - X); } else { stop = nHalfDots * 2; } if (start > 0 || stop < nDots - 1) { CalTempContrib(start, stop); for (y = 0; y < dwInH; y++) { value = HorizontalFilter(bufImage, startX, stopX, start, stop, y, tmpContrib); pbOut.setRGB(x, y, value); } } else { for (y = 0; y < dwInH; y++) { value = HorizontalFilter(bufImage, startX, stopX, start, stop, y, normContrib); pbOut.setRGB(x, y, value); } } } return pbOut; } // end of HorizontalFiltering() private int VerticalFilter(BufferedImage pbInImage, int startY, int stopY, int start, int stop, int x, double[] pContrib) { double valueRed = 0.0; double valueGreen = 0.0; double valueBlue = 0.0; int valueRGB = 0; int i, j; for (i = startY, j = start; i <= stopY; i++, j++) { valueRGB = pbInImage.getRGB(x, i); valueRed += GetRedValue(valueRGB) * pContrib[j]; valueGreen += GetGreenValue(valueRGB) * pContrib[j]; valueBlue += GetBlueValue(valueRGB) * pContrib[j]; // System.out.println(valueRed+"->"+Clip((int)valueRed)+"<-"); // // System.out.println(valueGreen+"->"+Clip((int)valueGreen)+"<-"); // System.out.println(valueBlue+"->"+Clip((int)valueBlue)+"<-"+"-->"); } valueRGB = ComRGB(Clip((int) valueRed), Clip((int) valueGreen), Clip((int) valueBlue)); // System.out.println(valueRGB); return valueRGB; } // end of VerticalFilter() private BufferedImage VerticalFiltering(BufferedImage pbImage, int iOutH) { int iW = pbImage.getWidth(); int iH = pbImage.getHeight(); int value = 0; BufferedImage pbOut = new BufferedImage(iW, iOutH, BufferedImage.TYPE_INT_RGB); for (int y = 0; y < iOutH; y++) { int startY; int start; int Y = (int) (((double) y) * ((double) iH) / ((double) iOutH) + 0.5); startY = Y - nHalfDots; if (startY < 0) { startY = 0; start = nHalfDots - Y; } else { start = 0; } int stop; int stopY = Y + nHalfDots; if (stopY > (int) (iH - 1)) { stopY = iH - 1; stop = nHalfDots + (iH - 1 - Y); } else { stop = nHalfDots * 2; } if (start > 0 || stop < nDots - 1) { CalTempContrib(start, stop); for (int x = 0; x < iW; x++) { value = VerticalFilter(pbImage, startY, stopY, start, stop, x, tmpContrib); pbOut.setRGB(x, y, value); } } else { for (int x = 0; x < iW; x++) { value = VerticalFilter(pbImage, startY, stopY, start, stop, x, normContrib); pbOut.setRGB(x, y, value); } } } return pbOut; } // end of VerticalFiltering() int Clip(int x) { if (x < 0) return 0; if (x > 255) return 255; return x; } /** * End: * Use Lanczos filter to replace the original algorithm for image scaling. Lanczos improves quality of the scaled image * modify by :blade * */ }
评论
3 楼
sundysea
2008-10-11
我重新写了一个 压缩图片,个人感觉很满意。不会出现我说的这个问题了,大家可以参考
这个是我在csdn博客发表的。
http://blog.csdn.net/feng_sundy/archive/2008/08/05/2769572.aspx
这个是我在csdn博客发表的。
http://blog.csdn.net/feng_sundy/archive/2008/08/05/2769572.aspx
2 楼
sunxboy
2008-08-03
这个,这个............
1 楼
sundysea
2008-08-02
部分图片压缩的时候,我用了一个图片只有430k,1600 X 1565,可是大概压缩了5分钟才完成,这样的速度,无法接受。
我的机器配置Intel Coro2 4400 2G内存
但是我压缩有的图片2M,3072X2048 就很快,不知道是什么原因呢?
我的机器配置Intel Coro2 4400 2G内存
但是我压缩有的图片2M,3072X2048 就很快,不知道是什么原因呢?
发表评论
-
高级Java程序员值得拥有的10本书
2015-05-04 07:24 810Java是时下最流行的编程语言之一。市面上也出现了适合初学者 ... -
深入理解java异常处理机制
2015-01-30 09:30 13271. 引子 try…catch…fi ... -
java 运行时参数设置
2015-01-07 09:13 865JVM的运行时参数: -Xms为执行单元内存的1/4, ... -
每个Java开发者都应该知道的5个JDK工具
2014-12-29 12:37 1139JDK是Java语言的软件开 ... -
使用双重锁判定可以大幅降低锁的征用
2014-12-29 12:30 746class ObjInstance { //单例 pri ... -
MAVEN Scope使用说明
2014-11-24 09:40 757在Maven的依赖管理中,经常会用到依赖的scope设置。这 ... -
Spring4 quartz job xml configuration
2014-11-11 09:46 14371. 定义job details public ... -
Add items into list in one line using guava
2014-11-10 10:54 721//@formatter:off fina ... -
配置动态读取(变化)文件 in Spring
2014-11-10 08:51 13231. 从环境变量中读取路径: <bean id=&q ... -
JAVA实现AES加密与解密
2014-11-04 15:34 659package com.eifesun.monitor.up ... -
Netty4.x分析
2014-07-31 11:06 1461官网定义: netty是一个异步、事件驱动的网络应用框架,用 ... -
Ways to sort lists of objects in Java based on multiple fields
2014-07-21 17:19 7711. the first way: Sorting wit ... -
how to parse a String to BigDecimal
2014-07-21 10:08 917private BigDecimal parsePrice( ... -
order list using google guava
2014-07-21 09:08 884Predicate<String> filter ... -
Java 读文件操作
2014-07-08 14:09 8861. only use java core, no exte ... -
怎样使Java 中测试按一定顺序执行
2014-03-10 11:27 1318@FixMethodOrder(MethodSorters. ... -
如何实现在当类初始化时,自动调动某个方法
2014-02-14 14:44 964有两种思路, 1. 将这个类实现为thread类 (or ... -
持续集成JenkinsAPI常见用法
2014-02-10 13:54 43jenkins(持续集成开源工具)提供了丰富的api接口,基 ... -
Sonar 安装与使用
2014-01-13 10:49 1730Sonar 是一个用于代码质量管理的开放平台。通过插件机制, ... -
源代码管理分析工具 Source Navigator的安装与使用
2014-01-13 09:51 1891Source-Navigator是原来redhat开发的一个 ...
相关推荐
"java 图片生成缩略图" Java 图片生成缩略图是Java程序开发中一个常见的需求,通过...本文介绍了使用Java生成缩略图的方法和原理,并讨论了缩略图生成的优点。通过使用Java生成缩略图,可以提高网站的性能和用户体验。
### Java 上传图片生成缩略图的知识点解析 在现代Web开发中,处理图像是一项常见的需求,尤其是在涉及用户上传图片的应用场景中。本篇文章将基于提供的代码片段详细讲解如何使用Java来实现上传图片并自动生成缩略图...
在Java编程中,生成视频的缩略图是一项常见的任务,特别是在多媒体处理或视频分享平台的开发中。这个实例主要关注如何使用Java在指定的时间点截取视频生成图片。以下是一些相关的知识点: 1. **Java Media ...
java 生成缩略图类 源代码 (已经封装好)
在Java编程环境中,获取视频缩略图是一项常见的需求,尤其在多媒体应用或者视频分享平台中。这个过程涉及到多媒体处理和图像操作的知识。本文将详细解释如何在Java中实现这一功能,以及相关的技术点。 首先,Java...
java上传图片,处理图片,word转pdf图片缩略图生成,替换所有图片的ip地址工具类
将图片生成缩略图和转换为二进制的工具类,缩略图大小可调
网页缩略图生成技术是一种常见的Web开发功能,它允许用户通过输入网址、设定目标宽度和高度,快速获取网站页面的预览图片。这种技术在许多应用场景中非常实用,例如社交媒体分享、搜索引擎结果展示、网站目录索引等...
### 上传图片并生成高清晰缩略图 #### 背景与概述 在Web开发领域,特别是ASP.NET应用程序中,上传图片并自动生成高质量缩略图是一项常见且实用的功能。这种需求通常出现在用户头像上传、产品图片展示等场景中。...
java大图生成缩略图。。。。。。。。。。。。
#### 缩略图生成的原理 生成缩略图的核心在于对原始图像进行等比例缩小处理,以保持图像的比例不变。在Java中,主要通过`java.awt.image.BufferedImage`类及其相关方法来实现。 ### Java生成缩略图的技术细节 ####...
在 Java 中生成图片缩略图是一项常见的需求,这通常涉及到图像处理技术。以下是一个 Java 类 `GetPicture` 的示例,它包含了获取网络图片、截取屏幕以及创建图片缩略图的功能。我们将详细解释其中的关键知识点。 1....
这个jar包为开发者提供了一个方便的API来处理GIF图像的缩略图生成,使得在Java项目中实现这一功能变得更加简单。 GIF4J库的核心功能包括读取GIF文件、解析其帧信息、调整图像尺寸并重新组合成新的GIF文件。以下是...
java图片裁剪和java生成缩略图.pdf
在Java编程中,生成缩略图是一项常见的任务,特别是在处理图像处理、网页设计或移动应用开发时。这个任务涉及到读取原始图像,调整其尺寸,然后保存为较小的版本,即缩略图。在这个过程中,我们可以使用Java的内置库...
本项目就是关于如何在Java环境中使用ffmpeg来获取视频的缩略图,提供了一个简单易用的解决方案。 首先,ffmpeg是一个强大的命令行工具,它支持多种视频、音频格式的处理,包括转换、合并、剪辑以及生成缩略图等。在...
网上找的缩略图生成方法都不够清晰,于是决定自己研究和改进生成缩略图方法。此方法压缩后的图片小,清晰度高,压缩速度快。5000张图片大概抽根烟的功夫就压缩完了。高清的哦。各种参数都是可配的,方便移植到自己...
在Java编程环境中,批量上传图片并生成缩略图是一项常见的需求,特别是在开发Web应用时,例如内容管理系统或者论坛。这个任务通常涉及到文件处理、图像处理和服务器端编程等多个技术领域。接下来,我们将深入探讨...
在Java中生成缩略图是一项常见的任务,尤其是在开发Web应用或者需要处理用户上传图片的系统中。这个过程涉及对原始图像进行重新尺寸调整,以创建一个较小的版本,通常用于预览或节省存储空间。在提供的代码片段中,...