How to extract data from BMP image using metada-extractor

1.2k Views Asked by At

I am trying to extract metadata from a BMP image format using metadata-extractor, but it throws an exception that file type is not supported.

Metadata-extractor:https://github.com/drewnoakes/metadata-extractor.git

My code:

public class MetaDataExtractor {

private Metadata metadata = null;

public Metadata extractMetadata() {
try {
        File file = new File("w3c_home.bmp");

        metadata = ImageMetadataReader.readMetadata(file);
    } catch (ImageProcessingException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return metadata;
}

It returns this exception on the console: com.drew.imaging.ImageProcessingException: File format is not supported at com.drew.imaging.ImageMetadataReader.readMetadata(ImageMetadataReader.java:128) at com.drew.imaging.ImageMetadataReader.readMetadata(ImageMetadataReader.java:95) at MetaDataExtractor.extractMetadata(MetaDataExtractor.java:16) at Test.main(Test.java:12)

0

There are 0 best solutions below