c# - How can i resize an image? -
this question has answer here:
- resize image gdi+ graphics .net 4 answers
i have code:
public static bitmap resizeimage(bitmap imgtoresize, size size) { try { bitmap b = new bitmap(size.width, size.height); using (graphics g = graphics.fromimage((image)b)) { g.interpolationmode = system.drawing.drawing2d.interpolationmode.highqualitybicubic; g.drawimage(imgtoresize, 0, 0, size.width, size.height); } return b; } catch { throw; } }
when call function example : resizeimage(bmp, how set size ?
in example:
resizeimage(bmp, new size(150, 150));
Comments
Post a Comment