Can we get the supported image types in Java


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

Output

Supported Image Types =
jpg
tif
tiff
bmp
gif
png
wbmp
jpeg

Updated on: 30-Jul-2019

61 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements