예제 #1
0
 internal static string[] SplitTiff(string fileName)
 {
     string[] strArrays;
     using (Image image = Image.FromFile(fileName))
     {
         FrameDimension    frameDimension   = new FrameDimension(image.FrameDimensionsList[0]);
         int               frameCount       = image.GetFrameCount(frameDimension);
         string[]          strArrays1       = new string[frameCount];
         ImageCodecInfo    encoder          = ImageToPDFConverter.GetEncoder(ImageFormat.Tiff);
         EncoderParameters encoderParameter = new EncoderParameters(2);
         encoderParameter.Param[0] = new EncoderParameter(Encoder.Compression, (long)4);
         encoderParameter.Param[1] = new EncoderParameter(Encoder.ColorDepth, (long)1);
         for (int i = 0; i < frameCount; i++)
         {
             image.SelectActiveFrame(frameDimension, i);
             using (Bitmap bitmap = new Bitmap(image))
             {
                 strArrays1[i] = string.Format("{0}\\{1}{2}.tif", ImageToPDFConverter.tempDir, Path.GetFileNameWithoutExtension(fileName), i);
                 bitmap.Save(strArrays1[i], encoder, encoderParameter);
             }
         }
         strArrays = strArrays1;
     }
     return(strArrays);
 }
예제 #2
0
        public static void BmpToPng(Bitmap bmp, string filename)
        {
            EncoderParameters encoderParameter = new EncoderParameters(1);

            encoderParameter.Param[0] = new EncoderParameter(Encoder.Quality, (long)100);
            bmp.Save(filename, ImageToPDFConverter.GetEncoder(ImageFormat.Jpeg), encoderParameter);
        }