Esempio n. 1
0
        public virtual void TestReadSpecificSegments()
        {
            JpegSegmentData segmentData = JpegSegmentReader.ReadSegments(new FilePath("Tests/Data/withExifAndIptc.jpg"), Arrays.AsList(JpegSegmentType.App0, JpegSegmentType.App2).AsIterable());

            Sharpen.Tests.AreEqual(1, segmentData.GetSegmentCount(JpegSegmentType.App0));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.App1));
            Sharpen.Tests.AreEqual(1, segmentData.GetSegmentCount(JpegSegmentType.App2));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.Appd));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.Appe));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.App3));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.App4));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.App5));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.App6));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.App7));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.App8));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.App9));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.Appa));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.Appb));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.Appc));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.Appf));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.Com));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.Dht));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.Sof0));
            NUnit.Framework.CollectionAssert.AreEqual(FileUtil.ReadBytes("Tests/Data/withExifAndIptc.jpg.app0"), segmentData.GetSegment(JpegSegmentType.App0));
            NUnit.Framework.CollectionAssert.AreEqual(FileUtil.ReadBytes("Tests/Data/withExifAndIptc.jpg.app2"), segmentData.GetSegment(JpegSegmentType.App2));
        }
 public virtual void TestAddAndGetSegment()
 {
     JpegSegmentData segmentData = new JpegSegmentData();
     sbyte segmentMarker = unchecked((sbyte)12);
     sbyte[] segmentBytes = new sbyte[] { 1, 2, 3 };
     segmentData.AddSegment(segmentMarker, segmentBytes);
     Sharpen.Tests.AreEqual(1, segmentData.GetSegmentCount(segmentMarker));
     NUnit.Framework.CollectionAssert.AreEqual(segmentBytes, segmentData.GetSegment(segmentMarker));
 }
 public virtual void TestContainsSegment()
 {
     JpegSegmentData segmentData = new JpegSegmentData();
     sbyte segmentMarker = unchecked((sbyte)12);
     sbyte[] segmentBytes = new sbyte[] { 1, 2, 3 };
     Sharpen.Tests.IsTrue(!segmentData.ContainsSegment(segmentMarker));
     segmentData.AddSegment(segmentMarker, segmentBytes);
     Sharpen.Tests.IsTrue(segmentData.ContainsSegment(segmentMarker));
 }
Esempio n. 4
0
        public virtual void TestContainsSegment()
        {
            JpegSegmentData segmentData   = new JpegSegmentData();
            sbyte           segmentMarker = unchecked ((sbyte)12);

            sbyte[] segmentBytes = new sbyte[] { 1, 2, 3 };
            Sharpen.Tests.IsTrue(!segmentData.ContainsSegment(segmentMarker));
            segmentData.AddSegment(segmentMarker, segmentBytes);
            Sharpen.Tests.IsTrue(segmentData.ContainsSegment(segmentMarker));
        }
