ppi
as int
pageResolution
in px
imageResolution
in px
pageSize
in inches
{
ppi: 96,
pageResolution: { longEdge: 1548, shortEdge: 741 },
imageResolution: { longEdge: 1506, shortEdge: 699 },
pageSize: { longEdge: 16.125984, shortEdge: 7.716535 },
}
- Get percentage size of image longEdge relative to page
- Use percentage to to get image size in inches
- Multiply inches by ppi
// get image's percentage of page
imageSizePercentage = imageResolution.longEdge / pageResolution.longEdge // e.g. 97(%)
// calculate physical size of image in inches
physicalSize = ((pageSize.longEdge * imageSizePercentage / ppi) * ppi) // e.g. 15.64220448(in)
// final output size in px
outputSize = physicalSize * ppi // e.g. 4692(px)