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

New Post: AddProfile causes NullReferenceException

$
0
0
More info:
I am using Magick.NET-Q16-AnyCPU version 7.0.1.101 installed through nuget.

It seems that the error is that the ExifProfile sometimes have no Values attached, I have noticed this by parsing the same file several times:
            int exifRetries = 0;
            ExifProfile exif = new ExifProfile(path);

            while(exif != null && exif.Values.Count() == 0 && exifRetries < 5)
            {
                exif = new ExifProfile(path);
                exifRetries++;
            }
And when Values are empty AddProfile fails.
I am still wondering why the Values are parsed some of the times and other times it isn't even though I am using the same file?
Furthermore it still bothers me that image.GetExifProfile() returns null when new ExifProfile(path) doesn't?

EDIT:
I have alterede my AddProfile according to the finds:
                    if (exif != null && exif.Values.Count() > 0)
                    {
                        image.AddProfile(exif);
                    }

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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