Cocoa in the Shell

New category for NYXImagesUtilities : Saving

I’ve added a new category for NYXImagesUtilities, it allows to save an UIImage object to a file path or URL. Several formats are supported :

  • BMP
  • GIF
  • JPEG
  • PNG
  • TIFF

If you want to use this category you must link with ImageIO.framework and MobileCoreServices.framework.

[myImage saveToURL:url type:NYXImageTypeJPEG backgroundFillColor:nil];

[myImage saveToPath:path type:NYXImageTypeTIFF backgroundFillColor:[UIColor yellowColor]];

If your image contains transparent zone and you save it in a format that doesn’t support alpha, like JPEG a fill color will be used, if you don’t specify one, the default color will be white.

There is also two other methods which take only the path or URL as parameter and save the image in PNG, because it’s the preferred format for iOS.

Project on github.

Tags: , ,