Author Topic: Lossless rotation of JPEGs  (Read 3754 times)

Offline herman

  • Newcomer
  • Posts: 19
Lossless rotation of JPEGs
« on: 2013 August 01 15:27:24 »
Does PixInsight perform lossless rotation of JPEGs?

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: Lossless rotation of JPEGs
« Reply #1 on: 2013 August 01 15:34:52 »
As Juan would say "of course".

 ;)
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: Lossless rotation of JPEGs
« Reply #2 on: 2013 August 02 01:00:35 »
I think the answer is "no". When you load a jpg to PI, it is decoded. You can then rotate the decoded data (without data loss). But when you store it again as JPG, it needs to be encoded again (with the associated losses).
Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: Lossless rotation of JPEGs
« Reply #3 on: 2013 August 02 07:45:34 »
But by that definition no software would have lossless rotation. The way jpg is encoded (macroblocks and all that) you have to decode to pixels before you do anything.
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Lossless rotation of JPEGs
« Reply #4 on: 2013 August 02 08:54:48 »
but there's a trick for rotating jpegs without decoding them... that's probably what the OP is asking about.

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: Lossless rotation of JPEGs
« Reply #5 on: 2013 August 02 08:56:40 »
I think it is possible to rotate jpg without decoding it first -some tricks with rotating the coefficients. See http://graphicssoft.about.com/cs/digitalimaging/f/rotatequality.htm
Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: Lossless rotation of JPEGs
« Reply #6 on: 2013 August 02 10:45:34 »
Another educational day on the PI forums :)
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: Lossless rotation of JPEGs
« Reply #7 on: 2013 August 02 12:31:05 »
Yes, it should be possible... at least, rotating the 8x8 blocks is easy. The problem arises with the coefficients inside the block. A 90º rotation is also a 90º rotation in the frequency domain (fourier, or dct), so that is not hard. But, I'm not sure that the lossy compression always keeps "simetrical" coefficients, or it has a prefered direction. I would say that some of them, after the rotation, will fall on ignored positions, so at the end we'll have either loss of data, or/and artificial coefficients (= zero?).

Please correct me if I'm wrong.
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline herman

  • Newcomer
  • Posts: 19
Re: Lossless rotation of JPEGs
« Reply #8 on: 2013 August 02 20:36:09 »
but there's a trick for rotating jpegs without decoding them... that's probably what the OP is asking about.

Yes, that is what I am asking about.