Page 1 of 1

Round print sizes (inches) from width & height in pixels

Posted: Sun Jul 16, 2006 11:24 am
by Skara
Ok, maybe this is a bit confusing... I can't figure out how to go about this.

Say I have an array of image sizes:

Code: Select all

$sizes = array(
        array(2048,1536),
        array(1280,768),
        array(3008,2000),
        array(2764,1396),
        array(1301,1992),
        array(4296,2608),
        array(4461,4106),
        );
Now I want to figure out a few different sizes that would be printable. For example...

3008x2000 would fit into a 4x6, 8x12, and so on. Up to a 16x24.
4461x4106 wouldn't fit into any thing real well. A 5x5 would work, though. It would end up being 5x4.6, but that's close enough.

Valid sizes are..
4x5,4x6,5x5,5x7,8x8,8x10,8x12,10x10,11x14,10x15,12x12,12x18,16x16,16x20,16x24
Off the top of my head. Might have missed some.

So, in a nutshell:
I need to figure out what sizes are valid for the image dimensions and record it and the actual dimensions it would be. (Ex: 1992x1301 would be 8x12 and 12.249x8)

I really don't know where to start, any help would be appreciated.

Posted: Sun Jul 16, 2006 1:10 pm
by andym01480
It all depends on the DPI of your printer. eg. 600DPI printer prints 600pixels per inch etc. That's what affects the phyical size of prints on paper.

So you would need that as a variable, then it is a matter of calculating etc.

Posted: Sun Jul 16, 2006 1:24 pm
by Skara
err.... no.
I can print a 4000x6000 image as a 4x6, 8x12, 10x15, etc regardless of the dpi, but I can't print it as a 5x5.

I want to figure out what proportions the image fits.

Posted: Sun Jul 16, 2006 1:42 pm
by Weirdan
so you can calculate the ratio of your image and compare it to the ratio of destination formats... for 4000x6000 it would be 1.5 but for 5x5 it's 1.

Posted: Sun Jul 16, 2006 2:38 pm
by Skara
hm. Well, I guess the solution was staring me right in the face. ^^;

Thanks.