Link

How to Detect Image Format Using Apache Tika

JDeli provides an Apache Tika plugin to detect image formats. The simple detect() method returns a MediaType which contains the image format as a MIME Type.

Note: you will need Apache Tika on your classpath to use this feature. You can download Tika here.

Example Usage

try {
    final ImageDetector detector = new ImageDetector();
    final MediaType mimeType = detector.detect(TikaInputStream.get(Paths.get("file.img")), null);
} catch (final IOException e) {
    e.printStackTrace();
}

Start Your Free Trial


Customer Downloads