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

closed as off-topic by Euri Pinhollow, scottbb, Philip Kendall, Itai, inkista Jan 2 '17 at 1:49

  • This question does not appear to be about photography within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Possible duplicate of If an image is rotated losslessly, why does the file size change? – Olivier Dec 29 '16 at 9:52
  • nope, this one is about JPEG2000 – szulat Dec 29 '16 at 10:15
  • 5
    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. – Euri Pinhollow Dec 29 '16 at 10:56
  • 3
    @scottbb Yep. The photographic answer to this is "rotate it before you save it into a lossy format". – Philip Kendall Dec 29 '16 at 13:37
  • 1
    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? – James Snell Dec 29 '16 at 23:43

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.

  • 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). – szulat Dec 31 '16 at 9:29
  • @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. – user50888 Dec 31 '16 at 15:55
  • 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. – szulat Dec 31 '16 at 16:09
  • 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. – szulat Dec 31 '16 at 16:14
  • @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. – user50888 Dec 31 '16 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
    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 – szulat Dec 30 '16 at 21:55

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