▲ ▼ Reduce document file size to specific size
Each website have their own maximum size limit for uploading .pdf, .jpg documents e.g. 100KB, 2MB etc. It takes a long time to reduce the size of the document to their size limit because the available tools compress the file size to an arbitrary size.
If the file is compressed to a size over that limit, the file cannot be uploaded and if the file is compressed to a size lesser than the limit it looses quality unnecessarily.
If the compression tool can take the size limit as input from the user and compress the file to that limit then this problem can be addressed.
I see the problem you're describing and I agree it would be a good problem to solve. Here's the problem: The size tools compress to isn't arbitrary - it's based on the algorithm, how compressible the data is, and how much loss of quality the user is willing to accept. The algorithm is generally fixed - as a user you just use the algorithm of the tool you're using (or file type). The compressibility of the data is defined by the data you're using. A bland picture with few colors is more compressible than a very rich one, for example. Acceptable quality is a bit fuzzy, and this is where the problem is. For an image, is cropping better than losing color depth? Or resolution? Are you concerned about image scaling - how it looks on an iPad vs a big PC gaming monitor? So, the problem you want to solve requires lots of input from the user, about topics the user either cares not a whit about (until the picture comes out bad) OR the user cares passionately, and is already using something like Photoshop or GIMP and doesn't mind the extra work.
Standard compression algorithms have a limit to which the data could be compressed and most tools have profiles for different levels of compression e.g. High, Mid, Low and Since the resulting file size varies depending upon the size of the original data it does result in greater file size or lesser quality for intended action as you have described.
Without making changes to the compression algorithms itself I wonder whether it would be possible to compress data of defined file size, but if different compression algorithms are used to produce document files then the website where we are trying to upload the document should accept that format.