for resizing my picture i use this method:
private Bitmap ResizeBitmap(Bitmap b, int nWidth, int nHeight)
{
Bitmap result = new Bitmap(nWidth, nHeight);
using (Graphics g = Graphics.FromImage((System.Drawing.Image)result))
g.DrawImage(b, 0, 0, nWidth, nHeight);
return result;
}
is there any possibilty to create a white or black border at the top/bottom or the right/left side of the picture, so that the picture is centered and i don’t have to do it by css?
example: i have a picture that is 200×100 pixels and i want to have it to work in a 100×100 px image field on my website. at the moment i resize the 200×100 px picture to 100×50 pixels, so that it matches in the 100×100 px box and center the picture by css.
what i need is after resizing my picture to add a border to it, so that the picture is not 100×50 px, but 100×100 px with white or black border…
any ideas… can i do this with normal .net libraries? thanks for all advices!
best regards,
jessica
i finally found a way solving my problem:
thanks for your help!