Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Update rational value for exif tag

$
0
0
Hello
I need to update a rational value for exif tag and save the updated value to file.

I'm trying to use following code but it works incorrectly:
using (MagickImage image = new MagickImage(SampleFiles.FujiFilmFinePixS1ProJpg))
{
    ExifProfile profile = image.GetExifProfile();

    double exposureTimeValue = 1 / (double)1600;

    profile.SetValue(ExifTag.ExposureTime, exposureTimeValue);
    image.AddProfile(profile);

    image.Write(SampleFiles.OutputDirectory + "FujiFilmFinePixS1Pro.updatedExif.jpg");
}
I checked the value, which was saved in the exif profile and it is not equal to the value which I saved:
using (MagickImage image = new MagickImage(SampleFiles.FujiFilmFinePixS1ProJpg))
{
    ExifProfile profile = image.GetExifProfile();

    double exposureTimeValue = 1 / (double)1600;
    // 0.000625

    profile.SetValue(ExifTag.ExposureTime, exposureTimeValue);
    image.AddProfile(profile);

    double savedExposureTimeValue = (double)image.GetExifProfile().Values.First(item => item.Tag == ExifTag.ExposureTime).Value;
    // 0.00062578222778473093

    image.Write(SampleFiles.OutputDirectory + "FujiFilmFinePixS1Pro.updatedExif.jpg");
}
How can I update rational(signed rational) value in a exif profile?

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>