Beispiel #1
0
        /// <summary>
        /// Creates an instance of the <see cref="ImageWrapper"/>.
        /// </summary>
        /// <param name="wrappee">The <see cref="Image"/> wrappee.</param>
        /// <param name="metadataParser"></param>
        internal ImageWrapper(Image wrappee, IImageMetadataConverter metadataParser)
        {
            this.wrappee           = wrappee;
            this.metadataConverter = metadataParser;

            this.orientationProvider       = new Lazy <ImageOrientation>(() => this.metadataConverter.ToOrientation(this.GetMetadata(ImageMetadataType.Orientation)));
            this.dateTimeTakenProvider     = new Lazy <DateTime?>(() => this.metadataConverter.ToDateTime(this.GetMetadata(ImageMetadataType.DateTime)));
            this.dateTimeOriginalProvider  = new Lazy <DateTime?>(() => this.metadataConverter.ToDateTime(this.GetMetadata(ImageMetadataType.DateTimeOriginal)));
            this.dateTimeDigitizedProvider = new Lazy <DateTime?>(() => this.metadataConverter.ToDateTime(this.GetMetadata(ImageMetadataType.DateTimeDigitized)));

            this.mimeTypeProvider  = new Lazy <string>(() => this.metadataConverter.ToMimeType(this.wrappee.RawFormat.Guid));
            this.codecInfoProvider = new Lazy <ImageCodecInfo>(() => ImageCodecInfo.GetImageEncoders().Where(encoder => encoder.MimeType == this.MimeType).FirstOrDefault());
        }
Beispiel #2
0
 public ImageFactory(IImageMetadataConverter imageMetadataParser)
 {
     this.imageMetadataConverter = imageMetadataParser;
 }