Пример #1
0
        public static void SaveThumbnailImage(int width, int height, Bitmap image, ImageFormat newFormat, Stream thumbOut, ImageFilter filter)
        {
            ThumbMaker thumb = new ThumbMaker(image, newFormat);

            if (newFormat == ImageFormat.Jpeg)
            {
                //note: supports high quality JPEG thumbnailing
                thumb.ResizeToJpeg(width, height, JPEG_QUALITY, thumbOut, filter);
            }
            else if (newFormat == ImageFormat.Gif)
            {
                //note: supports transparent images
                thumb.ResizeToGif(width, height, thumbOut, filter);
            }
            else if (newFormat == ImageFormat.Png)
            {
                //note: nothing special needs to be done here since PNG format rules!
                thumb.ResizeToPng(width, height, thumbOut, filter);
            }
            else if (newFormat == ImageFormat.Bmp)
            {
                thumb.ResizeToBmp(width, height, thumbOut, filter);
            }
            else
            {
                throw new Exception("unsupported image format detected");
            }
        }
Пример #2
0
 public static void SaveThumbnailImage(int width, int height, Bitmap image, ImageFormat newFormat, Stream thumbOut, ImageFilter filter)
 {
     ThumbMaker thumb = new ThumbMaker(image, newFormat);
     if (newFormat == ImageFormat.Jpeg)
     {
         //note: supports high quality JPEG thumbnailing
         thumb.ResizeToJpeg(width, height, JPEG_QUALITY, thumbOut, filter);
     }
     else if (newFormat == ImageFormat.Gif)
     {
         //note: supports transparent images
         thumb.ResizeToGif(width, height, thumbOut, filter);
     }
     else if (newFormat == ImageFormat.Png)
     {
         //note: nothing special needs to be done here since PNG format rules!
         thumb.ResizeToPng(width, height, thumbOut, filter);
     }
     else if (newFormat == ImageFormat.Bmp)
     {
         thumb.ResizeToBmp(width, height, thumbOut, filter);
     }
     else
     {
         throw new Exception("unsupported image format detected");
     }
 }