Last post Apr 06, 2016 08:36 PM by march11
Member
122 Points
146 Posts
Apr 04, 2016 08:30 AM|imteyazahmad86|LINK
HI all,
I have a code to resize image. it works good just one thing that I dont want.
Bitmap bmPhoto = new Bitmap(Width, Height, PixelFormat.Format24bppRgb); bmPhoto.SetResolution(fullSizeImg.HorizontalResolution, fullSizeImg.VerticalResolution); Graphics grPhoto = Graphics.FromImage(bmPhoto); grPhoto.Clear(Color.Red); grPhoto.InterpolationMode = InterpolationMode.Default; grPhoto.CompositingQuality = CompositingQuality.HighQuality; grPhoto.SmoothingMode = SmoothingMode.HighQuality; grPhoto.DrawImage(fullSizeImg, new Rectangle(destX, destY, destWidth, destHeight), new Rectangle(sourceX, sourceY, sourceWidth, sourceHeight), GraphicsUnit.Pixel); grPhoto.Dispose();
In my bold section, it fills a Red color on outside of image. I dont want that red color. If I remove that line, it fills with black color. I dont want that color at all. I want it fits whatever empty spaces it is getting that filled with color.
Contributor
2155 Points
2142 Posts
Apr 06, 2016 08:36 PM|march11|LINK
Set FillStyle = Transparent
Member
122 Points
146 Posts
Remove background color from Graphics.Clear()
Apr 04, 2016 08:30 AM|imteyazahmad86|LINK
HI all,
I have a code to resize image. it works good just one thing that I dont want.
In my bold section, it fills a Red color on outside of image. I dont want that red color. If I remove that line, it fills with black color. I dont want that color at all. I want it fits whatever empty spaces it is getting that filled with color.
Contributor
2155 Points
2142 Posts
Re: Remove background color from Graphics.Clear()
Apr 06, 2016 08:36 PM|march11|LINK
Set FillStyle = Transparent