ReadMetadata([NotNull] Stream stream) { // TIFF processing requires random access, as directories can be scattered throughout the byte sequence. // Stream does not support seeking backwards, so we wrap it with IndexedCapturingReader, which // buffers data from the stream as we seek forward. var directories = new List<Directory>(); var handler = new ExifTiffHandler(directories, false); TiffReader.ProcessTiff(new IndexedCapturingReader(stream), handler); return directories; }
ReadMetadata([NotNull] string filePath) { var directories = new List<Directory>(); using (var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, FileOptions.RandomAccess)) { var handler = new ExifTiffHandler(directories, storeThumbnailBytes: false); TiffReader.ProcessTiff(new IndexedSeekingReader(stream), handler); } directories.Add(new FileMetadataReader().Read(filePath)); return directories; }
public DirectoryList Extract([NotNull] IndexedReader reader) { var directories = new List <Directory>(); var exifTiffHandler = new ExifTiffHandler(directories); try { // Read the TIFF-formatted Exif data TiffReader.ProcessTiff(reader, exifTiffHandler); } catch (Exception e) { exifTiffHandler.Error("Exception processing TIFF data: " + e.Message); } return(directories); }