0

My application download JPEG image from server as NSData, check for other params (in json response) and if that image should be rotated according to some flag, I need to rotate image and store it to file for later use.

I would like to rotate image's data directly without compressing already JPEG image again before saving (download, decompress, rotate, compress using UIImageJPEGRepresentation or UIImagePNGRepresentation). Is there a way how to accomplish rotation of JPEG image without recompression on iOS?

Josef Rysanek
  • 377
  • 3
  • 12

1 Answers1

0

It is possible to do with code. The commercial web site explains some of the problems with the process

http://www.betterjpeg.com/lossless-rotation.htm

The LibJpeg library contains utilities to do this. You could extract the source.

It's not a trivial process but it is doable, unlike with most other compressed image formats.

user3344003
  • 20,574
  • 3
  • 26
  • 62
  • I know about better jpeg but it will be pain to keep it up to date with iOS application. Maybe this worth trying https://github.com/ashtons/libtiff-ios – Josef Rysanek Sep 08 '14 at 20:30