Esempio n. 5
0
        public virtual void TestAddAndGetSegment()
        {
            JpegSegmentData segmentData   = new JpegSegmentData();
            sbyte           segmentMarker = unchecked ((sbyte)12);

            sbyte[] segmentBytes = new sbyte[] { 1, 2, 3 };
            segmentData.AddSegment(segmentMarker, segmentBytes);
            Sharpen.Tests.AreEqual(1, segmentData.GetSegmentCount(segmentMarker));
            NUnit.Framework.CollectionAssert.AreEqual(segmentBytes, segmentData.GetSegment(segmentMarker));
        }
		public virtual void TestSegmentWithMultipleOccurrences()
		{
			JpegSegmentData segmentData = new JpegSegmentData();
			sbyte segmentMarker = unchecked((sbyte)12);
			sbyte[] segmentBytes1 = new sbyte[] { 1, 2, 3 };
			sbyte[] segmentBytes2 = new sbyte[] { 3, 2, 1 };
			segmentData.AddSegment(segmentMarker, segmentBytes1);
			segmentData.AddSegment(segmentMarker, segmentBytes2);
			Sharpen.Tests.AreEqual(2, segmentData.GetSegmentCount(segmentMarker));
			NUnit.Framework.CollectionAssert.AreEqual(segmentBytes1, segmentData.GetSegment(segmentMarker));
			NUnit.Framework.CollectionAssert.AreEqual(segmentBytes1, segmentData.GetSegment(segmentMarker, 0));
			NUnit.Framework.CollectionAssert.AreEqual(segmentBytes2, segmentData.GetSegment(segmentMarker, 1));
		}
 public virtual void TestAddingMultipleSegments()
 {
     JpegSegmentData segmentData = new JpegSegmentData();
     sbyte segmentMarker1 = unchecked((sbyte)12);
     sbyte segmentMarker2 = unchecked((sbyte)21);
     sbyte[] segmentBytes1 = new sbyte[] { 1, 2, 3 };
     sbyte[] segmentBytes2 = new sbyte[] { 3, 2, 1 };
     segmentData.AddSegment(segmentMarker1, segmentBytes1);
     segmentData.AddSegment(segmentMarker2, segmentBytes2);
     Sharpen.Tests.AreEqual(1, segmentData.GetSegmentCount(segmentMarker1));
     Sharpen.Tests.AreEqual(1, segmentData.GetSegmentCount(segmentMarker2));
     NUnit.Framework.CollectionAssert.AreEqual(segmentBytes1, segmentData.GetSegment(segmentMarker1));
     NUnit.Framework.CollectionAssert.AreEqual(segmentBytes2, segmentData.GetSegment(segmentMarker2));
 }
Esempio n. 8
0
        public virtual void TestRemoveSegmentOccurrence()
        {
            JpegSegmentData segmentData   = new JpegSegmentData();
            sbyte           segmentMarker = unchecked ((sbyte)12);

            sbyte[] segmentBytes1 = new sbyte[] { 1, 2, 3 };
            sbyte[] segmentBytes2 = new sbyte[] { 3, 2, 1 };
            segmentData.AddSegment(segmentMarker, segmentBytes1);
            segmentData.AddSegment(segmentMarker, segmentBytes2);
            Sharpen.Tests.AreEqual(2, segmentData.GetSegmentCount(segmentMarker));
            NUnit.Framework.CollectionAssert.AreEqual(segmentBytes1, segmentData.GetSegment(segmentMarker, 0));
            segmentData.RemoveSegmentOccurrence(segmentMarker, 0);
            NUnit.Framework.CollectionAssert.AreEqual(segmentBytes2, segmentData.GetSegment(segmentMarker, 0));
        }
 public virtual void TestRemoveSegment()
 {
     JpegSegmentData segmentData = new JpegSegmentData();
     sbyte segmentMarker = unchecked((sbyte)12);
     sbyte[] segmentBytes1 = new sbyte[] { 1, 2, 3 };
     sbyte[] segmentBytes2 = new sbyte[] { 3, 2, 1 };
     segmentData.AddSegment(segmentMarker, segmentBytes1);
     segmentData.AddSegment(segmentMarker, segmentBytes2);
     Sharpen.Tests.AreEqual(2, segmentData.GetSegmentCount(segmentMarker));
     Sharpen.Tests.IsTrue(segmentData.ContainsSegment(segmentMarker));
     NUnit.Framework.CollectionAssert.AreEqual(segmentBytes1, segmentData.GetSegment(segmentMarker, 0));
     segmentData.RemoveSegment(segmentMarker);
     Sharpen.Tests.IsTrue(!segmentData.ContainsSegment(segmentMarker));
     Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(segmentMarker));
 }
