I
ironpythonster
Hi everyone, this should be a quick question.
I am writing a function to compress the Jpeg file,with
the API Image.Save(...) .
the code as follow that:
public static void Save(string imagePath, Bitmap image, int quality)
{
if (JpegQuality.Codec == null)
image.Save(imagePath,
System.Drawing.Imaging.ImageFormat.Jpeg);
else
{
EncoderParameters ep = new EncoderParameters();
ep.Param[0] = new
EncoderParameter(System.Drawing.Imaging.Encoder.Quality, quality);
image.Save(imagePath, JpegQuality.Codec, ep);
ep.Dispose();
}
}
But use this function,the compressed photo would lost so much
info. e.g.:when a originality is about 1.5M large,
the compress result would get a file only about 30K(set the quality
gene as 85)
How could i compree a file larger than 1.5M to about only 1M?
Thanks!
I am writing a function to compress the Jpeg file,with
the API Image.Save(...) .
the code as follow that:
public static void Save(string imagePath, Bitmap image, int quality)
{
if (JpegQuality.Codec == null)
image.Save(imagePath,
System.Drawing.Imaging.ImageFormat.Jpeg);
else
{
EncoderParameters ep = new EncoderParameters();
ep.Param[0] = new
EncoderParameter(System.Drawing.Imaging.Encoder.Quality, quality);
image.Save(imagePath, JpegQuality.Codec, ep);
ep.Dispose();
}
}
But use this function,the compressed photo would lost so much
info. e.g.:when a originality is about 1.5M large,
the compress result would get a file only about 30K(set the quality
gene as 85)
How could i compree a file larger than 1.5M to about only 1M?
Thanks!