Editing EXIF ​​data about the time photos were taken in the EXIF ​​Date Changer program. Metadata in Digital Photography View photo metadata

Those who are involved in photography are probably aware of the Exif data stored in each graphic file. As a rule, they contain information about the date the photograph was taken, the device with which the photograph was taken, and much other information. It often happens that it is the Exif data of a graphic file that allows you to find out more information about its creator. Today we will look at a small free utility, which allows you not only to view and edit Exif data and EXIF ​​GPS, but also to export and import them into XML files.

Surely the number of editable Exif data tags in Exif Farm Free will not be enough for many users. In this case, the developers have provided the ability to export Exif data that is not edited directly in the program to a CSV or XML file. To do this, as was described at the beginning of the article, open the menu for the file in Explorer and select the item Export Exif/Iptc Info. The file will be saved in the same folder where the image is stored.

Then we edit the XML file with the Exif data of the photo in any text editor or specialized utilities. After which all that remains is to erase the Exif data in the graphic file ( Clear Exif/Iptc/Xmp Info) and import them from an edited CSV or XML file ( Import Exif/Iptc Info).

Characteristics:
Interface language: English
OS: Windows XP, Vista, 7
File size: 5.3 MB
License: free, yes paid version for batch processing of files

You can also encrypt a huge amount of hidden data inside a photograph. The standard that encrypts these so-called metadata, got the name EXIF (Exchangeable Image File Format).

Of course, we are not talking about hidden messages and secret correspondence, although this can be arranged... First of all, the EXIF ​​standard is used for save and view various characteristics of the photograph, its parameters, indicators, information about the authorship and subject of photography, as well as much more information. That is, metadata is needed only from the point of view of the information component, which means you can do without it.

Many programs use the ability to save and view photo metadata. If you use Windows OS, then most likely you have already encountered EXIF ​​data. Right-click on any photo, in the menu that appears, select the item at the very bottom "Properties".

Further, even though everyone different version Windows, but the meaning is the same: find and click on the button/tab "Details". A table will open where information will be displayed, divided into conditional categories: “Description”, “Source”, “Image”, “Camera”, “Enhanced photo”, “File”. The information that is displayed in this entire table is nothing more than EXIF ​​data.

Lower the right properties slider and see how many different metadata a photo can have. I’m sure in your example most of the lines will be empty, since you need to fill them out yourself. But the “Camera” category may be filled - it is automatically filled in by a camera or smartphone.

This is not an exhaustive list of possible metadata. Just Windows developers We felt that such a table would be enough to cover the basic informational aspects of photography. In fact, there may be much more such data! Moreover, this entire volume can be divided into two groups: basic and additional.

The main parameters include those groups of data that will be read in any program and device that can look into the bins of a photograph. Such data should include: file information, description, copyright, image information, camera information and photo conditions. This means that no matter what program you use, it will always show you at least this information.

Additional parameters include data that only individual programs will work with. For example, Photoshop can create a tab "Story" and keep a photo editing protocol in it. Save the photo, open it again after a while, even on another computer, but always through Photoshop, and you can always see what metadata is saved in the “History” tab. But if you try to look into EXIF ​​using, for example, Gimp, you will no longer find this tab.

Many serious programs use this. For example, using EXIF data builds a system for filtering and sorting photos, adding keywords, creating rubrics and logical generalizations. This makes it easy to find required images among tens of thousands.

EXIF data can be changeable and immutable.

Changeable, in turn, can be divided into two more subspecies:

human editable, for example, you can indicate the author of the photo yourself, and later delete it and write a new name;

editable by program, for example, when you save a photo in Photoshop, the program itself adds a tag that the photo was changed in Photoshop version such and such. You won’t be able to register or delete this tag yourself (unless using special software, but that’s another story), but if you resave the photo in Photoshop another version, then the tag will be changed again in part of the version, for example it was CS5, but became CS6.

Immutable data is recorded by programs and devices without your will and permanently remains with this photo, for example, image resolution, file format, creation date, camera data.

