Is it possible to rotate JPEG2000 quickly and losslessly without deep re-compression like it's possible for JPEG? Is there tool for this?

  • 1
    \$\begingroup\$ Possible duplicate of If an image is rotated losslessly, why does the file size change? \$\endgroup\$
    – Olivier
    Dec 29, 2016 at 9:52
  • \$\begingroup\$ nope, this one is about JPEG2000 \$\endgroup\$
    – szulat
    Dec 29, 2016 at 10:15
  • 5
    \$\begingroup\$ I'm voting to close this question as off-topic because it is about digital image formats, not photography. It would be better on SuperUser. \$\endgroup\$ Dec 29, 2016 at 10:56
  • 3
    \$\begingroup\$ @scottbb Yep. The photographic answer to this is "rotate it before you save it into a lossy format". \$\endgroup\$
    – Philip Kendall
    Dec 29, 2016 at 13:37
  • 1
    \$\begingroup\$ Jpeg2000 still uses EXIF IIRC so you it can just be a metadata tweak potentially. As for a re-encoding... which jpeg2000 scheme are you interested in as not all are lossy? \$\endgroup\$ Dec 29, 2016 at 23:43

2 Answers 2


Using Imagemagick it is possible to specify lossless rotation:

> convert -rotate 90 -compression lossless source.jp2 destination.jp2

More information is available in the Imagemagick man pages. Whether it will be quick is a matter of how much hardware is thrown at the task and the definition of 'quickly'. I'd expect, but cannot confirm, that specifying lossless compression will indeed be lossless. It's probably a question for the Imagemagick Discourse Forum.

  • 1
    \$\begingroup\$ no, imagemagick is not able to perform lossless rotation of the lossy encoded images. this is because it is a general tool that operates on pixels so it has to decompress the image first and recompress the output when finished. lossless rotation of JPEG involves manipulating the source stream without reaching the pixel level, thus avoiding the lossy part of the (re)compression. what the supplied command might do is converting the lossy JP2 to lossless JP2, which is no different from converting lossy JPEG to lossless PNG (which technically solves the problem but does not answer the question). \$\endgroup\$
    – szulat
    Dec 31, 2016 at 9:29
  • \$\begingroup\$ @szulat I don't think that your technical description is coherent. A stream is a time ordered series. Anything that changes the time ordering of the series will fail to meet your technical description. Under the stream abstraction, a rotated image is a different time ordering. Furthermore, lossless applied to something other than the pixel level doesn't make sense in terms of images. \$\endgroup\$
    – user50888
    Dec 31, 2016 at 15:55
  • \$\begingroup\$ source stream, source file, it does not matter here. what i mean is that imagemagick's -rotate operation affects the decompressed pixels, while the lossless JPEG rotation is performed on a higher level, which enables it to be lossless even though the file format itself is lossy. \$\endgroup\$
    – szulat
    Dec 31, 2016 at 16:09
  • \$\begingroup\$ and second, your "-compression lossless" (according to the imagemagick website, for JP2 it should be actually "-quality 0") only affects the image writing operation, so you would get a losslessly compressed JP2 file from the lossy JP2 source, which is not what the original poster expects. for regular JPG it simply decreases the compression (which is still lossy), and this demonstrates that a specialized lossless rotation is just not supported by imagemagick. some tools can loslessly rotate JPG, we still don't know if there is a way to losslessly rotate JPEG2000 in a similar way. \$\endgroup\$
    – szulat
    Dec 31, 2016 at 16:14
  • \$\begingroup\$ @szulat You certainly seem well versed on the internal workings of ImageMagick. Perhaps providing a well structured technical answer explaining why the goal is difficult or impossible to achieve would be helpful. \$\endgroup\$
    – user50888
    Dec 31, 2016 at 16:44

(I'm assuming you're using Windows, sorry if you aren't or your OS of choice doesn't have a similar application) Right click the picture, hover over "open with", select Windows photoviewer (not just photo) and it should open in the viewer; In the lower toolbar section, there should be circular arrows, click on the direction you wish to rotate. I'm not familiar with .JPG2000 images, but that should work. also, if you don't mind me asking, why do you use such an exotic image form? why not use .RAWs, .PNGs, and normal .JPGs?

  • 4
    \$\begingroup\$ rotating the picture is not the same as rotating the picture losslessly - the windows viewer might be able to do it but "you are not familiar" with the subject so your answer does not help us determine if this is the right tool for the job \$\endgroup\$
    – szulat
    Dec 30, 2016 at 21:55

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