views:

10

answers:

0

I have a method that takes a bitmap image: foo(Bitmap bmp){}

Im calling bmp.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams);

Essentially encoder is set with the following pseudo code:

foreach (var _encoder in ImageCodecInfo.GetImageEncoders())
{
  if (_encoder.mimetype=="image/png")
  {
   encoder = _encoder;
   break;
  }
}

And EncoderParameters is basically

 using (EncoderParameters encParams = new EncoderParameters(1))
            {
                encParams.Param[0] = new EncoderParameter(Encoder.Quality, quality);
                ...
                ...
            }

Whether the image type is a jpeg or png, pagespeed still says something along the lines of:

Losslessly compressing xyz.png could save 207B (44% reduction). See optimized version or Save as.

Can anyone offer any insight? I realise that this is abit of a specialized topic so this is a bit of a stab in the dark.