保存图像为位图不失品质 [英] save an image as a bitmap without losing quality

查看:113
本文介绍了保存图像为位图不失品质的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不得不印刷质量的问题,我在这个环节上描述的那样:
<一href=\"http://stackoverflow.com/questions/11644115/how-to-improve-printed-text-quality-after-using-graphics-drawstring\">enter链接的描述在这里

I had a problem of printing quality and I described it in this link : enter link description here

我试过很多不同的解决方案,帮助其他球员有类似的概率,但他们不适合我,因为我有保存图像作为位图的一个新的概率(低质量)

I tried many different solutions that helped other guys with similar prob but they don't work for me because I have a new prob of saving image as bitmap(with low quality)

终于,我决定要问我现在的问题,因为正如你看到的上面的链接,我的概率在系统中保存图像(96DPI)和恢复后启动。但我也没有办法,所以我在寻找一种方式,使其能够保存图像(即具有从图形绘制的像素),不失质量。

finally I decided to ask my current question , because as u see in above link , my prob starts after saving the image in system(96dpi) and restoring it . but I have no way so I'm looking for a way that make it possible to save an image (that has pixels drawn from a graphic) without losing quality.

感谢名单提前

推荐答案

虽然96 dpi是罚款屏幕显示,它不是打印。对于打印你至少需要300 dpi的分辨率,使它看起来锋利。

While 96 dpi is fine for screen display, it is not for printing. For printing you need at least 300 dpi to make it look sharp.

出于好奇,我创建了打印在600 dpi的位图文本的C#控制台应用程序。
我想出了这一点:

Out of curiosity I created a C# console application that prints a text on a 600 dpi bitmap. I came up with this:

class Program
{
    public static void Main(string[] args)
    {
        const int dotsPerInch = 600;    // define the quality in DPI
        const double widthInInch = 6;   // width of the bitmap in INCH
        const double heightInInch = 1;  // height of the bitmap in INCH

        using (Bitmap bitmap = new Bitmap((int)(widthInInch * dotsPerInch), (int)(heightInInch * dotsPerInch)))
        {
            bitmap.SetResolution(dotsPerInch, dotsPerInch);

            using (Font font = new Font(FontFamily.GenericSansSerif, 0.8f, FontStyle.Bold, GraphicsUnit.Inch))
            using (Brush brush = Brushes.Black)
            using (Graphics graphics = Graphics.FromImage(bitmap))
            {
                graphics.Clear(Color.White);
                graphics.DrawString("Wow, I can C#", font, brush, 2, 2);
            }
            // Save the bitmap
            bitmap.Save("n:\\test.bmp");
            // Print the bitmap
            using (PrintDocument printDocument = new PrintDocument())
            {
                printDocument.PrintPage += (object sender, PrintPageEventArgs e) =>
                {
                    e.Graphics.DrawImage(bitmap, 0, 0);
                };
                printDocument.Print();
            }
        }
    }
}

这是打印结果

这篇关于保存图像为位图不失品质的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