This project has moved. For the latest updates, please go here.

exif

Feb 26, 2016 at 9:47 PM
Couple of questions about reading Exif data.
  • GetExifProfile() is on MagickImage. Does the image get decoded if all you do is get that property?
using (MagickImage im = new MagickImage(SourceStream)) 
{
    ExifProfile exifPro = im.GetExifProfile();
}
  • If it does decode the image, would it be possible to put a version of GetExifProfile() on MagickImageInfo so the image isn't decoded?
We're trying to avoid multiple decodes of an image as it goes through the pipeline. In this specific case, we want to know if the Exif orientation is something other than 0 without decoding the image yet. This would be a bool to tell us we need to call AutoOrient() later in the code when it's expected that a decode will happen. Thanks
Coordinator
Feb 26, 2016 at 10:35 PM
When you use the constructor the whole image will be decoded. You should use the Ping method if you don't want to decode the whole image. But I am not sure if the exif profile will be read. I might be able to modify the reader if the exif profile is not read when you ping the image. When you Ping the image and you want to access the pixels you will need to Read the image from the start of the stream. Can you let me know if that works for you?
Feb 26, 2016 at 10:44 PM
What is the proper way to use MagickImage.Ping()? I've tried to use it before but couldn't figure out the syntax. Thanks
Coordinator
Feb 26, 2016 at 11:12 PM
Like this:
using (MagickImage im = new MagickImage()) 
{
  im.Ping(SourceStream);
  ExifProfile exifPro = im.GetExifProfile();
}
Feb 26, 2016 at 11:22 PM
Ah, cool. That's easy enough. We'll try it out and see if the profile gets read or not. Thanks
Feb 27, 2016 at 3:30 PM
Ping appears to also read Exif so I think we're good. Thanks!