How can we get the supported image types in Java
是的,我们可以使用 Java 中的 ImageIO 类获取受支持的图像类型。下面是 Java 中获取受支持图像类型的示例
示例
package my; import javax.imageio.ImageIO; public class SwingDemo { public static void main(String[] args) throws Exception { String[] imgTypes = ImageIO.getReaderFileSuffixes(); System.out.print("Supported Image Types = "); for (String type : imgTypes) { System.out.print("
" + type); } } }
输出
Supported Image Types = jpg tif tiff bmp gif png wbmp jpeg
广告