You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When performing EXIF operation on the image, image properties are getting changed. On carrying out pixel by pixel comparison there was around 50% pixels changed.
Steps to Reproduce
The code I'm using is as follows
XmpMetaFactory.SchemaRegistry.RegisterNamespace("http://www.pix4d.com", "Camera");
try
{
using (MagickImage image = new MagickImage(_imagePath))
{
#region Add EXIF metadata
IExifProfile exifProfile = image.GetExifProfile();
if (exifProfile == null)
{
exifProfile = new ExifProfile();
}
exifProfile.SetValue(ExifTag.GPSLatitudeRef, _latitude >= 0 ? "N" : "S"); // select between northern (N) / southern (S) hemisphere
var data = ConvertToRationalDMS(Math.Abs(_latitude));
exifProfile.SetValue(ExifTag.GPSLatitude, data);
data = ConvertToRationalDMS(Math.Abs(_longitude));
exifProfile.SetValue(ExifTag.GPSLongitudeRef, _longitude >= 0 ? "E" : "W"); // select between eastern (E) / western (W) hemisphere
exifProfile.SetValue(ExifTag.GPSLongitude, data);
exifProfile.SetValue(ExifTag.GPSAltitudeRef, _altitude >= 0 ? (byte)0 : (byte)1); // select between above (0) / below (1) sea-level
exifProfile.SetValue(ExifTag.GPSAltitude, new Rational(Math.Abs(_altitude)));
image.SetProfile(exifProfile);
#endregion
#region Add XMP metadata
IXmpProfile xmpProfile1 = image.GetXmpProfile();
Console.WriteLine();
IXmpMeta xmpData = XmpMetaFactory.Create();
xmpData.SetProperty("http://www.pix4d.com", "GPSXAccuracy", $"{_gpsXAccuracy:0.0000000000}");
xmpData.SetProperty("http://www.pix4d.com", "GPSYAccuracy", $"{_gpsYAccuracy:0.0000000000}");
xmpData.SetProperty("http://www.pix4d.com", "GPSZAccuracy", $"{_gpsZAccuracy:0.0000000000}");
xmpData.SetProperty("http://www.pix4d.com", "GPSXYAccuracy", $"{_gpsXYAccuracy:0.0000000000}");
xmpData.SetProperty("http://www.pix4d.com", "RINEXTimestamp", $"{_eventTime:yyyyMMdd_HHmmss.fff}");
string serializedData = XmpMetaFactory.SerializeToString(xmpData, new XmpCore.Options.SerializeOptions());
IXmpProfile xmpProfile = new XmpProfile(System.Text.Encoding.UTF8.GetBytes(serializedData));
image.SetProfile(xmpProfile);
#endregion
image.Interlace = Interlace.NoInterlace;
image.Quality = 100;
image.Settings.Compression = CompressionMethod.NoCompression;
var optimizer = new ImageOptimizer();
optimizer.LosslessCompress(_imagePath);
image.Write(_newImagePath);
}
}
catch (Exception exp)
{
}
}
Images
No response
The text was updated successfully, but these errors were encountered:
ImageMagick version
13.4.0
Operating system
Windows
Operating system, version and so on
Windows 11, Magick.NET.Core
Description
When performing EXIF operation on the image, image properties are getting changed. On carrying out pixel by pixel comparison there was around 50% pixels changed.
Steps to Reproduce
The code I'm using is as follows
Images
No response
The text was updated successfully, but these errors were encountered: