How to Produce Physical Dimension of an Image drawn using Java

泄露秘密 提交于 2019-11-30 10:02:00

问题


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


回答1:


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




回答2:


50cm with 400 DPI are: 50/2,54*400 = 7874 Pixels I recommend png or gif (gif only for <= 255 colors)



来源:https://stackoverflow.com/questions/13993692/how-to-produce-physical-dimension-of-an-image-drawn-using-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!