1

I see this command:

convert logo: -resize 80x80\> \
          -size 80x80 xc:blue +swap -gravity center  -composite \
          space_resize.jpg

but I can't convert it to code c#. please help me!

Tiny Dragon
  • 71
  • 2
  • 8

1 Answers1

0

I'm using this for Image resize in c#

public static void Resize(string path, int nWidth, int nHeight)
    {
        using (var result = new Bitmap(nWidth, nHeight))
        {
            using (var input = new Bitmap(path))
            {
                using (Graphics g = Graphics.FromImage((System.Drawing.Image)result))
                {
                    g.DrawImage(input, 0, 0, nWidth, nHeight);
                }
            }

            var ici = ImageCodecInfo.GetImageEncoders().FirstOrDefault(ie => ie.MimeType == "image/jpeg");
            var eps = new EncoderParameters(1);
            eps.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);
            result.Save(path, ici, eps);
        }
    }
Waleed
  • 134
  • 5