Esempio n. 10
0
        public virtual void TestAddingMultipleSegments()
        {
            JpegSegmentData segmentData    = new JpegSegmentData();
            sbyte           segmentMarker1 = unchecked ((sbyte)12);
            sbyte           segmentMarker2 = unchecked ((sbyte)21);

            sbyte[] segmentBytes1 = new sbyte[] { 1, 2, 3 };
            sbyte[] segmentBytes2 = new sbyte[] { 3, 2, 1 };
            segmentData.AddSegment(segmentMarker1, segmentBytes1);
            segmentData.AddSegment(segmentMarker2, segmentBytes2);
            Sharpen.Tests.AreEqual(1, segmentData.GetSegmentCount(segmentMarker1));
            Sharpen.Tests.AreEqual(1, segmentData.GetSegmentCount(segmentMarker2));
            NUnit.Framework.CollectionAssert.AreEqual(segmentBytes1, segmentData.GetSegment(segmentMarker1));
            NUnit.Framework.CollectionAssert.AreEqual(segmentBytes2, segmentData.GetSegment(segmentMarker2));
        }
Esempio n. 11
0
        /// <exception cref="Com.Drew.Imaging.Jpeg.JpegProcessingException"/>
        /// <exception cref="System.IO.IOException"/>
        public static void Process([NotNull] Com.Drew.Metadata.Metadata metadata, [NotNull] InputStream inputStream, [CanBeNull] Iterable <JpegSegmentMetadataReader> readers)
        {
            if (readers == null)
            {
                readers = AllReaders;
            }
            ICollection <JpegSegmentType> segmentTypes = new HashSet <JpegSegmentType>();

            foreach (JpegSegmentMetadataReader reader in readers)
            {
                foreach (JpegSegmentType type in reader.GetSegmentTypes())
                {
                    segmentTypes.Add(type);
                }
            }
            JpegSegmentData segmentData = JpegSegmentReader.ReadSegments(new Com.Drew.Lang.StreamReader(inputStream), segmentTypes.AsIterable());

            ProcessJpegSegmentData(metadata, readers, segmentData);
        }
