My application requires VERY small size jpeg files (less than 2.5KB) to be stored as DATA (CANNOT BE A LINK) in a QR code. Both quality and size are a concern. Any byte I can save might mean that I can make the QR code easier to read. Luckily, they all have a standard resolution (160x240) and color depth (24 bits).
I had an idea of taking part of the header out of the JPEG files themselves, and have the application add the header back into the data array later, which would save a good 600 bytes (wow). The way I'm doing compression so far is to keep a "gold standard file" and compress that file with Q = 80-10% until it fits into 2.5KB.
Because a different compression ratio means a different header, my idea would be to pass the final compressed image through ANOTHER pass of a known, standard compression. But then if the "standard compression" is greater than the original compression the image settled on, the size may actually be GREATER than the final compressed image.
Is there a standard method of doing something like this? I feel like I might be onto something, but I can't seem to get it to work.