我正在尝试使用 FARGO DTC-4500打印机将尺寸图像width=94px and height=109px
打印到ID卡上,该打印机以300 DPI打印。
图像存储在640*480px
维度的数据库中;现在它太大了,无法在CR-80大小的身份证上打印。
所以我从数据库中获取图像并使用以下代码调整其大小。
MemoryStream photostream= new MemoryStream(photo);
System.Drawing.Image image = System.Drawing.Image.FromStream(photostream);
Bitmap bmp = new Bitmap(94,109);
bmp.SetResolution(300, 300);
System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(bmp);
gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
gr.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
System.Drawing.Rectangle rectDestination = new System.Drawing.Rectangle(0, 0, 94, 109);
gr.DrawImage(image, rectDestination, 0, 0, image.Width, image.Height, GraphicsUnit.Inch);
bmp.Save(@"C:\Users\abdullah\Desktop\MOI_IDC\MOI_IDC\TempImages\" + ID + ".jpg",
System.Drawing.Imaging.ImageFormat.Jpeg);
FileInfo photoFile =
new FileInfo(@"C:\Users\abdullah\Desktop\MOI_IDC\MOI_IDC\TempImages\" + ID + ".jpg");
现在这个工作正常并且使用300 DPI将图像调整为94 * 109px但是当我打印这个图像时它仍然很大而我无法弄明白。如何在身份证上的0.81 inch * 1.13 inch
处打印图像?