views:

429

answers:

1

Hi All,

Should be a quick and easy question.

Does System.Drawing.Graphics.DrawImage() or Image.Save() by default make an image background transparent? I had to use System.Drawing.Bitmap to adjust image resolutions and now all of the converted images have a transparent background.

Futher details: We are using ImageMagick to do the basic image conversion from .eps to .jpg, but we can't seem to nail down the resolution conversion in ImageMagick so we decided to use System.Drawing to handle that portion. We are also setting InterpolationMode to HighQualityBicubic.

Please let me know if you need any other details!

Thanks in advance!

  • Jesse
+1  A: 

If you create a new (empty) Format32bppArgb Bitmap it will, by default, be fully transparent.

Neither DrawImage nor Save have anything to do with making it transparent. But they will respect existing transparencies (if the Pixelformat supports transparencies).

If you are using ImageAttributes you might have made a mistake there (which could create transparency when using e.g. DrawImage).

Foxfire
Thanks for the info! In the meantime, I also wrote a quick test application using my method of conversion and it doesn't set the background transparency unless I explicitly call MakeTransparent().
psuphish05