Why and how to use EXIF ​​data?

  • First of all, this is a very convenient recording of information about a photo; well, you can’t keep a note in a notepad at what shutter speed you took this or that photo! Everything is conveniently recorded in a file, when you need it, open it, look at it, remember it.
  • This is proof of your authorship of the photo if you enter all the necessary information about yourself.
  • Regarding the notepad, I'm not far from the truth. You can also open the desired photo and enter the information you need there. It will be stored there securely and will not go anywhere. But I remind you that you will have to view it through the same program.
  • Did you like/dislike the quality of the photo taken? — Analyze the data in the “Camera” category. There you will find out under what conditions and camera settings this photo was taken. If you admired it/found a mistake, you gained invaluable experience.
  • Professional image browsers, for example, sort and filter large masses of photos based on EXIF ​​metadata.
  • Send a love message to the little man, or encrypt secret data and take/send it out of the country =))

Thirdly, the Internet is full of online services for working with EXIF ​​metadata. Their advantage is that you don’t have to install anything on your computer. I did this operation once and forgot.

Of the minuses, I will note the speed of operation - it directly depends on the capabilities of your Internet tariff.

An example of a website for removing EXIF ​​online is IMGonline.com.ua.

If you notice an error in the text, select it and press Ctrl + Enter. Thank you!

In general, images may have metadata various formats, however, I will talk using JPEG as an example, because... I worked with him. I think for other formats the difference will be small.

Metadata types

First, let's figure out what types of metadata can be in an image. Everyone most likely already knows this, but just in case I’ll tell you:

  • EXIF (Exchangeable Image File Format) is a standard for storing metadata in an image that is used digital cameras to save information about shutter speed, aperture and other shooting parameters. EXIF metadata can be stored in files JPEG formats, TIFF and RIFF WAV. According to the standard, only a description (Description tag) and a comment (User Comment tag) can be stored in EXIF ​​from user descriptive metadata, but Windows Explorer also uses several additional tags (XPTitle, XPSubject, XPAuthor, XPComment, XPKeywords). Windows Explorer ignores the XPTitle tag when there is a standard Description tag.
  • IPTC (International Press Telecommunications Council) is rather the name of the organization that developed the standard. The metadata standard itself is called IIM (Information Interchange Model). The oldest of the described standards. The original version of the standard stored metadata in such a way that software that did not know about the existence of IPTC could not work with image files that contained such metadata. However, Adobe later extended the standard by moving the metadata to the APP13 block of the JPEG file, allowing software unaware of the standard to successfully read the JPEG file while ignoring unknown metadata. IPTC metadata can store descriptive fields such as ObjectName (title), Keywords (keywords), Caption (description, there are several variations of the tag).
  • XMP (eXtensible Metadata Platform) is a standard developed by Adobe. Metadata is stored in an RDF model represented in XML format, allowing any necessary information to be included in the image file. This is the format that WIC (Windows Imaging Component) prefers to use in Windows Vista/7.

Understanding Metadata in WPF

To work with metadata in WPF, the BitmapEncoder, BitmapDecoder, BitmapSource, BitmapFrame, BitmapMetadata, and InPlaceMetadataWriter classes are used.
The BitmapEncoder and BitmapDecoder classes have descendants that allow you to work with specific image formats. In my case - JpegBitmapEncoder and JpegBitmapDecoder.
The InPlaceMetadataWriter class is used to change metadata in place, without re-encoding the file.
Data can be read and written in two ways - either using the GetQuery/SetQuery functions, which operate on the hierarchical names of metadata tags, or using the fields of the BitmapMetadata class, which allow easy access to metadata.
When accessing metadata through fields of the BitmapMetadata class, WIC tries to find corresponding fields in the metadata different standards in the following order: first XMP, then IPTC and EXIF. When writing tags through BitmapMetadata class fields, WIC writes them in XMP format.

Reading metadata

Here ready-made example functions that can be used to read metadata from a file:

  1. FileStream f = File .Open("test.jpg" , FileMode.Open);
  2. BitmapDecoder decoder = JpegBitmapDecoder.Create(f, BitmapCreateOptions.IgnoreColorProfile, BitmapCacheOption.Default);
  3. BitmapMetadata metadata = (BitmapMetadata)decoder.Frames[ 0 ].Metadata;
  4. // Get the title via the class field
  5. string title = metadata.Title;
  6. // Get header from XMP
  7. string xmptitle = (string )metadata.GetQuery(@"/xmp/ dc:title" );
  8. // Get title from EXIF
  9. string exiftitle = (string )metadata.GetQuery(@"/app1/ifd/(ushort=40091)" );
  10. // Get header from IPTC
  11. string iptctitle = (string )metadata.GetQuery();

