Reputation: 12859
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?
Upvotes: 4
Views: 1264
Reputation: 940
Why don't you give the Java7 BufferedImage a try?
It contains the convenient methods getHeight
, getWidth
and getType
.
More info here: BufferedImage
Upvotes: 0
Reputation: 311195
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.
Upvotes: 5