I wish to shrink the file size of jpg images, using VB.Net 2015.
So the user would select an image, then a smaller image would be saved. These images are usually photographs of 2Mb, can be up to 8Mb.
The smaller photograph:
- should be 200k or less.
- The width/height ratio remain the same.
- Save to the same folder, but with a new name
I've seen some code which resizes by a percentage. However I want to make sure the size is always under 200k, no matter the size of the original.
What would be the best way to do this in VB.Net?
Use that code and keep reducing the percentage until the file size is what you desire.
percentreduction = 90 90 % of original is target
while filesize > 200000
percentreduction = percentreduction - 10