原图(1.jpg)是24色位,想把截取的部分(2.jpg)修改为8色位,256色,但报“内存不足”错误,如何改?代码如下: using System.Drawing;
using System.Drawing.Imaging; Bitmap oPic, nPic;
Rectangle rx = new Rectangle();
rx.X = 0;
rx.Y = 0;
rx.Width = w;
rx.Height = h;
oPic = new Bitmap("1.jpg");//原图是24色位
nPic = objPic.Clone(rx, PixelFormat.Format8bppIndexed);//想把截取的部分修改为8色位,256色
nPic.Save('2.jpg');
using System.Drawing.Imaging; Bitmap oPic, nPic;
Rectangle rx = new Rectangle();
rx.X = 0;
rx.Y = 0;
rx.Width = w;
rx.Height = h;
oPic = new Bitmap("1.jpg");//原图是24色位
nPic = objPic.Clone(rx, PixelFormat.Format8bppIndexed);//想把截取的部分修改为8色位,256色
nPic.Save('2.jpg');
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货