public static String getImageFileFormat ( File imageFile ) { String imageFileName = imageFile . getName ( ) ; String imageFormat = imageFileName . substring ( imageFileName . lastIndexOf ( ' ' ) + 1 ) ; if ( imageFormat . matches ( "(pbm|pgm|ppm)" ) ) { imageFormat = "pnm" ; } else if ( imageFormat . matches ( "(jp2|j2k|jpf|jpx|jpm)" ) ) { imageFormat = "jpeg2000" ; } return imageFormat ; }
Gets image file format .