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

更新於: 2019 年 7 月 30 日

87 個瀏覽量

開啟您的職業生涯

完成課程以獲得認證

開始
廣告
© . All rights reserved.