0

How can I convert a 256x256 JPEG to a 512x512 JPEG without losing any quality? (I can use jpegtran, but that uses SmartScale, which isn't widely supported.)

It must be converted to JPEG specifically. If it cannot be a literally lossless conversion, can it get very close? Virtually lossless? Thanks.

EDIT: If it's not possible with any existing tool, please tell me if and how it might be possible in theory.

EDIT 2: The reason I'm asking is because I want to losslessly combine 512x512 image tiles from the internet in order to re-assemble a panoramic image. The problem is that some of these tiles (along the top and bottom rows of the image) are 256x256 resolution, and require stretching before being combined with the other tiles. So in short, most of the tiles are 512x512 and thus wouldn't require reencoding, but some 256x256 tiles would.

If the 256x256 JPEGs became 512x512 JPEGs, I could combine all the tiles with jpegtran without reencoding, and they would form a simple equirectangular image.

I don't want to encode these panoramas to a different format like PNG, if I can help it, but I know I may need to. So I'm wondering if these few half-sized tiles can be scaled up essentially losslessly.

grgoelyk
  • 397
  • 1
  • 3
  • 12
  • Any increase in an image's resolution necessarily involves *guessing* information that is not initially present - *interpolation* and *Smart Scaling* are just fancy names for it. Those guesses are based on assumptions that will not always be 100% correct, as such, your original, "accurate" picture is mixed in with less accurate information so its quality will always be less. – Mark Setchell Feb 11 '17 at 08:34
  • How do you define "Not losing any quality?" – user3344003 Feb 11 '17 at 16:52
  • What you're asking to do is not useful nor easy to do. Working in the frequency domain to try to stretch the pixels in the spatial domain is a losing proposition. A better plan is to just have the recipient of the image stretch it using whatever means they want. Stretching and re-compressing a file will introduce distortion and make it bigger with no useful purpose. – BitBank Feb 11 '17 at 19:05
  • @user3344003 Upscaling the small tiles in a lossless or essentially lossless way, while keeping them as JPEGs. – grgoelyk Feb 11 '17 at 21:47
  • @MarkSetchell Good input. How could at least ensure that the original pixels remain the same? Is this possible? – grgoelyk Feb 11 '17 at 21:48
  • Are the pixel values to be duplicated? Or are they to upsampled? – user3344003 Feb 13 '17 at 02:58
  • @user3344003 Hmm, either way. I don't have a strong opinion on which method is better -- literally duplicating existing pixels or inventing new pixel data to achieve 512x512. Either way, I'd like to keep the **original** pixels without any generational loss from the JPEG to JPEG compression. That's my main question and concern. Is this possible? – grgoelyk Feb 13 '17 at 05:51

0 Answers0