Java Utililty Methods Image Save

List of utility methods to do Image Save

Description

The list of methods to do Image Save are organized into topic(s).

Method

voidwrite(Image image, ImageOutputStream ios, ImageWriter writer)
write
writer.setOutput(ios);
ImageWriteParam pm = writer.getDefaultWriteParam();
RenderedImage renderedImage = toBufferedImage(image);
pm.setSourceRegion(new Rectangle(0, 0, renderedImage.getWidth(), renderedImage.getHeight()));
writer.write(renderedImage);
booleanwriteImageIconToFile(ImageIcon icon, String imageType, File targetFile)
Writes the given image icon to the given file in the given imageType.
try {
    BufferedImage iconimage = new BufferedImage(icon.getIconWidth(), icon.getIconWidth(),
            BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2 = iconimage.createGraphics();
    icon.paintIcon(null, g2, 0, 0);
    g2.dispose();
    ImageIO.write(iconimage, imageType, targetFile);
} catch (Exception e) {
...
voidwriteImageToBlob(int column, PreparedStatement psmt, Image image)
write Image To Blob
ImageIcon icon = null;
if (image != null) {
    icon = new ImageIcon(image);
writeToBlob(column, psmt, imageToBytes(icon));