phdphd Posted May 10, 2019 Share Posted May 10, 2019 Hi All, Just wondering whether it is possible to resize a jpg image to a specific size in bytes (while preserving height/width ratio). Thanks for any clues! Quote Link to comment https://forums.phpfreaks.com/topic/308690-resize-an-image-to-a-specific-byte-size/ Share on other sites More sharing options...
Barand Posted May 10, 2019 Share Posted May 10, 2019 Not tested, but you could try this Calc the resize factor (R) as sqrt(required_size / orig_size) Multiply the orig height and width by R to get new dimensions 1 Quote Link to comment https://forums.phpfreaks.com/topic/308690-resize-an-image-to-a-specific-byte-size/#findComment-1566581 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.