Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you place EXIF tags into a JPG, having the raw jpeg buffer in C++?

Tags:

c++

jpeg

exif

I am having a bit of a problem.

I get a RAW char* buffer from a camera and I need to add this tags before I can save it to disk. Writing the file to disk and reading it back again is not an option, as this will happen thousands of times.

The buffer data I receive from the camera does not contain any EXIF information, apart from the Width, Height and Pixels per Inch.

Any ideas? (C++)

like image 203
Hannes Avatar asked Sep 18 '08 07:09

Hannes


People also ask

Do JPG files have EXIF data?

Unfortunately, though, the only web-friendly (in terms of size) file format that can handle EXIF is JPEG, which means that you often cannot read the data from other image formats such as GIF and PNG.

Can Metadata be stored in JPEG?

The use of embedded IPTC tags in image file formats became widespread with the use of the Adobe Photoshop tool for image editing. IPTC metadata can be stored in TIFF and JPEG format images. interMedia supports the extraction of IPTC metadata from TIFF and JPEG file formats.

What is the maximum space that EXIF data can take up in a JPEG image?

Exif metadata are restricted in size to 64 kB in JPEG images because according to the specification this information must be contained within a single JPEG APP1 segment.

How do you write an EXIF?

To write Exif data to a JPEG, you need to write an APP1/Exif segment as part of the normal JIF structure. The EXIFWriter will write the data you should put inside this segment only. Everything else must be provided by you.


2 Answers

Look at this PDF, on page 20 you have a diagram showing you were to place or modify your exif information. What is the difference with a file on disk ?

Does the JPEG buffer of your camera contain an EXIF section already ?

like image 136
shodanex Avatar answered Sep 28 '22 10:09

shodanex


What's the difference? Why would doing it to a file on the disk be any different from doing it in memory?

Just do whatever it is you do after you read the file from the disk..

like image 24
shoosh Avatar answered Sep 28 '22 10:09

shoosh