Can we get the supported image types in Java

Java 8Object Oriented ProgrammingProgramming

Yes, we can get the supported image types with ImageIO class in Java. The following is an example to get supported image types in Java:

Example

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("\n" + type);
      }
   }
}

Output

Supported Image Types =
jpg
tif
tiff
bmp
gif
png
wbmp
jpeg
raja
Published on 06-May-2019 10:26:58
Advertisements