Click here to Skip to main content
14,644,142 members
Rate this:
Please Sign up or sign in to vote.
See more:
its easy to convert the image format but i want to save the bitmat object as a png extention image or jpeg extention need ur help
Nirav Prabtani 22-Jan-14 6:51am
what have you tried for??

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

If you have a Bitmap element, simply use the Save method and pass in the appropriate image format (from the System.Drawing.Imaging namespace). It looks something like this:
public static void SavePng(this Bitmap image, string fileName)
  if (image == null) throw new ArgumentNullException("image");
  if (string.IsNullOrWhitespace(fileName)) throw new ArgumentException("file name has not been specified");

  image.Save(fileName, System.Drawing.Imaging.ImageFormat.Png);
Then all you do in your code is:
It's as easy as that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100