Example #1
0
        public virtual void TestImageCompressLevel()
        {
            byte[] b = ImageDataFactory.Create(sourceFolder + "berlin2013.jpg").GetData();
            ByteArrayOutputStream image = new ByteArrayOutputStream();

            image.AssignBytes(b, b.Length);
            MemoryStream         byteArrayStream1 = new ByteArrayOutputStream();
            DeflaterOutputStream zip = new DeflaterOutputStream(byteArrayStream1, 9);

            image.WriteTo(zip);
            MemoryStream         byteArrayStream2 = new ByteArrayOutputStream();
            DeflaterOutputStream zip2             = new DeflaterOutputStream(byteArrayStream2, -1);

            image.WriteTo(zip2);
            NUnit.Framework.Assert.IsTrue(byteArrayStream1.Length == byteArrayStream2.Length);
            zip.Dispose();
            zip2.Dispose();
        }