import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Test { public static void main(String[] args) throws IOException { Path source = Paths.get("c:/temp/0multipage.tif"); System.out.println(Files.probeContentType(source)); // output : image/tiff } } The default implementation is OS-specific and not very complete. It's possible