3

Has anyone had luck converting and using jpeg2000 on the ios? I am writing and inventory app and would love to go with a jpeg2000 file type if I can figure out how to get the phone to support it.

I have seen that there is a nice project for webp - https://github.com/carsonmcdonald/WebP-iOS-example - which seems like it would also work but I think the jpeg2000 results are even better.

Just trying to eval options. Thx in advance

nielsbot
  • 15,922
  • 4
  • 48
  • 73
Quotient
  • 3,925
  • 6
  • 31
  • 35

3 Answers3

3

We used JPEG 2000 for my last project (Spot.app)

I downloaded the official open-source JPEG 2000 codec source from here: http://www.openjpeg.org/index.php?menu=download

Build it into a static library and voila.

Here's some sample code I created: https://gist.github.com/1861465

nielsbot
  • 15,922
  • 4
  • 48
  • 73
  • iOS 5+ can create UIImage from JPEG 2000 data with [UIImage initWithData:...] – jjxtra Oct 25 '13 at 17:42
  • How did you build it into a static library? – jjxtra Nov 03 '13 at 01:54
  • In Xcode, create a new target within your project (Or a new project with a static library target). This will compile code into a static library that can be a dependency for other targets. – nielsbot Nov 03 '13 at 02:00
  • I mean, was it as simple as dropping the openjpeg files into this iOS project and getting no compile errors? – jjxtra Nov 03 '13 at 02:15
  • That's what I remember... But I didn't spend a ton of time on it either :) – nielsbot Nov 03 '13 at 02:48
1

Image IO has nice image conversion functions that eliminate the need for 3rd party code. See more here: How do I convert UIImage to J2K (JPEG2000) in iOS?

No need to bring in the JPEG 2000 project.

Community
  • 1
  • 1
jjxtra
  • 20,415
  • 16
  • 100
  • 140
0

iOS does have support for JPEG 2000, however even as of iOS 16, not all JPEG 2000 images are readable.

For example, images contained in biometric passports for Spain & Portugal are valid JPEG 2000 encoded images, but cannot be read by iOS.

If you look hard enough, there are various bits of code floating around on this topic but they are by now very outdated and incomplete.

I have managed to get libopenjp2 v2.5.0 compiled for iOS and provided sample code and a full step-by-step guide, which is available here:

https://github.com/jonathanellis/ios-jpeg2000

Jonathan Ellis
  • 5,221
  • 2
  • 36
  • 53