JPG file - when removing just "Camera make", "Camera model" or "Camera Serial Number" clears or modifies numerous fields

Hi Sir/Madam,

We are using GroupDocs.Metadata library v18.6.

We use the codes to remove properties in JPG files.

format = new JpegFormat(filePath);
if (format == null)

{ return; }

JpegExifInfo exifInfo = (JpegExifInfo)((JpegFormat)format).ExifValues;
//exifInfo.Make = string.Empty;
//exifInfo.Model = string.Empty;
exifInfo.Artist = string.Empty;
((IExif)format).UpdateExifInfo(exifInfo);
format.Save(outPath);

When we try to remove one of the JPG properties(Author/Camera Serial Number/Camera Model/Camera Make), it will affect other JPG properties:
Case #1:

Selecting “Camera Make” only, affects the following fields:

Subject - replaced with data from Title field
Tags - data removed
Comments - data removed
Date Acquired - data removed
Resolution unit - data added
Color representation - data added
Camera maker - data removed
Camera Serial number - data removed

Case #2:

Selecting “Camera Model” only, affects the following fields:

Subject - replaced with data from Title field
Tags - data removed
Comments - data removed
Date Acquired - data removed
Resolution unit - data added
Color representation - data added
Camera model - data removed
Camera Serial number - data removed

Case #3:

Selecting “Camera Serial Number” only, affects the following fields:

Subject - replaced with data from Title field
Tags - data removed
Comments - data removed
Date Acquired - data removed
Resolution unit - data added
Color representation - data added
Camera Serial number - data removed

Case 4:

Selecting “Author” only, affects the following fields:

Subject - replaced with data from Title field
Tags - data removed
Comments - data removed
Authors - data removed
Date Acquired - data removed
Resolution unit - data added
Color representation - data added
Camera Serial number - data removed

Btw, we can’t get the UserComment of JPG file. We can only set it as empty.

FYI, for the affected Subject property, this may be fixed in another issue, but we didn’t upgrade to v18.8 and can’t try it. JPG file "Title" and "Subject" will be removed when removing other property You can have a try and verify if it’s fixed.

Here’s the test file we use:
comments.jpeg (60.0 KB)

@Glority_Developer,

Thanks for using GroupDocs.Metadata for .NET.

We investigated your issue at our end and have the following results.

For the following metadata properties:

  • Subject - replaced with data from Title field
  • Tags - data removed
  • Comments - data removed
  • Date Acquired - data removed
  • Camera maker - data removed
  • Camera Serial number - data removed

The issue was reproduced using GroupDocs.Metadata for .NET 18.6 and is fixed using GroupDocs.Metadata for .NET 18.8. Please note that using 18.6 you can get the correct values for the above-mentioned fields via API.
For the following metadata properties:

  • Color representation - data added
  • Resolution unit - data removed

The issue was reproduced and we have logged it in our internal Issue Tracking System as METADATANET-2458 for further investigation. We shall keep you notified in case of any updates.

The issue was reproduced and we have logged it in our internal Issue Tracking System as METADATANET-2459 for further investigation.

Yes, the mentioned issue is fixed in the latest version 18.8 of the API.

In case you would have any further questions, please feel free to let us know.

@Glority_Developer,

We further investigated your issues and have following updates for you.

Windows file property dialog cannot be used to check any values added by GroupDocs.Metadata as the displayed values in Details tab are not bound to particular metadata standards. To save metadata values to images, OS Windows uses custom EXIF tags which are not described in the official EXIF documentation. Therefore, we recommend you to please set and get the metadata properties using GroupDocs.Metadata API only. This behavior cannot be considered as a bug.
The ExifInfo class does not have separate properties to read or update such tags, but you still can access them using the ExifInfo.Tags collection. You can get the UserComment using following code snippet:

using (JpegFormat jpegFormat = new JpegFormat(@"D:\_Temp\t1\comments.jpeg"))
{
    // get EXIF data
    ExifInfo exifInfo = jpegFormat.GetExifInfo();
    if (exifInfo != null)
    {
        TiffTag[] allTags = exifInfo.Tags;

        foreach (TiffTag tag in allTags)
        {
            if (tag.TagId == 40092)
            {
                TiffByteTag byteTag = tag as TiffByteTag;
                Console.WriteLine("Tag: {0}, value: {1}", byteTag.DefinedTag, System.Text.Encoding.Unicode.GetString(byteTag.TagValue));
            }

        }
    }
}

Furthermore, you can also get some metadata properties added through file properties dialog box using the following code snippet:

using (JpegFormat jpegFormat = new JpegFormat(@"D:\_Temp\t1\comments.jpeg"))
{
    // get EXIF data
    ExifInfo exifInfo = jpegFormat.GetExifInfo();
    if (exifInfo != null)
    {
        TiffTag[] allTags = exifInfo.Tags;

        foreach (TiffTag tag in allTags)
        {
            switch (tag.TagType)
            {

                case TiffTagType.Byte:
                    TiffByteTag byteTag = tag as TiffByteTag;
                    Console.WriteLine("Tag: {0}, value: {1}", byteTag.DefinedTag, System.Text.Encoding.Unicode.GetString(byteTag.TagValue));
                    break;
                // you can also get other types of Tiff Tags such as TiffTagType.Undefined etc.
            }
        }
    }
}

GroupDocs.Metadata can add some tags to the EXIF metadata package during image saving and it is expected behavior of the API. These tags do not contain any personal information and can be considered only as technical metadata that can help readers to interpret the image. Moreover, any data stored in these tags can be extracted from the image itself. However, please clarify if it’s really important for you to prevent adding such tags?

In case you would have any further questions, please feel free to let us know.