[Mono-dev] Reading Exif Data with System.Drawing or Gtk#
Patrick Kowalzick
patrick.kowalzick at web.de
Sun Sep 26 11:38:44 EDT 2010
Dear List,
I am reading exif-data from jpegs (mainly thumb and orientation) using
System.Drawing. Something like:
string orientation = null;
using (FileStream fs = new FileStream(path,FileMode.Open))
using (Image img = Image.FromStream(fs,true,false))
foreach (PropertyItem pi in img.PropertyItems)
if (pi.Id == 274)
{
orientation =
BitConverter.ToInt16(pi.Value,0).ToString();
break;
}
Important here is the third parameter from Image.FromStream
(validateImageData), which should supress loading the complete
image-file, if you access exif data only.
This works fine for MS.net, but mono (2.6 on Ubuntu) reads the complete
image. See as well:
http://tinyurl.com/39jymfs
"# Status: TODO
# Comment: useEmbeddedColorManagement and validateImageData aren't
supported."
As a result, there are massive performance differences between MS.net
and mono :(.
So I am looking for alternatives to just read exif data from images, if
possible without including third party libraries (maybe taglib# with
picture support). I am already using GTK#, so this would be the best
solution for me.
What I found so far:
-System.Windows.Media.Imaging.BitmapSource is not yet included in mono,
and will not in mono 2.8(?).
-Gdk.Pixbuf Solution, but just for reading orientation:
Gdk.Pixbuf icon = new Gdk.Pixbuf(path);
string orientation = icon.GetOption("orientation");
Same behaviour: needs to load image first, and I do not find any
information, which options I could retrieve via "GetOption".
Does anyone has a pointer for me, where to search for more information,
or how to read Exif Data using Gtk?
Kind regards,
Patrick
More information about the Mono-devel-list
mailing list