- Home /
Correct resolution/screen size for an A4 piece of paper
I posted this question some time ago: http://answers.unity3d.com/questions/775149/is-it-possible-to-generate-a-printable-image.html asking if it was possible to generate an image to print, and I learned about Application.CaptureScreenshot(). I tested it and it served my purposes perfectly.
Now I'd like to ask about formating the image. I would like to make it so when I take the screenshot, it fits perfectly in an A4 paper, for printing, but I don't know how to archieve this. Do I have to choose a certain resolution for the "game"? Should I use an ortographic camera? I read here: http://superuser.com/questions/480194/what-is-standard-a4-paper-size-in-pixels-for-a-given-resolution that the standard size of the paper is 210mm × 297mm (8.27in × 11.69in), and that doing some calculations I don't understand, he arrived at the value 4960 x 7016 pixels. The problem is, I don't know what to do with this value. I tried setting this as the resolution of the "game" (not allwing the user to change it) but it doesn't seem to be right.
thanks in advance for any help.
If you have bitmap image file that needs to be printed, you will have to decide at which resolution. DPI (Dots Per Inch) is often 300 for high-quality PDF documents, for example. So, taking a screenshot is only one half of what's needed.
Answer by LSPressWorks · Sep 25, 2014 at 04:29 AM
about halfway down they start getting to the good stuff.
http://forums.codeguru.com/showthread.php?85420-Converting-Pixels-to-Centimetres-and-inches
Answer by Max_Bol · Apr 07, 2016 at 02:53 AM
I'll give you a couple of tips about how you can manage this :
1) If you wish to produce documents for high-quality prints, you will need to use at least :
public static void CaptureScreenshot(string XXXXX, int superSize = 4);
XXXXX is meant for the file path and file name.
This will produce a file that can be printed at between 288 DPI and above 480 DPI depending on your screen resolution. I specify the difference because the screenshot taken is based on the data rendered through your device graphics' bandwidth. Some screen and devices display at an equivalent of 72 DPI while others do it at 92 DPI (like Smartphones). Recent iPhone render at above 120 DPI which (which allow crystal clear buttons and layouts).
2) On the other side, it doesn't mean that all device will be able to render such screenshot. Remember that some devices don't have enough temporary memory bandwidth to store as much as 4x the fullscreen worth of RGB data that is required during the process. You might have to allow the user to force a lower resolution onto the application. For example, a big screenshot on a big high definition screen can take up to 256MB of memory bandwidth just to temporary store the screenshot without counting the actual requirement of the software itself. It's only for a short time, but it's a huge memory spike which can be hated by the user if his device become unresponsive for a 1 or 2 sec thinking the application crashed.
This is why I suggest you allow the user to select his preferred quality setting since you can give him/her such ability to do so just by storing a int value and returning it in CaptureScreenshot().
3) For the Format, it can be done, but it require a bit of voodoo magic. ;) You got to do it in multiple steps. First, you force the window into a specific resolution in window mode: http://docs.unity3d.com/ScriptReference/Screen.SetResolution.html
This resolution must be of the same ratio as the paper size you're aiming for. In case of the A4, the ratio is 1:1.414 (depending on the orientation you're aiming for, you might have to rotate the camera and UI by 90 degrees before taking the screenshot). You could force the window mode and specific resolution based on the actual user's screen resolution (so that the size of the application become as big as possible). You will have to store the original resolution and if the window mode was already active or not. Then, you make it so that Unity call the CaptureScreenShot();. After 1 or 2 sec, you do a check to confirm if the file is at the path (you have to store the path and file name in some variable to be able to compare). If the file is confirmed, the application can restore itself in the previously stored Window and Resolution.
If you wish to add more, you can even give the option to open the file path once the file is confirmed :
FilePath = FilePath.Replace(@"/", @"\"); // explorer doesn't like front slashes
System.Diagnostics.Process.Start("explorer.exe", "/select,"+FilePath );
@$$anonymous$$ax_Bol that's a lot of work, hopefully Renderator_PRO do all that stuff :) http://forum.unity3d.com/threads/released-renderator-v-1-01.381844/
@$$anonymous$$amil1064 Yeah, it's a lot of works. I'm still waiting for answer on the forum page of that asset link you wrote. Currently, many high-res screen takers don't support orthographic view or Screen Space Overlay UI element. They simply are ignored and this really doesn't help much.
Thanks @$$anonymous$$ax_Bol, already answered on thread: http://forum.unity3d.com/threads/released-renderator-v-1-01.381844/#post-2592558