예제 #1
0
        /// <summary>
        /// Adds an EXIF property to an image.
        /// </summary>
        /// <param name="inputPath">file path of original image</param>
        /// <param name="outputPath">file path of modified image</param>
        /// <param name="property"></param>
        public static void AddExifData(string inputPath, string outputPath, ExifProperty property)
        {
            // minimally load image
            Image image;

            using (ExifReader.LoadImage(inputPath, out image))
            {
                using (image)
                {
                    ExifWriter.AddExifData(image, property);
                    image.Save(outputPath);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Remvoes EXIF properties from an image.
        /// </summary>
        /// <param name="inputPath">file path of original image</param>
        /// <param name="outputPath">file path of modified image</param>
        /// <param name="exifTags">tags to remove</param>
        public static void RemoveExifData(string inputPath, string outputPath, IEnumerable <ExifTag> exifTags)
        {
            // minimally load image
            Image image;

            using (ExifReader.LoadImage(inputPath, out image))
            {
                using (image)
                {
                    ExifWriter.RemoveExifData(image, exifTags);
                    image.Save(outputPath);
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Creates a ExifPropertyCollection from an image file path.
        /// Minimally loads image only enough to get PropertyItems.
        /// </summary>
        /// <param name="imagePath"></param>
        /// <param name="exifTags">collection of EXIF tags to include</param>
        /// <returns>Collection of ExifProperty items</returns>
        public static ExifPropertyCollection GetExifData(string imagePath, ICollection <ExifTag> exifTags)
        {
            PropertyItem[] propertyItems;

            // minimally load image
            Image image;

            using (ExifReader.LoadImage(imagePath, out image))
            {
                using (image)
                {
                    propertyItems = image.PropertyItems;
                }
            }

            return(new ExifPropertyCollection(propertyItems, exifTags));
        }
예제 #4
0
 /// <summary>
 /// Creates a ExifPropertyCollection from the PropertyItems of a Bitmap.
 /// </summary>
 /// <param name="image"></param>
 /// <param name="exifTags">filter of EXIF tags to include</param>
 /// <returns></returns>
 public static ExifPropertyCollection GetExifData(Image image, params ExifTag[] exifTags)
 {
     return(ExifReader.GetExifData(image, (ICollection <ExifTag>)exifTags));
 }