Esempio n. 12
0
        public virtual void TestReadAllSegments()
        {
            JpegSegmentData segmentData = JpegSegmentReader.ReadSegments(new FilePath("Tests/Data/withExifAndIptc.jpg"), null);

            Sharpen.Tests.AreEqual(1, segmentData.GetSegmentCount(JpegSegmentType.App0));
            NUnit.Framework.CollectionAssert.AreEqual(FileUtil.ReadBytes("Tests/Data/withExifAndIptc.jpg.app0"), segmentData.GetSegment(JpegSegmentType.App0));
            NUnit.Framework.Assert.IsNull(segmentData.GetSegment(JpegSegmentType.App0, 1));
            Sharpen.Tests.AreEqual(2, segmentData.GetSegmentCount(JpegSegmentType.App1));
            NUnit.Framework.CollectionAssert.AreEqual(FileUtil.ReadBytes("Tests/Data/withExifAndIptc.jpg.app1.0"), segmentData.GetSegment(JpegSegmentType.App1, 0));
            NUnit.Framework.CollectionAssert.AreEqual(FileUtil.ReadBytes("Tests/Data/withExifAndIptc.jpg.app1.1"), segmentData.GetSegment(JpegSegmentType.App1, 1));
            NUnit.Framework.Assert.IsNull(segmentData.GetSegment(JpegSegmentType.App1, 2));
            Sharpen.Tests.AreEqual(1, segmentData.GetSegmentCount(JpegSegmentType.App2));
            NUnit.Framework.CollectionAssert.AreEqual(FileUtil.ReadBytes("Tests/Data/withExifAndIptc.jpg.app2"), segmentData.GetSegment(JpegSegmentType.App2));
            NUnit.Framework.Assert.IsNull(segmentData.GetSegment(JpegSegmentType.App2, 1));
            Sharpen.Tests.AreEqual(1, segmentData.GetSegmentCount(JpegSegmentType.Appd));
            NUnit.Framework.CollectionAssert.AreEqual(FileUtil.ReadBytes("Tests/Data/withExifAndIptc.jpg.appd"), segmentData.GetSegment(JpegSegmentType.Appd));
            NUnit.Framework.Assert.IsNull(segmentData.GetSegment(JpegSegmentType.Appd, 1));
            Sharpen.Tests.AreEqual(1, segmentData.GetSegmentCount(JpegSegmentType.Appe));
            NUnit.Framework.CollectionAssert.AreEqual(FileUtil.ReadBytes("Tests/Data/withExifAndIptc.jpg.appe"), segmentData.GetSegment(JpegSegmentType.Appe));
            NUnit.Framework.Assert.IsNull(segmentData.GetSegment(JpegSegmentType.Appe, 1));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.App3));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.App4));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.App5));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.App6));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.App7));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.App8));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.App9));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.Appa));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.Appb));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.Appc));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.Appf));
            Sharpen.Tests.AreEqual(0, segmentData.GetSegmentCount(JpegSegmentType.Com));
            Sharpen.Tests.AreEqual(4, segmentData.GetSegmentCount(JpegSegmentType.Dht));
            Sharpen.Tests.AreEqual(2, segmentData.GetSegmentCount(JpegSegmentType.Dqt));
            Sharpen.Tests.AreEqual(1, segmentData.GetSegmentCount(JpegSegmentType.Sof0));
            NUnit.Framework.Assert.IsNull(segmentData.GetSegment(JpegSegmentType.App3, 0));
        }
		/// <exception cref="System.IO.IOException"/>
		public static void SaveSegmentFiles(string jpegFilePath, JpegSegmentData segmentData)
		{
			foreach (JpegSegmentType segmentType in segmentData.GetSegmentTypes())
			{
				IList<sbyte[]> segments = Iterables.ToList(segmentData.GetSegments(segmentType));
				if (segments.Count == 0)
				{
					continue;
				}
				if (segments.Count > 1)
				{
					for (int i = 0; i < segments.Count; i++)
					{
						string outputFilePath = Sharpen.Extensions.StringFormat("%s.%s.%d", jpegFilePath, segmentType.ToString().ToLower(), i);
						FileUtil.SaveBytes(new FilePath(outputFilePath), segments[i]);
					}
				}
				else
				{
					string outputFilePath = Sharpen.Extensions.StringFormat("%s.%s", jpegFilePath, segmentType.ToString().ToLower());
					FileUtil.SaveBytes(new FilePath(outputFilePath), segments[0]);
				}
			}
		}
