Retrieving EXIF info and video informations from pictures/movies - java

is there a Java framework that will do the dirty work explained in title for me?
Mainly I just need to retrieve images properties stored inside JPEGs:
size
EXIF
geolocations
shot properties
and to retrieve movie files informations like:
codec name
duration
resolution
and so on
I don't need to be able to show the picture or play the movie, just to get the properties without having to write my own file header parsers..
while for images I mainly need JPEG support for movies it would be nice to be able to open as many formats as possible (avi, mkv, mp4, mpeg, mov, etc)
Thanks in advance!

Found this http://www.drewnoakes.com/code/exif/ to extract EXIF from JPEG.

Related

Android: Remove all metadata from video

Is there any native/existing/manual way to remove all the metadata of a video file in Android/Java/Kotlin from a (content) URI?
For photos, we can still use ExifInterface and remove the metadata we want by using setAttribute and passing null to delete the given/desired values, however this doesn't work for videos because an mp4 video has it's own metadata format. If there is no native Android class that can do this, is there any algorithm or reference that can be referred in order to implement this?
You can use mp4parser library. Typical tasks for the MP4 Parser are:
Muxing audio/video into an MP4 file
Append recordings that use the same encode settings
Adding/Changing metadata
Shorten recordings by omitting frames
The MetaDataInsert example shows how to write metadata.

Reading jpeg or gif metadata with javax.imageio

I want to modify the metadata of some types of images (png, jpeg or gif) and I found a a code that works very well for PNG images on this topic, provided by haraldK. When I try to run it on a jpg image though, it throws this error :
javax.imageio.IIOException: JFIF APP0 must be first marker after SOI. The error is thrown when arriving on the line IIOImage image = reader.readAll(0, null);
What can I do to get this working ?
Thanks in advance for your answer.
The problem you face is the JPEG standard did not define a file format. Several file formats appeared. E.g. JFIF. EXIF. SPIFF. These formats represent metadata in different ways. Apparently the library you are trying to use only supports the JFIF file format. Apparently your library only supports the JFIF format while you have a file in a different format (likely EXIF).
So you need a library that supports your file format or you need to modify the library you have to work with whatever file format you have. That could be a fairly substantial change.

Read information from a Google Slides link with android studio

Basically, assuming I have a link to a google slide (as provided by user), for example:
https://docs.google.com/presentation/d/1c3TbLKMVwOqgP70l0ph2jSvIHAaZnZoSMnvW8cxs8Ik/edit?usp=sharing
Ultimately, I want to answer the following:
Is there a way to get the slides into an array of some sort of image file?
Then, is there a way to get the speaker notes into an array of Strings?
Since we have the link (assuming it is set as "Public-anyone can view"), we theoretically have access to all these information, as we can access it in the Google Slides page. However, how do we extract it algorithmically? Is there a specific place where these information is stored in the Google server where I can just retrieve it?
You can download the whole presentation in various formats:
https://docs.google.com/presentation/d/<PRESENTATION_ID>/export/<FORMAT>
Possible formats are: pdf, pptx, odp, txt (strings only)
e.g.
https://docs.google.com/presentation/d/1c3TbLKMVwOqgP70l0ph2jSvIHAaZnZoSMnvW8cxs8Ik/export/pptx
To download slides as images, you have to specify a particular slide (page):
https://docs.google.com/presentation/d/<PRESENTATION_ID>/export/<FORMAT>?pageid=<PAGE_ID>
Possible formats are: jpeg, svg, png
e.g.
https://docs.google.com/presentation/d/1c3TbLKMVwOqgP70l0ph2jSvIHAaZnZoSMnvW8cxs8Ik/export/jpeg?pageid=g1f5653c4cc_0_437
You can find the page id at the end of a URL (http://docs.google...slide=id.<PAGE_ID>).

How to confirm that image was taken with specific device?

I want to write function in my android application that will confirm that picture was
taken by specific mobile device.
Today I can tell, if the picture was taken by specific model. (like galaxy s3).
But,I want more than that.
I would like to get from image EXIF unique id and compare it to the device unique id.
Thanks for help.
Maybe instead of using a long code. You can use a pre-ready Library for that.
Metadata metadata = ImageMetadataReader.readMetadata(imageFile);
This is the example code used by the Library, https://drewnoakes.com/code/exif/
It would give you the MetaData for the image. Which is also the content you want, Like the GeoLocation, CellularInformation, Resolution, Focus and all other data attached to the image.
A qoutation from the link
It understands several formats of metadata, all of which may be present in a single image: In addition it can decode values that are specific to particular camera manufacturers and models.
Then you can check for the details on that image and show or hide or what so ever you want to do with that image.
You can get the code from Google Code too: https://code.google.com/p/metadata-extractor/
Good luck!

Creating a jpeg file with metadata

I have a Java application that creates a BufferedImage and saves it to disk as a JPEG. I'd really like to add a caption to the image. To prevent the image from getting crowded out by text on the image itself, it'd be great if I could write the caption to the JPEG's metadata.
I've been searching all over the place for a solution, but haven't found anything satisfactory. Sanselan comes up a lot, but I haven't figured out how to use it properly. I found examples that modify existing metadata, but my files don't contain metadata as they are simply created from ImageIO.write() or Sanselan.writeImage().
I found another post that does what I'm looking for, but it's in C# and I need Java.
Any help would be greatly appreciated.
the package you want to look at is javax.imageio.metadata
The IIOMetaData class (which has a concrete subclass for JPEG) contains methods to get metadata information in various formats, including as an XML DOM tree root node.

Categories