A quick math question.

LOL!

Like someone said, use photoshop. It re-sizes while maintaining the image proportions. So if you enter a width, the height will automatically be calculated. If you don't have photoshop, you can use a free software called fotosizer.

But still to answer your original question:

If w1 >= w2 then w1/w2 = n.
Hence, h2 = h1/n (then round off h2 since pixels can't have decimals)

If w1 < w2 then w2/w1 = n.
Hence, h2 = h1*n (then round off h2)
 
Sure, I could do that... or I can use my photo editing software to do it. But with the right math equation that I ask for and received, I can use HTML in the image code and re-size it to my requirements with very little fuss.

Yes, but depends on how well browsers re-sample the new image. A few years back, the result of in-browser re-sampling was usually shitty. On the other hand, if you resize an image in Photoshop, the resized image quality will always be very good.
 
Back
Top