推荐:揭秘EL表达式语言的基础总结EL语言是JSTL输出(输入)一个JAVA表达式的表示形式。 在JSTL中,EL语言只能在属性值中使用。EL语言只能通过建立表达式${exp1}来进行调用。在属性值中使用表达式有三种方式。 1、value属性包含一个表达式 some:tagvalue=${expr}/ 在这种情况下,表达式值被
**************************************** *
* 通过流的形式读取图片并保存到别的文件夹里
*
* *************************************/ package util;
import java.io.File;
import java.io.FileOutputStream;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage; import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.codec.jpeg.JPEGImageEncoder; public class TuPian{
public void jpgTset() throws Exception{
File _file = new File("d:\\Project\\Test\\pic\\1\\1.jpg"); //读入文件 Image src = javax.imageio.ImageIO.read(_file); //构造Image对象 int wideth=src.getWidth(null); //得到源图宽 int height=src.getHeight(null); //得到源图长 System.out.println("长度为"+String.valueOf(wideth)); System.out.println("宽度为"+String.valueOf(height)); BufferedImage tag = new BufferedImage(wideth/2,height/2,BufferedImage.TYPE_INT_RGB); tag.getGraphics().drawImage(src,0,0,wideth/2,height/2,null); //绘制缩小后的图 // 输出到文件流
FileOutputStream out=new FileOutputStream("d:\\Project\\Test\\pic\\2\\newfile.jpg"); // File file = new File("newFile.jpg");
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); encoder.encode(tag); //JPEG编码
out.close();
}
public static void main(String[] args){
try{
new TuPian().jpgTset();
}catch(Exception e){
e.printStackTrace();
}
}
}
分享:揭秘JAVA面试问题宝典大家找工作就要面试,有面试就有对付面试的办法。以下一些题目来自我朋友痛苦的面试经历,他给我总结了一下,我拿来和大家分享!提这些问题的公司包括IBM,E*Trade,Siebel,Motorola,SUN,以及其它大小公司。 面试是没什么道理可讲的,它的题目有的不合情理、脱