Hi all,
Sorry for offtop, this is not imagemagick question, but I wrote here as many people are knowlageble about images sizes and related questions...
I have some kind of image editor written using php/javascript, which is based on fabricjs library (http://fabricjs.com/) and admin, logged to site has to select a2-a6 formats and orientation as portrait / landscape.
Here http://www.papersizes.org/a-sizes-in-pixels.htm I see that size of image depends not only from selected format and orientation, but also from monitor of admin.
Here https://www.sven.de/dpi/ there is DPI Calculator / PPI Calculator, say on my side it is 115.942, as I have laptop 19 inch, Resolution : 1920x1080 pixels
The question is how to calculate width and height of generated image?
That is known that size in mm = pixels * pixels in 1mm.
We can not calculate programmatically ppi value by using javascript... Is it so?
Admin MUST KNOW it... say in image editor show link to dpi/ppi Calculator and admin can get it there and enter this value in.
After admin selected his ppi value by data in http://www.papersizes.org/a-sizes-in-pixels.htm table programm must to select valid width/height in pixels, say as example
a5/portrait for my 115.94 PPI I must get 874 x 1240 pixels, as I need to get right column(3rd column) from range of my ppi. Is it so?
Entering all data template of image with all parameters is saved and image is generated.
Question is if admin reopens this template(maybe on ther device) with generated image has he enter his ppi of this devices and recalculate the image size again?
Thanks for advice!
calculate image size in a2-a6 formats
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: calculate image size in a2-a6 formats
No.mstdmstd wrote:That is known that size in mm = pixels * pixels in 1mm.
size_in_mm = pixels / pixels_in_1mm.
Or:
Pixels = pixels_in_1mm * size_in_mm
If your monitor is 115.94 PPI (pixels per inch),
then one inch is 25.4mm so the monitor is 115.94/25.4 = 4.565 pixels per mm.
For example, A4 paper is 297mm x 210mm.
At 4.565 pixels per mm, this is 297*4.565 = 1355.805 pixels by 958.65 pixels.
snibgo's IM pages: im.snibgo.com