Browse Source

Remove resolution value from profile before setting it if it does not have the correct data type. (Fixes #215)

af/merge-core
Dirk Lemstra 9 years ago
parent
commit
ce396ccef8
  1. 13
      src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs

13
src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs

@ -238,11 +238,18 @@ namespace ImageSharp
private void SyncResolution(ExifTag tag, double resolution)
{
ExifValue value = this.GetValue(tag);
if (value != null)
if (value == null)
{
Rational newResolution = new Rational(resolution, false);
this.SetValue(tag, newResolution);
return;
}
if (value.IsArray || value.DataType != ExifDataType.Rational)
{
this.RemoveValue(value.Tag);
}
Rational newResolution = new Rational(resolution, false);
this.SetValue(tag, newResolution);
}
private void InitializeValues()

Loading…
Cancel
Save