Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easy API for retrieving width and height when using metadata-extractor

I am using the excellent metadata-extractor library. It is very good for retrieving detailed metadata from many different image formats.

However, for a project i am only interested in extracting "common image metadata" (like width and height). In this use case the API is quiet verbose AFIAK.

I am looking for a convenience API like:

final MetadataWrapper md = MetadataWrapper.readMetadata(file);
FileType type = md.getFileType();
int width = md.getWidth();
int height = md.getHeight();

Any suggestions?

like image 663
rmuller Avatar asked Nov 08 '25 06:11

rmuller


1 Answers

If you know exactly what metadata you need, you're probably best off writing a small wrapper around metadata-extractor that checks for specific types of directory, and tests them for given tags.

The concept of 'width' can be specified in many different tags. metadata-extractor doesn't provide any abstraction over these, though there is an issue discussing the idea. It'll be tricky to implement robustly.

like image 83
Drew Noakes Avatar answered Nov 09 '25 22:11

Drew Noakes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!