3

Got this jpeg image that has incorrect proportions. That's how it should look but here's the thing - by simple means of resizing and recompressing it to jpeg, after conversion the size gets bigger and the quality of course gets worse. So I'm curious if it's possible to simply change its aspect ratio via some header information and avoid conversion.

6
  • 1
    I'm not sure it's possible. The only software I know that can process JPG without losses is BetterJPEG, and resizing is one of the only operations that isn't stated as lossless. You'll maybe find better advice on GraphicDesign.SE – Tymric Apr 9 '15 at 21:23
  • 1
    I know XnView and XnViewMP can rotate a jpeg image (JPG) without recompression. You might want to take a look at them to see if either can do what you want. – RockPaperLz- Mask it or Casket Apr 9 '15 at 21:28
  • @RockPaperLizard while orientation is a simple header info to be replaced (and thus rotation is possible without any loss – after all, you can start painting in the upper-left corner, or the lower-right corner, without changing other info), I very much doubt the same can be said for proportions. – Izzy Apr 10 '15 at 9:19
  • @Izzy I agree it's unlikely, but I don't know the details to be sure it's not possible. Also, IIRC XnView's lossless JPG rotation may actually do more than just flip a bit... but I don't remember all the details. – RockPaperLz- Mask it or Casket Apr 10 '15 at 21:00
  • I'm not fully into them either, but the difference to my knowledge is rotation can be done without recompression, while resizing (or changing the proportions) cannot. And as soon as you need to compress, quality gives – as JPEG is no lossless compression. But OK, let's leave it to the real experts :) – Izzy Apr 10 '15 at 21:04
1

The JPEG Club releases jpegtran, and for Windows users JpegCrop, which both allow various lossless operations on JPEG files such as:

  • Rotation by 90, 180 & 270 degrees
  • Flip Horizontal or Vertical
  • Transpose
  • Cropping you loose the removed information
  • Monochrome
  • Create progressive jpeg
  • Resize JPEG 9 only so a waning that some applications may not display the resulting image

But you example images require scaling the vertical element only - this is not possible without recompression so you would be better off with GIMP or ImageMagick - both of which are free, gratis & open source plus available for a number of platforms.

2
  • The JFIF header and the EXIF header both contain information about dpiX and dpiY, so it's possible what OP asks for. I modified those values manually and the built-in Windows image viewer is even able to display it correctly. @Bri – Thomas Weller Sep 4 '16 at 19:06
  • @ThomasWeller not all viewers will honour those values IIRC. – Steve Barnes Sep 5 '16 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.