问题
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