为PNG文件设置DPI [英] Setting DPI for PNG files

查看:1572
本文介绍了为PNG文件设置DPI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆使用我编写的Java图表工具创建的图表-它们大多是黑白图表,其中的方块为浅绿色,偶尔还有其他颜色.它们当前正在另存为JPG文件,我想将它们插入准备为按需打印"的书中.

I have a bunch of diagrams created using a Java diagramming tool that I wrote - they are mostly black and white diagrams, with the blocks in aqua, and occasional other colours. They are currently being saved as JPG files, and I want to insert them into a book that I am preparing for Print On Demand.

这本书是OpenOffice ODT文件,以后将转换为PDF.

The book is an OpenOffice ODT file, which will later be converted to a PDF.

当前,我使用JPG文件,但是使用的打印工具需要300 DPI,因此我修改了图表工具,使用getAsTree()将xDensity和yDensity设置为300,将resUnits设置为1,然后通过系数3(300/96). IMO的结果看起来还不错!

Currently I use JPG files, but the print facility they use requires 300 DPI, so I modified my diagramming tool to set the xDensity and yDensity to 300, and resUnits to 1, using getAsTree(), and then expand the diagram by a factor of 3 (300/96). IMO the result looks pretty good!

不幸的是,另一个论坛上的某人指出,线图在JPG文件上模糊不清",因此建议我切换到PNG或可能的BMP文件,这两个ODT文件都可以插入.

Unfortunately, someone on another forum pointed out that line diagrams are "fuzzed" on JPG files, so suggested that I change over to PNG, or possibly BMP files, both of which ODT files allow to be inserted.

我的问题是BMP似乎没有DPI,而PNGMetadata似乎不支持getAsTree().有人可以指出我正确的方向吗?谢谢.

My problem is that BMPs don't seem to have a DPI, and PNGMetadata doesn't seem to support getAsTree(). Can someone point me in the right direction? Thanks.

推荐答案

我决定不尝试以编程方式执行此操作.取而代之的是,我在PNG中创建原始图,然后使用Irfanview将其转换为300 DPI. Irfanview的批处理功能使我可以一次转换-一次转换多个文件,将其转换为300 DPI,按比例放大以进行补偿,并设置为灰度.这似乎是最好的解决方案-不过还是要感谢大家!

I decided not to try to do this programmatically. Instead I create the original diagram in PNG, then convert to 300 DPI using Irfanview. Irfanview's batch capability lets me convert to 300 DPI, scale up to compensate, and set to grey scale, all in one operation - and on multiple files at a time. This seems to be the best solution - but thanks to everyone anyway!

这篇关于为PNG文件设置DPI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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