public Enumerator(string fileName, Stream stream, bool ownStream, int startingFrame, int frameCount) { try { this.fileName = fileName; this.stream = stream; this.ownStream = ownStream; this.tiff = Libtiff.ClientOpen(stream); this.frameCount = (int)this.tiff.NumberOfDirectories(); this.firstFrame = startingFrame; this.lastFrame = Math.Min(this.frameCount, startingFrame + (frameCount > 0 ? frameCount : this.frameCount)) - 1; this.currentFrame = this.firstFrame - 1; } catch (Exception e) { this.Dispose(); if (!string.IsNullOrEmpty(fileName)) { throw new FileLoadException( string.Format(CultureInfo.InvariantCulture, Properties.Resources.E_CannotLoadImage, fileName), e); } else { throw; } } }
/// <inheritdoc /> public override void Save(Stream stream, Image image, ImageMetadata metadata) { Libtiff.Save(stream, image, metadata, this.Compression); }