Esempio n. 14
0
 public static void ProcessJpegSegmentData(Com.Drew.Metadata.Metadata metadata, Iterable <JpegSegmentMetadataReader> readers, JpegSegmentData segmentData)
 {
     // Pass the appropriate byte arrays to each reader.
     foreach (JpegSegmentMetadataReader reader in readers)
     {
         foreach (JpegSegmentType segmentType in reader.GetSegmentTypes())
         {
             reader.ReadJpegSegments(segmentData.GetSegments(segmentType), metadata, segmentType);
         }
     }
 }
        public static JpegSegmentData ReadSegments([NotNull] SequentialReader reader, [CanBeNull] Iterable <JpegSegmentType> segmentTypes)
        {
            // Must be big-endian
            System.Diagnostics.Debug.Assert((reader.IsMotorolaByteOrder()));
            // first two bytes should be JPEG magic number
            int magicNumber = reader.GetUInt16();

            if (magicNumber != unchecked ((int)(0xFFD8)))
            {
                throw new JpegProcessingException("JPEG data is expected to begin with 0xFFD8 (ÿØ) not 0x" + Sharpen.Extensions.ToHexString(magicNumber));
            }
            ICollection <sbyte> segmentTypeBytes = null;

            if (segmentTypes != null)
            {
                segmentTypeBytes = new HashSet <sbyte>();
                foreach (JpegSegmentType segmentType in segmentTypes)
                {
                    segmentTypeBytes.Add(segmentType.byteValue);
                }
            }
            JpegSegmentData segmentData = new JpegSegmentData();

            do
            {
                // Find the segment marker. Markers are zero or more 0xFF bytes, followed
                // by a 0xFF and then a byte not equal to 0x00 or 0xFF.
                short segmentIdentifier = reader.GetUInt8();
                // We must have at least one 0xFF byte
                if (segmentIdentifier != unchecked ((int)(0xFF)))
                {
                    throw new JpegProcessingException("Expected JPEG segment start identifier 0xFF, not 0x" + Sharpen.Extensions.ToHexString(segmentIdentifier).ToUpper());
                }
                // Read until we have a non-0xFF byte. This identifies the segment type.
                sbyte segmentType = reader.GetInt8();
                while (segmentType == unchecked ((sbyte)0xFF))
                {
                    segmentType = reader.GetInt8();
                }
                if (segmentType == 0)
                {
                    throw new JpegProcessingException("Expected non-zero byte as part of JPEG marker identifier");
                }
                if (segmentType == SegmentSos)
                {
                    // The 'Start-Of-Scan' segment's length doesn't include the image data, instead would
                    // have to search for the two bytes: 0xFF 0xD9 (EOI).
                    // It comes last so simply return at this point
                    return(segmentData);
                }
                if (segmentType == MarkerEoi)
                {
                    // the 'End-Of-Image' segment -- this should never be found in this fashion
                    return(segmentData);
                }
                // next 2-bytes are <segment-size>: [high-byte] [low-byte]
                int segmentLength = reader.GetUInt16();
                // segment length includes size bytes, so subtract two
                segmentLength -= 2;
                if (segmentLength < 0)
                {
                    throw new JpegProcessingException("JPEG segment size would be less than zero");
                }
                // Check whether we are interested in this segment
                if (segmentTypeBytes == null || segmentTypeBytes.Contains(segmentType))
                {
                    sbyte[] segmentBytes = reader.GetBytes(segmentLength);
                    System.Diagnostics.Debug.Assert((segmentLength == segmentBytes.Length));
                    segmentData.AddSegment(segmentType, segmentBytes);
                }
                else
                {
                    // Some if the JPEG is truncated, just return what data we've already gathered
                    if (!reader.TrySkip(segmentLength))
                    {
                        return(segmentData);
                    }
                }
            }while (true);
        }
Esempio n. 16
0
 public static void ProcessJpegSegmentData(Com.Drew.Metadata.Metadata metadata, Iterable<JpegSegmentMetadataReader> readers, JpegSegmentData segmentData)
 {
     // Pass the appropriate byte arrays to each reader.
     foreach (JpegSegmentMetadataReader reader in readers)
     {
         foreach (JpegSegmentType segmentType in reader.GetSegmentTypes())
         {
             reader.ReadJpegSegments(segmentData.GetSegments(segmentType), metadata, segmentType);
         }
     }
 }
