==[[Java サムネイルイメージの作成]]==[[Java]] | {{category [[Category:コード片}}]]
import java.awt.geom.AffineTransform;
* @param rate
* @throws IOException
* @throws ImageServiceExceptionImageSer[[vi]]ceException
*/
public void writeThumbNailImage(InputStream in,
* @param rate
* @throws IOException
* @throws ImageServiceExceptionImageSer[[vi]]ceException
*/
public void writeThumbNailImage(InputStream in,
* @param height
* @throws IOException
* @throws ImageServiceExceptionImageSer[[vi]]ceException
*/
public void writeThumbNailImage(InputStream in,
* @param height
* @throws IOException
* @throws ImageServiceExceptionImageSer[[vi]]ceException
*/
public void writeThumbNailImage(InputStream in,
BufferedImage image = ImageIO.read(in);
double rate = calcRatiocalc[[R]]atio(width, height, image);
writeThumbNailImage(out, image, formatName, rate);
}
* @return
*/
private double calcRatiocalc[[R]]atio(int width, int height, BufferedImage image) { double wRate w[[R]]ate = (double) width / (double) image.getWidth(); double hRate h[[R]]ate = (double) height / (double) image.getHeight(); return (wRate w[[R]]ate < hRateh[[R]]ate) ? wRate w[[R]]ate : hRateh[[R]]ate;
}
* @param rate
* @throws IOException
* @throws ImageServiceExceptionImageSer[[vi]]ceException
*/
public void writeThumbNailImage( OutputStream out,
if (srcFilename.equals(dstFilename)) {
System.out.println("ERROR E[[R]][[R]]O[[R]] : 変換前のファイル名と、変換後のファイル名が同じです");
}
me.writeThumbNailImage(in, out, ratio);
} else {
System.out.println("ERROR E[[R]][[R]]O[[R]] : サイズが指定されていません");
}
System.out.println("完了しました");