2022-02-25 15:20发布
mport java.awt.image.BufferedImage;import java.io.File;import java.io.IOException;import javax.imageio.ImageIO; public class Test { public static void main(String[] args) throws IOException { BufferedImage bi = (BufferedImage) ImageIO.read(new File("E:\\2.png")); // 获取图像的宽度和高度 int width = bi.getWidth(); int height = bi.getHeight(); boolean isTransparent = true; // 扫描图片 for (int i = 0; i < height xss=removed xss=removed xss=removed xss=remove>
You can check if the image's color model includes an alpha channel:
BufferedImage img = ImageIO.read(/* from somewhere */);
if (img.getColorModel().hasAlpha()) {undefined
// img has alpha channel
} else {undefined
// no alpha channel
最多设置5个标签!
mport java.awt.image.BufferedImage;import java.io.File;import java.io.IOException;import javax.imageio.ImageIO; public class Test { public static void main(String[] args) throws IOException { BufferedImage bi = (BufferedImage) ImageIO.read(new File("E:\\2.png")); // 获取图像的宽度和高度 int width = bi.getWidth(); int height = bi.getHeight(); boolean isTransparent = true; // 扫描图片 for (int i = 0; i < height xss=removed xss=removed xss=removed xss=remove>
回答: 2022-03-01 15:25
You can check if the image's color model includes an alpha channel:
BufferedImage img = ImageIO.read(/* from somewhere */);
if (img.getColorModel().hasAlpha()) {undefined
// img has alpha channel
} else {undefined
// no alpha channel
一周热门 更多>