如何在 .NET 中处理图像以实现像 Windows 照片库一样的质量的整页打印?
我正在 C# 中编写打印路由,使用 .NET PrintDocument 类,处理 OnPrintPage 事件。
我已设法最大化边距并以横向模式打印图像,但是它看起来根本不如从 Windows 照片库打印相同的图像文件(以前称为 Windows 图片和传真查看器) ),Windows Vista 中的默认图像预览程序。
我注意到那里有一个选项可以选择“锐化图像以进行打印”,但是它有什么作用呢?
我曾考虑过首先从 Windows 照片库打印图像的副本,然后再次通过打印机发送纸张以打印我需要的自定义叠加层,但每次都很难使其对齐,因为打印机会吸收工作表没有达到我需要的精度...所以我真的需要在 C# 中执行所有绘图命令,包括图像。
有谁知道如何对位图进行预处理,使其打印效果与 Windows 照片库一样好? 是否有任何简单的打印驱动程序可以将照片库打印输出截取为标准图像文件(bmp、png 等)可以被 .NET Image 类读取吗?我在这里完全支持创造力。
I'm writing a printing routing in C#, using the .NET PrintDocument class, handling the OnPrintPage event.
I've managed to maximize the margins and print the Image in landscape mode, but it simply does not look as good as when I print the same image file from Windows Photo Gallery (formerly Windows Picture and Fax Viewer), the default image preview program in Windows Vista.
I noticed an option there for selecting "Sharpen Image for Printing", but what does that do?
I've thought about printing copies of the image from Windows Photo Gallery first, then sending the sheets through the printer a second time to print the custom overlays I need, but it's hard to make it line up every time, since the printer sucks the sheet in without the kind of precision I need... so I really need to do ALL the drawing commands within C#, including the image.
Does anyone know how to perform pre-processing on the bitmap so that it prints as nicely as Windows Photo Gallery does it? Are there any simple print drivers that can intercept Photo Gallery printing output as a standard image file (bmp, png, etc.) that can be read by the .NET Image class? I'm all for creativity here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Paint.Net 使用 Windows 图片和传真查看器进行打印,并且它以前是开源的。
快速谷歌搜索“Paint.Net 来源”似乎会找到它,尽管是在他们再次关闭它之前的早期版本。我会查看他们的来源并看看他们如何调用对话框
Paint.Net uses the Windows Picture and Fax Viewer for its printing and it was previously open source.
A quick Google for "Paint.Net source" seems to turn it up, albeit in earlier incarnations before they closed it again. I'd look at their source and see how they invoke the dialog
如果您尝试拍摄小图像并打印它的大版本,那么在内存中创建图像的较大版本然后打印该较大版本可能会有所帮助。通常您会这样做:
基本上您将让 GDI+ 而不是打印机来调整图像大小;这可能是也可能不是一种改进。照片库中的“锐化”当然比这更复杂,并且针对打印问题。
If you're trying to take a small image and print a large version of it, it might help to create a larger version of your image in memory and then print that larger version. This is generally how you would do this:
Basically you'd be letting GDI+ resize the image instead of the printer; this may or may not be an improvement. The "sharpening" in Photo Gallery is certainly more sophisticated than this, and targeted at printing issues.