Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a TIFF on the iPad

I am trying to create a TIFF image from a UIImage. I looked into Apple's docs but could not find any information.

Can anyone help me and explain how to create a TIFF image on an iPad?

like image 555
pa12 Avatar asked Jan 03 '12 15:01

pa12


2 Answers

It seems to me that ImageMagick is way overkill just to write tiffs. Why not build libtiff? iOS is supported from it, and is what most software packages use to write tiffs (including ImageMagick).

You can even use the libtiff.a file from the ImageMagick link above. Just install the lib and tiff headers into your project. EDIT:

Here is a nice tutorial showing you how to write a tiff once you have installed libtiff. The second part of the tutorial shows you how to control the compression.

like image 74
Jeshua Lacock Avatar answered Oct 10 '22 08:10

Jeshua Lacock


I feel like this answer is a little late, but in case someone else wants to know how to do this, I think you'll find the following will do the trick:

NSMutableData *mData = [NSMutableData dataWithCapacity:SOME_BIG_NUMBER];
CGImageDestinationRef myImageDest = CGImageDestinationCreateWithData((__bridge  CFMutableDataRef)(mData), kUTTypeTIFF, 1, NULL);
CGImageDestinationAddImage(myImageDest,image.CGImage, NULL);
CGImageDestinationFinalize(myImageDest);
CFRelease(myImageDest);

The mData will then hold NSData encoding of a TIFF file which you can then store to the disk, upload to a server, whatever...

You might need to include MobileCoreServices and ImageIO frameworks...

Paul

like image 31
Paul Cantrell Avatar answered Oct 10 '22 10:10

Paul Cantrell