Last post Feb 03, 2010 01:38 AM by vipindas
Feb 01, 2010 09:39 AM|elmo61|LINK
Im having a little issue. Basically I want some code to take a Image
"Image UploadedImage = Image.FromFile(Original);"
And overlay the colour white with 50% transpancy over the whole thing and then save it back to its current location..
Ive looked into it and seems I need to apply a rectangle of which has the white/transpacny colour over the whole of the image. But im having issues with it.
One of the main problems with getting a object Image to work with a graphic object.. Does anyone have the code to do something like this??
thx in advance steve
Feb 03, 2010 01:38 AM|Vipindas|LINK
public static void ResizeStream(int imageSize, Stream filePath, string outputPath)
var image = Image.FromStream(filePath);
int thumbnailSize = imageSize;
int newWidth, newHeight;
if (image.Width > image.Height)
newWidth = thumbnailSize;
newHeight = image.Height * thumbnailSize / image.Width;
newWidth = image.Width * thumbnailSize / image.Height;
newHeight = thumbnailSize;
var thumbnailBitmap = new Bitmap(newWidth, newHeight);
var thumbnailGraph = Graphics.FromImage(thumbnailBitmap);
thumbnailGraph.CompositingQuality = CompositingQuality.HighQuality;
thumbnailGraph.SmoothingMode = SmoothingMode.HighQuality;
thumbnailGraph.InterpolationMode = InterpolationMode.HighQualityBicubic;
var imageRectangle = new Rectangle(0, 0, newWidth, newHeight);
Color color = Color.FromArgb(50, 255, 255, 255);
SolidBrush brush = new SolidBrush(color);
Point atPoint = new Point(10, 10);
Pen pen=new Pen(brush);