-2

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

Mihir
  • 2,480
  • 7
  • 38
  • 57

2 Answers2

2

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

MrSmith42
  • 9,961
  • 6
  • 38
  • 49
  • how do you come up with pixels number ? what formula you used ? i think you did not get my question yet ? thanks – Mihir Dec 22 '12 at 05:12
2

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

MadProgrammer
  • 343,457
  • 22
  • 230
  • 366
  • 1
    As [requested](http://stackoverflow.com/a/2483977/230513), I can verify that Mad's calculation recapitulates that of MrSmith42. I'm not sure what I can add. – trashgod Dec 22 '12 at 10:38