2
我有一個要求,以創建一個圖像與300DPI,但在圖像的組成,像添加資源(字體,圖像),我越來越內存異常。內存異常雖然300dpi圖片
using (Bitmap pg = new Bitmap(GetPixelsFromInches(float.Parse(pageWidth), dpi, actualDpi), GetPixelsFromInches(float.Parse(pageHeight), dpi, actualDpi)))
{
pg.SetResolution(float.Parse(dpi), float.Parse(dpi));
Graphics gr = Graphics.FromImage(pg);
gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
System.Drawing.Rectangle pgRect = new System.Drawing.Rectangle(0, 0, pg.Width, pg.Height);
SolidBrush solidWhite = new SolidBrush(Color.White);
gr.FillRectangle(solidWhite, pgRect);
currentPageDisplayed = xNode.Attributes["id"].Value;
foreach (XmlElement xElement in xNode)
{
//Here I am writing each elements, like texts or images.
DrawImageForElements(xElement, , dpi, actualDpi);
}
MemoryStream myMemoryStream = new MemoryStream();
//pg.Save(myMemoryStream, System.Drawing.Imaging.ImageFormat.Bmp);
String [email protected]"c:\images\" + currentPageDisplayed + "+.png";
pg.Save(filename, System.Drawing.Imaging.ImageFormat.Png);
myMemoryStream.Dispose();
gr.Dispose();
pg.Dispose();
}
請建議是否有其他更好的選擇!
如何在電腦上粘貼一些額外的內存? – grenade 2011-01-19 06:21:57
我在圖像中有很多元素,因爲它不斷繪製圖像尺寸在內存中的增長,例如:當我繪製尺寸爲300DPI的圖像時,尺寸爲11x15英尺。它真的很大。我想知道是否有其他的選擇,我可以保存在文件中,並寫上它? – Rafeeq 2011-01-19 06:29:50