コード例 #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));
        }