Esempio n. 17
0
 public static JpegSegmentData ReadSegments([NotNull] SequentialReader reader, [CanBeNull] Iterable<JpegSegmentType> segmentTypes)
 {
     // Must be big-endian
     System.Diagnostics.Debug.Assert((reader.IsMotorolaByteOrder()));
     // first two bytes should be JPEG magic number
     int magicNumber = reader.GetUInt16();
     if (magicNumber != unchecked((int)(0xFFD8)))
     {
         throw new JpegProcessingException("JPEG data is expected to begin with 0xFFD8 (ÿØ) not 0x" + Sharpen.Extensions.ToHexString(magicNumber));
     }
     ICollection<sbyte> segmentTypeBytes = null;
     if (segmentTypes != null)
     {
         segmentTypeBytes = new HashSet<sbyte>();
         foreach (JpegSegmentType segmentType in segmentTypes)
         {
             segmentTypeBytes.Add(segmentType.byteValue);
         }
     }
     JpegSegmentData segmentData = new JpegSegmentData();
     do
     {
         // Find the segment marker. Markers are zero or more 0xFF bytes, followed
         // by a 0xFF and then a byte not equal to 0x00 or 0xFF.
         short segmentIdentifier = reader.GetUInt8();
         // We must have at least one 0xFF byte
         if (segmentIdentifier != unchecked((int)(0xFF)))
         {
             throw new JpegProcessingException("Expected JPEG segment start identifier 0xFF, not 0x" + Sharpen.Extensions.ToHexString(segmentIdentifier).ToUpper());
         }
         // Read until we have a non-0xFF byte. This identifies the segment type.
         sbyte segmentType = reader.GetInt8();
         while (segmentType == unchecked((sbyte)0xFF))
         {
             segmentType = reader.GetInt8();
         }
         if (segmentType == 0)
         {
             throw new JpegProcessingException("Expected non-zero byte as part of JPEG marker identifier");
         }
         if (segmentType == SegmentSos)
         {
             // The 'Start-Of-Scan' segment's length doesn't include the image data, instead would
             // have to search for the two bytes: 0xFF 0xD9 (EOI).
             // It comes last so simply return at this point
             return segmentData;
         }
         if (segmentType == MarkerEoi)
         {
             // the 'End-Of-Image' segment -- this should never be found in this fashion
             return segmentData;
         }
         // next 2-bytes are <segment-size>: [high-byte] [low-byte]
         int segmentLength = reader.GetUInt16();
         // segment length includes size bytes, so subtract two
         segmentLength -= 2;
         if (segmentLength < 0)
         {
             throw new JpegProcessingException("JPEG segment size would be less than zero");
         }
         // Check whether we are interested in this segment
         if (segmentTypeBytes == null || segmentTypeBytes.Contains(segmentType))
         {
             sbyte[] segmentBytes = reader.GetBytes(segmentLength);
             System.Diagnostics.Debug.Assert((segmentLength == segmentBytes.Length));
             segmentData.AddSegment(segmentType, segmentBytes);
         }
         else
         {
             // Some if the JPEG is truncated, just return what data we've already gathered
             if (!reader.TrySkip(segmentLength))
             {
                 return segmentData;
             }
         }
     }
     while (true);
 }
 public static void ProcessJpegSegmentData(Com.Drew.Metadata.Metadata metadata, Iterable <JpegSegmentMetadataReader> readers, JpegSegmentData segmentData)
 {
     // Pass the appropriate byte arrays to each reader.
     foreach (JpegSegmentMetadataReader reader in readers)
     {
         foreach (JpegSegmentType segmentType in reader.GetSegmentTypes())
         {
             foreach (sbyte[] segmentBytes in segmentData.GetSegments(segmentType))
             {
                 if (reader.CanProcess(segmentBytes, segmentType))
                 {
                     reader.Extract(segmentBytes, metadata, segmentType);
                 }
             }
         }
     }
 }
Esempio n. 19
0
        public virtual void TestLoadJpegWithoutExifDataReturnsNull()
        {
            JpegSegmentData segmentData = JpegSegmentReader.ReadSegments(new FilePath("Tests/Data/noExif.jpg"), null);

            NUnit.Framework.Assert.IsNull(segmentData.GetSegment(JpegSegmentType.App1));
        }
		public static void ProcessJpegSegmentData(Com.Drew.Metadata.Metadata metadata, Iterable<JpegSegmentMetadataReader> readers, JpegSegmentData segmentData)
		{
			// Pass the appropriate byte arrays to each reader.
			foreach (JpegSegmentMetadataReader reader in readers)
			{
				foreach (JpegSegmentType segmentType in reader.GetSegmentTypes())
				{
					foreach (sbyte[] segmentBytes in segmentData.GetSegments(segmentType))
					{
						if (reader.CanProcess(segmentBytes, segmentType))
						{
							reader.Extract(segmentBytes, metadata, segmentType);
						}
					}
				}
			}
		}