-
-
Notifications
You must be signed in to change notification settings - Fork 887
Description
Prerequisites
- I have written a descriptive issue title
- I have verified that I am running the latest version of ImageSharp
- I have verified if the problem exist in both
DEBUG
andRELEASE
mode - I have searched open and closed issues to ensure it has not already been reported
ImageSharp version
3.0.1
Other ImageSharp packages and versions
None
Environment (Operating system, version and so on)
Windows 10
.NET Framework version
.NET 6
Description
I am using Visual Studio 2022 and .NET 6 to build an image metadata editor so I can edit multiple related image files at the same time.
I am able to load and edit both JPEG and TIFF metadata tags just fine on the ExifProfile sections of each format, and IptcProfile changes appear to be working prior to saving to disk.
However, upon saving back to the original file, the existing IccProfile and IptcProfile structures are being set to NULL in the image, resulting in a loss of information. ExifProfile and XmpProfile appear to be fine after the save, but I haven't inspected the XmpProfile closely to be sure.
This is also reducing the TIFF file size from 77 MB to 15 MB.
I was expecting the save to retain the IccProfile as is, and for the IptcProfile to be updated with my changes.
The following screenshots illustrate the issue.
TIFF Profiles before Editing ExifProfile and IptcProfile
TIFF Profiles after Editing but Before File Save
TIFF Profiles after Saving to Disk
File Size Pre-Edit
File Size After Save
Steps to Reproduce
- Using ImageSharp's Image class, open a TIFF image file that has the IccProfile and IptcProfile properties of the RootFrame filled in at Image.Frames.RootFrame.Metadata
- Edit the ExifProfile and IptcProfile sections of Image.Frames.RootFrame.Metadata to update metadata tags
- Save the TIFF image to the hard drive
- Open the saved TIFF image and check the IccProfile and IptcProfile properties of Image.Frames.RootFrame.Metadata
Images
The attached file is a smaller TIFF that only has the ExifProfile, IccProfile, and XmpProfile sections populated. In this scenario, my code creates and then populates the IptcProfile prior to saving.
But after the save, the file size reduces from 10 MB to 2 MB, and IccProfile and IptcProfile are both null.
Sunspot Region 3354 Colorized 2023-07-02 13-55.zip