Exemple #1
0
		internal static void AddTiffDirectoryProperties (FilterTiff filter, ImageDirectory directory)
		{
			foreach (DirectoryEntry e in directory.Entries) {
				switch (e.Id) {
				case TagId.ImageDescription:
					filter.AddProperty (Beagle.Property.New ("exif:ImageDescription", e.ValueAsString [0]));
					break;
				case TagId.Model:
					filter.AddProperty (Beagle.Property.New ("exif:Model", e.ValueAsString [0]));
					break;
				case TagId.UserComment:
					filter.AddProperty (Beagle.Property.New ("exif:UserComment", e.ValueAsString [0]));
					break;
				case TagId.DateTimeOriginal:
					AddDateProperty (filter, "exif:DateTimeOriginal", e.ValueAsString [0]);
					break;
				case TagId.DateTimeDigitized:
					AddDateProperty (filter, "exif:DateTimeDigitized", e.ValueAsString [0]);
					break;
				case TagId.DateTime:
					AddDateProperty (filter, "exif:DateTime", e.ValueAsString [0]);
					break;
				case TagId.PixelXDimension:
					filter.Width = (int) e.ValueAsLong [0];
					//filter.AddProperty (Beagle.Property.NewUnsearched ("exif:PixelXDimension", e.ValueAsString [0]));
					break;
				case TagId.PixelYDimension:
					filter.Height = (int) e.ValueAsLong [0];
					//filter.AddProperty (Beagle.Property.NewUnsearched ("exif:PixelYDimension", e.ValueAsString [0]));
					break;
				case TagId.ImageWidth:
					uint wval = e.ValueAsLong [0];
					if (filter.Width < wval)
						filter.Width = (int) wval;
					break;
				case TagId.ImageLength:
					uint hval = e.ValueAsLong [0];
					if (filter.Height < hval)
						filter.Height = (int) hval;
					break;
				case TagId.ExposureTime:
					filter.AddProperty (Beagle.Property.NewUnsearched ("exif:ExposureTime", e.ValueAsString [0]));
					break;
				case TagId.ISOSpeedRatings:
					filter.AddProperty (Beagle.Property.NewUnsearched ("exif:ISOSpeedRatings", e.ValueAsString [0]));
					break;
				case TagId.FNumber:
					filter.AddProperty (Beagle.Property.NewUnsearched ("exif:FNumber", Math.Round ((e.RationalValue [0]).Value, 1)));
					break;
				case TagId.FocalLength:
					filter.AddProperty (Beagle.Property.NewUnsearched ("exif:FocalLength", e.ValueAsString [0]));
					break;
				case TagId.Flash:
					ushort flash_val = e.ShortValue [0];
					filter.AddProperty (Beagle.Property.NewBool ("exif:Flash", (flash_val & 0x1) == 0x1));
					break;
				case TagId.XMP:
					XmpFile xmp = new XmpFile (new System.IO.MemoryStream (e.RawData));
					filter.AddXmpProperties (xmp);
					break;
				}
			}
		}
Exemple #2
0
        internal static void AddTiffDirectoryProperties(FilterTiff filter, ImageDirectory directory)
        {
            foreach (DirectoryEntry e in directory.Entries)
            {
                switch (e.Id)
                {
                case TagId.ImageDescription:
                    filter.AddProperty(Beagle.Property.New("exif:ImageDescription", e.ValueAsString [0]));
                    break;

                case TagId.Model:
                    filter.AddProperty(Beagle.Property.New("exif:Model", e.ValueAsString [0]));
                    break;

                case TagId.UserComment:
                    filter.AddProperty(Beagle.Property.New("exif:UserComment", e.ValueAsString [0]));
                    break;

                case TagId.DateTimeOriginal:
                    AddDateProperty(filter, "exif:DateTimeOriginal", e.ValueAsString [0]);
                    break;

                case TagId.DateTimeDigitized:
                    AddDateProperty(filter, "exif:DateTimeDigitized", e.ValueAsString [0]);
                    break;

                case TagId.DateTime:
                    AddDateProperty(filter, "exif:DateTime", e.ValueAsString [0]);
                    break;

                case TagId.PixelXDimension:
                    filter.Width = (int)e.ValueAsLong [0];
                    //filter.AddProperty (Beagle.Property.NewUnsearched ("exif:PixelXDimension", e.ValueAsString [0]));
                    break;

                case TagId.PixelYDimension:
                    filter.Height = (int)e.ValueAsLong [0];
                    //filter.AddProperty (Beagle.Property.NewUnsearched ("exif:PixelYDimension", e.ValueAsString [0]));
                    break;

                case TagId.ImageWidth:
                    uint wval = e.ValueAsLong [0];
                    if (filter.Width < wval)
                    {
                        filter.Width = (int)wval;
                    }
                    break;

                case TagId.ImageLength:
                    uint hval = e.ValueAsLong [0];
                    if (filter.Height < hval)
                    {
                        filter.Height = (int)hval;
                    }
                    break;

                case TagId.ExposureTime:
                    filter.AddProperty(Beagle.Property.NewUnsearched("exif:ExposureTime", e.ValueAsString [0]));
                    break;

                case TagId.ISOSpeedRatings:
                    filter.AddProperty(Beagle.Property.NewUnsearched("exif:ISOSpeedRatings", e.ValueAsString [0]));
                    break;

                case TagId.FNumber:
                    filter.AddProperty(Beagle.Property.NewUnsearched("exif:FNumber", Math.Round((e.RationalValue [0]).Value, 1)));
                    break;

                case TagId.FocalLength:
                    filter.AddProperty(Beagle.Property.NewUnsearched("exif:FocalLength", e.ValueAsString [0]));
                    break;

                case TagId.Flash:
                    ushort flash_val = e.ShortValue [0];
                    filter.AddProperty(Beagle.Property.NewBool("exif:Flash", (flash_val & 0x1) == 0x1));
                    break;

                case TagId.XMP:
                    XmpFile xmp = new XmpFile(new System.IO.MemoryStream(e.RawData));
                    filter.AddXmpProperties(xmp);
                    break;
                }
            }
        }