src/main/java/eu/digitisation/image/Format.java
public static Format valueOf(java.io.File file) throws IOException {
        String name = file.getName();
        String ext = name
                .substring(name.lastIndexOf('.') + 1)
                .toLowerCase(Locale.ENGLISH);
        if (ext.equals("bpm")) {
            return BMP;
        } else if (ext.equals("fpx")) {
            return FlashPix;
        } else if (ext.equals("gif")) {
            return GIF;
        } else if (ext.equals("jpg") || ext.equals("jpeg")) {
            return JPEG;
        } else if (ext.equals("png")) {
            return PNG;
        } else if (ext.equals("pnm")) {
            return PNM;
        } else if (ext.equals("tif") || ext.equals("tiff")) {
            return TIFF;
        } else if (ext.equals("wbmp")) {
            return WBMP;
        } else {
            throw new IOException("Unsupported image format " + ext);
        }
    }
/**
     *
     * @param file the container file
     * @return the Format associated with this file name extension
     * @throws IOException
     */
@param file the container file
@return the Format associated with this file name extension
@throws IOException
@param file the container file @return the Format associated with this file name extension @throws IOException
public static Format valueOf(java.io.File file) throws IOException {
        String name = file.getName();
        String ext = name
                .substring(name.lastIndexOf('.') + 1)
                .toLowerCase(Locale.ENGLISH);
        if (ext.equals("bpm")) {
            return BMP;
        } else if (ext.equals("fpx")) {
            return FlashPix;
        } else if (ext.equals("gif")) {
            return GIF;
        } else if (ext.equals("jpg") || ext.equals("jpeg")) {
            return JPEG;
        } else if (ext.equals("png")) {
            return PNG;
        } else if (ext.equals("pnm")) {
            return PNM;
        } else if (ext.equals("tif") || ext.equals("tiff")) {
            return TIFF;
        } else if (ext.equals("wbmp")) {
            return WBMP;
        } else {
            throw new IOException("Unsupported image format " + ext);
        }
    }
public static Format valueOf ( java . io . File file ) throws IOException { String name = file . getName ( ) ; String ext = name . substring ( name . lastIndexOf ( '.' ) + 1 ) . toLowerCase ( Locale . ENGLISH ) ; if ( ext . equals ( "bpm" ) ) { return BMP ; } else if ( ext . equals ( "fpx" ) ) { return FlashPix ; } else if ( ext . equals ( "gif" ) ) { return GIF ; } else if ( ext . equals ( "jpg" ) || ext . equals ( "jpeg" ) ) { return JPEG ; } else if ( ext . equals ( "png" ) ) { return PNG ; } else if ( ext . equals ( "pnm" ) ) { return PNM ; } else if ( ext . equals ( "tif" ) || ext . equals ( "tiff" ) ) { return TIFF ; } else if ( ext . equals ( "wbmp" ) ) { return WBMP ; } else { throw new IOException ( "Unsupported image format " + ext ) ; } }
@param file the container file
 @return the Format associated with this file name extension
 @throws IOException
@param file the container file @return the Format associated with this file name extension @throws IOException