如何生成使用Java绘制的图像的物理尺寸 [英] How to Produce Physical Dimension of an Image drawn using Java

查看:461
本文介绍了如何生成使用Java绘制的图像的物理尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Swing Applet中的JPanel上绘制了一个正方形。现在我想打印这个正方形的物理尺寸为50厘米* 50厘米的纸张,这意味着广场的打印尺寸为50 * 50厘米我打开一个applet面板的世界。打印机使用 400 DPI 打印。

所以我如何关联这些测量?
,其中文件格式我应该保存我的绘图,因此在打印时它将具有准确的测量结果,等于打印机DPI并且图像质量保持打印。

感谢您
Mihir Parekh

解决方案

您需要将厘米值转换为英寸,因此您可以获得点每英寸



1厘米=0.393700787英寸结果,
50厘米×0.393700787英寸=19.68503935英寸结果,
19.68503935 * 400 = 7874.01574像素


I have drawn a square on JPanel in Swing Applet.now i want to print this square having physical dimension 50cm * 50 cm on to paper.it means the print measurement of the square is 50 * 50 cm in real world which i drawn on to panel of an applet .the printer uses 400 DPI to print.

so how can i relate these to measurements ? in which file format i should save my drawing so it will have accurate measurement while printing , equals to printer DPI and quality of the image is maintained in print.

Thank You Mihir Parekh

解决方案

You need to convert you centimeter value to inches, so you can obtain the Dots Per Inch

1 cm = 0.393700787 inches
50 cm * 0.393700787 inches = 19.68503935 inches
19.68503935 * 400 = 7874.01574 pixels

这篇关于如何生成使用Java绘制的图像的物理尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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