首页  编辑  

BMP2JPE

Tags: /C#/图形图像/   Date Created:

using System . Drawing . Imaging;

ImageCodecInfo [] vImageCodecInfos = ImageCodecInfo . GetImageEncoders();

Bitmap vBitmap = new Bitmap ( @"c:\temp\temp.bmp" );

foreach ( ImageCodecInfo vImageCodecInfo in vImageCodecInfos)

{

    if (vImageCodecInfo . FormatDescription . ToLower() == "jpeg" )

   {

        EncoderParameters vEncoderParameters = new EncoderParameters ( 1 );

       vEncoderParameters . Param[ 0 ] = new EncoderParameter (

           System . Drawing . Imaging . Encoder . Quality, 75L );

       vBitmap . Save( @"c:\temp\temp.jpg" , vImageCodecInfo, vEncoderParameters);

        break ;

   }

}