public void Select(SemWeb.StatementSink sink) { byte [] data = null; ImageDirectory props = Root.ReadDirectory(Tag.ImageProps); ImageDirectory camera = props.ReadDirectory(Tag.CameraObject); data = props.ReadEntry(Tag.TimeStamp); if (data != null) { MetadataStore.AddLiteral(sink, "xmp:CreateDate", new CaptureTime(data, little).ToString()); } data = props.ReadEntry(Tag.ImageSpec); if (data != null) { ImageSpec spec = new ImageSpec(data, little); MetadataStore.AddLiteral(sink, "tiff:Orientation", ((int)spec.Orientation).ToString()); MetadataStore.AddLiteral(sink, "tiff:ImageWidth", spec.ImageWidth.ToString()); MetadataStore.AddLiteral(sink, "tiff:ImageLength", spec.ImageHeight.ToString()); string comp = spec.ComponentBitDepth.ToString(); if (spec.IsColor) { MetadataStore.Add(sink, "tiff:BitsPerSample", "rdf:Seq", new string [] { comp, comp, comp }); } else { MetadataStore.Add(sink, "tiff:BitsPerSample", "rdf:Seq", new string [] { comp }); } if (!spec.HasSquarePixels) { MetadataStore.AddLiteral(sink, "tiff:XResolution", (1000000 * spec.PixelAspectRatio).ToString()); MetadataStore.AddLiteral(sink, "tiff:YResolution", (1000000 * (1 / spec.PixelAspectRatio)).ToString()); } } data = camera.ReadEntry(Tag.CanonRawMakeModel); if (data != null) { string make_model = System.Text.Encoding.ASCII.GetString(data, 0, data.Length - 1); string [] vals = make_model.Split(new char [] { '\0' }); MetadataStore.AddLiteral(sink, "tiff:Make", vals [0]); MetadataStore.AddLiteral(sink, "tiff:Model", vals [1]); } /* * // FIXME this doesn't appear to be ascii. * data = camera.ReadEntry (Tag.OwnerName); * if (data != null) { * string name = System.Text.Encoding.ASCII.GetString (data, 0, data.Length - 1); * MetadataStore.AddLiteral (sink, "dc:creator", "rdf:Seq", new SemWeb.Literal (name)); * } */ }
public override PixbufOrientation GetOrientation() { PixbufOrientation orientation = PixbufOrientation.TopLeft; ImageDirectory props = Root.ReadDirectory(Tag.ImageProps); byte [] data = props.ReadEntry(Tag.ImageSpec); if (data != null) { orientation = new ImageSpec(data, little).Orientation; } //else //System.Console.WriteLine ("NO ORIENTATION"); return(orientation); }
public override PixbufOrientation GetOrientation () { PixbufOrientation orientation = PixbufOrientation.TopLeft; ImageDirectory props = Root.ReadDirectory (Tag.ImageProps); byte [] data = props.ReadEntry (Tag.ImageSpec); if (data != null) orientation = new ImageSpec (data, little).Orientation; else System.Console.WriteLine ("NO ORIENTATION"); return orientation; }
public void Select (SemWeb.StatementSink sink) { byte [] data = null; ImageDirectory props = Root.ReadDirectory (Tag.ImageProps); ImageDirectory camera = props.ReadDirectory (Tag.CameraObject); data = props.ReadEntry (Tag.TimeStamp); if (data != null) MetadataStore.AddLiteral (sink, "xmp:CreateDate", new CaptureTime (data, little).ToString ()); data = props.ReadEntry (Tag.ImageSpec); if (data != null) { ImageSpec spec = new ImageSpec (data, little); MetadataStore.AddLiteral (sink, "tiff:Orientation", ((int)spec.Orientation).ToString ()); MetadataStore.AddLiteral (sink, "tiff:ImageWidth", spec.ImageWidth.ToString ()); MetadataStore.AddLiteral (sink, "tiff:ImageLength", spec.ImageHeight.ToString ()); string comp = spec.ComponentBitDepth.ToString (); if (spec.IsColor) { MetadataStore.Add (sink, "tiff:BitsPerSample", "rdf:Seq", new string [] { comp, comp, comp }); } else { MetadataStore.Add (sink, "tiff:BitsPerSample", "rdf:Seq", new string [] { comp }); } if (!spec.HasSquarePixels) { MetadataStore.AddLiteral (sink, "tiff:XResolution", (1000000 * spec.PixelAspectRatio).ToString ()); MetadataStore.AddLiteral (sink, "tiff:YResolution", (1000000 * (1 / spec.PixelAspectRatio)).ToString ()); } } data = camera.ReadEntry (Tag.CanonRawMakeModel); if (data != null) { string make_model = System.Text.Encoding.ASCII.GetString (data, 0, data.Length - 1); string [] vals = make_model.Split (new char [] {'\0'}); MetadataStore.AddLiteral (sink, "tiff:Make", vals [0]); MetadataStore.AddLiteral (sink, "tiff:Model", vals [1]); } /* // FIXME this doesn't appear to be ascii. data = camera.ReadEntry (Tag.OwnerName); if (data != null) { string name = System.Text.Encoding.ASCII.GetString (data, 0, data.Length - 1); MetadataStore.AddLiteral (sink, "dc:creator", "rdf:Seq", new SemWeb.Literal (name)); } */ }