Everything here is quite simple and transparent, so let’s get straight to the recording.

Recording metadata

  1. BitmapMetadata md = new BitmapMetadata("jpg");
  2. md.SetQuery(@"/xmp/ dc:title" , xmptitle);
  3. md.SetQuery(@"/app1/ifd/(ushort=40091)" , exiftitle);
  4. md.SetQuery( @"/app13/irb/8bimiptc/iptc/object name", iptctitle);
  5. BitmapFrame frame = BitmapFrame.Create(decoder.Frames[ 0 ], decoder.Frames[ 0 ].Thumbnail, md, decoder.Frames[ 0 ].ColorContexts);
  6. BitmapEncoder encoder = new JpegBitmapEncoder();
  7. encoder.Frames.Add(frame);
  8. FileStream of = File .Open("test2.jpg" , FileMode.Create, FileAccess.Write);
  9. encoder.Save(of);
  10. of.Close();

The code goes as a continuation of the fragment that reads the metadata. We create a copy of the original file by writing the title in all three metadata formats into its metadata.

In-Place Metadata Editing

Until now, I’ve been telling you, in general, fairly well-documented and simple things, but here everything is more complicated. The example in the official documentation (MSDN) is incorrect and generally opposite in meaning to the real state of affairs.
To edit metadata in place, you need to create an object of the InPlaceBitmapMetadataWriter class:

After that, you can work with it as with regular BitmapMetadata, calling SetQuery to set the necessary metadata.
To save changes, you need to call the TrySave() method, which attempts to save the changes to the original stream. The recording attempt may or may not be successful. If the attempt is successful, the method returns true, if there is an error, false.
The most common mistake that can prevent changes from being recorded is that there is not enough free space in the metadata. As a rule, all freshly taken photos do not contain enough space in the metadata, so in order to start using in-place metadata editing, you should make a copy of the file once, adding special padding fields to the metadata in it, leaving free space for subsequent changes. To do this, the file is opened, the desired frame and its metadata are cloned, and several queries are executed:

After this, it is enough to encode the frame with an encoder and write it to the desired stream, as a result of which free space will appear in the image for editing metadata on the spot later.
A padding value of 2048 bytes is usually sufficient. If you need more, you can specify a higher value.

Query strings

I think everyone, when studying the SetQuery/GetQuery methods, has a reasonable question - where to get all these query strings that cannot be called simple and intuitive?
After extensive searching on MSDN, I found a corresponding list. There are probably all the necessary queries here. The missing ones can, in principle, be compiled by analogy; there are plenty of examples :)

Subtleties and pitfalls

  • Versions of WIC in Windows XP and Windows Vista may fail if the thread calling the JpegBitmapEncoder.Save() function does not have the STAThread attribute specified (by default, all threads created in the application receive the MTAThread attribute unless otherwise specified).
  • The Windows 7 version of WIC stores EXIF ​​UserComment tag values ​​in Unicode by default, while Windows XP and Windows Vista store them in the current system language encoding (CP1251 for Russian). The format for recording UTF-8 parameters is as follows: the tag value itself is stored not as a string, but as a byte array. The first 7 bytes are the ASCII string "UNICODE", after which the Unicode-encoded sequence of tag characters begins.
  • The BitmapCacheOptions parameter should be used carefully. The OnLoad value caches all image data in uncompressed form in RAM, so if you open about 20 large-format JPEGs with this option, the free memory will be eaten up very quickly. This memory not released when deleting the image classes themselves (BitmapFrame, BitmapDecoder, etc.) and processing them by the garbage collector. Additionally, to use InPlaceBitmapMetadataWriter, you must open the image with BitmapCacheOptions = OnDemand or Default.
  • In the example, I open the image with the IgnoreColorProfile flag, because... without it, BitmapDecoder throws an exception on some images.

