Пример #1
0
        public ScannedImage(Bitmap img, ScanBitDepth bitDepth, bool highQuality, int quality)
        {
            Bitmap baseImage;
            MemoryStream baseImageEncoded;
            ImageFormat baseImageFileFormat;
            ScannedImageHelper.GetSmallestBitmap(img, bitDepth, highQuality, quality, out baseImage, out baseImageEncoded, out baseImageFileFormat);

            transformList = new List<Transform>();
            recoveryImage = RecoveryImage.CreateNew(baseImageFileFormat, bitDepth, highQuality, transformList);

            if (baseImage != null)
            {
                baseImage.Save(recoveryImage.FilePath, recoveryImage.FileFormat);
                baseImage.Dispose();
            }
            else
            {
                Debug.Assert(baseImageEncoded != null);
                using (var fs = new FileStream(recoveryImage.FilePath, FileMode.CreateNew))
                {
                    baseImageEncoded.Seek(0, SeekOrigin.Begin);
                    baseImageEncoded.CopyTo(fs);
                }
                baseImageEncoded.Dispose();
            }

            recoveryImage.Save();
        }
Пример #2
0
        public ScannedImage(Bitmap img, ScanBitDepth bitDepth, bool highQuality, int quality)
        {
            ImageFormat fileFormat;
            string tempFilePath = ScannedImageHelper.SaveSmallestBitmap(img, bitDepth, highQuality, quality, out fileFormat);

            transformList = new List<Transform>();
            recoveryImage = RecoveryImage.CreateNew(fileFormat, bitDepth, highQuality, transformList);

            File.Move(tempFilePath, recoveryImage.FilePath);

            recoveryImage.Save();
        }
Пример #3
0
 public ScannedImage(RecoveryIndexImage recoveryIndexImage)
 {
     recoveryImage = RecoveryImage.LoadExisting(recoveryIndexImage);
     transformList = recoveryImage.IndexImage.TransformList;
 }