Start with the actual upload requirement
A file-size limit measures bytes; pixel dimensions measure width and height. They are different requirements. Enter the destination’s file limit and keep dimensions unchanged unless smaller images are allowed.
Control the quality trade-off
Choose the starting quality and a minimum you will accept. PixelPort tries smaller encoded files within that range and verifies the output bytes. If necessary, explicitly allow dimensions to shrink. PNG can only use the dimension step.
What if the file is still too large?
PixelPort reports an unreachable target rather than presenting an oversized file as a success. Raise the limit, lower the quality floor or allow smaller dimensions. Compare fine text and edges before using a compressed image.