How to create a TIFF on the iPad

后端 未结 4 1246
挽巷
挽巷 2020-12-19 10:48

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

4条回答
  •  暖寄归人
    2020-12-19 11:17

    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

提交回复
热议问题