예제 #1
0
 public static Com.Drew.Metadata.Metadata ReadMetadata([NotNull] InputStream inputStream)
 {
     // TIFF processing requires random access, as directories can be scattered throughout the byte sequence.
     // InputStream does not support seeking backwards, so we wrap it with RandomAccessStreamReader, which
     // buffers data from the stream as we seek forward.
     Com.Drew.Metadata.Metadata metadata = new Com.Drew.Metadata.Metadata();
     ExifTiffHandler handler = new ExifTiffHandler(metadata, false);
     new TiffReader().ProcessTiff(new RandomAccessStreamReader(inputStream), handler, 0);
     return metadata;
 }
예제 #2
0
 public static Com.Drew.Metadata.Metadata ReadMetadata([NotNull] FilePath file)
 {
     Com.Drew.Metadata.Metadata metadata = new Com.Drew.Metadata.Metadata();
     RandomAccessFile randomAccessFile = new RandomAccessFile(file, "r");
     try
     {
         ExifTiffHandler handler = new ExifTiffHandler(metadata, false);
         new TiffReader().ProcessTiff(new RandomAccessFileReader(randomAccessFile), handler, 0);
     }
     finally
     {
         randomAccessFile.Close();
     }
     new FileMetadataReader().Read(file, metadata);
     return metadata;
 }