|
public static Image ImageFormatter(Image img, int width, int height)
{
Image originalImage = img;
int towidth = width;
int toheight = height;
int x = 0;
int y = 0;
int ow = originalImage.Width;
int oh = originalImage.Height;
Image bitmap = new Bitmap(towidth, toheight);
Graphics g = Graphics.FromImage(bitmap);
g.InterpolationMode = InterpolationMode.High;
g.SmoothingMode = SmoothingMode.HighQuality;
g.Clear(Color.Transparent);
g.DrawImage(originalImage, new Rectangle(0, 0, towidth, toheight), new Rectangle(x, y, ow, oh), GraphicsUnit.Pixel);
return bitmap;
}
这个该怎么转换成jpg直接返回,不要写出文件。。。。
|
|