Java Utililty Methods Image Create

List of utility methods to do Image Create

Description

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

Method

BufferedImagemakeImage(double[][] levels)
make Image
BufferedImage image = new BufferedImage(levels.length, levels[0].length, BufferedImage.TYPE_BYTE_GRAY);
WritableRaster writeableRaster = image.getRaster();
for (int i = 0; i < writeableRaster.getWidth(); ++i) {
    for (int j = 0; j < writeableRaster.getHeight(); ++j) {
        writeableRaster.setPixel(i, j, new double[] { levels[i][j] });
return image;
...
voidmakeImageResizer(String srcImgPath, String targerPath, int scaledWidth, int scaledHeight, boolean preserveAlpha)
make Image Resizer
BufferedImage originalImage = ImageIO.read(new File(srcImgPath));
int imageType = preserveAlpha ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
BufferedImage scaledBI = new BufferedImage(scaledWidth, scaledHeight, imageType);
Graphics2D g = scaledBI.createGraphics();
if (preserveAlpha) {
    g.setComposite(AlphaComposite.Src);
g.drawImage(originalImage, 0, 0, scaledWidth, scaledHeight, null);
...