Conclusion

In general, working with metadata using WPF seemed quite complex and confusing to me. Almost all of the described pitfalls cost me several hours of debugging and googling, there is no information about this anywhere, and the symptoms are sometimes very strange. The official documentation (MSDN) covers this issue poorly, and in some places it is completely incorrect.
I hope that this collected information will help those who need to work with metadata through WPF, and save them several hours of time :)

P.S. I will be glad to see comments in the comments (if I made a mistake somewhere) and descriptions of pitfalls that I have not encountered or forgot to mention.

P.P.S. Is it worth continuing to write about WPF, or am I writing things that have long been known?

ShowExif is a small utility for viewing metadata digital images, obtained using professional cameras.

Usage

Given software It is unlikely to be useful to you in everyday work with the camera. However, sometimes it can be no less useful than popular graphic editor and image converters that you use almost every day. The need to view metadata, access to which the utility provides, may arise for various reasons. However, the most popular of them is to get acquainted with the “mileage” of the camera.

Possibilities

ShowExif does not require installation as it is portable. After downloading, you can launch it and immediately start using it. To view the number displayed in the counter that records when the shutter is closed, first take a photo from your camera and download it to your computer.

To do this, you should use a RAW format image. After taking a photo, open it using the utility in your browser. After this, all the necessary information will be displayed on the screen. The "Total Number of Shutter Releases" item displayed on the left side of the table is what you need. Look at the number in the line opposite it - this is the mileage of your camera. All metadata can be copied, deleted and saved to disk. Additionally, you can “attach” first photos to them.

Key Features

  • displays EXIF ​​left by photographic equipment from the most popular manufacturers;
  • allows you to copy, delete and save metadata to disk and clipboard;
  • To view the camera's mileage, you need a photo in RAW format;
  • fully translated into Russian;
  • does not require additional installation into the system, can be stored on a removable storage device;
  • available completely free of charge;
  • performs quick export of Thumbnails to disk;
  • allows you to view mileage not for all cameras, but only for those that have this counter;
  • works on all versions operating system Windows.

EXIF data does contain a large amount of information about a photo, but when it comes to posting photos on the Internet, which almost everyone does in this day and age, the question arises in two ways: whether to leave or delete this data.

EXIF is useful because it contains confirmation that the photo was taken from your camera, which can help, for example. EXIF is also useful simply when studying photographs of masters, when you are interested in how the aperture, shutter speed and other shooting parameters were set. Here's how, for example, on the site 500px.com:

However, EXIF ​​may contain, if not confidential, then at least information that is undesirable for display to the entire Internet. In this case, it becomes necessary to delete this data, although this does not exclude cases of deleting EXIF ​​in order to simply hide whose picture it is and use it as your own. In general, this is a rather complex question, and it’s up to you to decide whether to delete or leave EXIF ​​data, but my goal is to show how :)

Let's start with the fact that there is an excellent service StolenCameraFinder.com, which, if you lose your camera, will prompt you serial number, even if you didn’t record it, and will automatically find photos from your camera - you just need to drop one of the past pictures taken with your camera into the window of this site. True, the test with my photos gave only 4 results 🙁 although there are a hundred times more of my photos on the Internet.

GadgetTrack.com, which became even more popular because it helped , actually returned many more results for my photos—in total, they indexed more than 10.4 million serial numbers, according to the site. However, this service does not automatically detect the serial number: for this you will have to look into EXIF one of your photographs yourself, according to one of the methods shown in the article about.

What to do if you still don’t want to disclose the details of the photo?

Again, there are several ways here.

1. The easiest way edit EXIF was described in the previous lesson - just right-click on the file and go to the Properties menu item, go to the Details tab and click on the Remove Properties and Personal Information link. In the window that opens, you choose which data to delete, which to leave, and whether to leave at all.

2. The following method is convenient when processing a photo and saving it for later publication on the Internet. In Photoshop there is special function for this File -> Save for Web& Devices or just type t+Shit+Ctrl+S. Here you need to select the file format, in particular, jpg and in the metadata field indicate how you want edit exif data - what to leave and what to remove, or in general remove all exifs data.