I am trying to Print an Image of Dimensions width=94px and height=109px
to an ID-card using FARGO DTC-4500 Printer which prints at 300 DPI.
The image is stored in a database with 640*480px
dimensions; now that's too big to print on an ID-card of size CR-80.
So I am fetching the image from database and resizing it using the following code.
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");
Now this works fine and resizes image to 94*109px with 300 DPI but when i print this image its still big and i cant figure it out. how to get the image to print at 0.81 inch * 1.13 inch
on the IDcard?