ESSImageCategory
Language: Objective-C, Author: Matthias Gansrigler
License: Public domain
This will make it possible for you not only to get a TIFFRepresentation, but also JPEGRepresentation, JPEG2000Representation, PNGRepresentation, GIFRepresentation, BMPRepresentation.
ESSImageCategory source preview
// // ESSImageCategory.m // // Created by Matthias Gansrigler on 1/24/07. // Copyright 2007 Eternal Storms Software. All rights reserved. // #import "ESSImageCategory.h" @implementation NSImage (ESSImageCategory) - (NSData* )representationForFileType: (NSBitmapImageFileType) fileType { NSData *temp = [self TIFFRepresentation]; NSBitmapImageRep *bitmap = [NSBitmapImageRep imageRepWithData:temp]; NSData *imgData = [bitmap representationUsingType:fileType properties:nil]; return imgData; } - (NSData *)JPEGRepresentation { return [self representationForFileType: NSJPEGFileType]; } - (NSData *)PNGRepresentation { return [self representationForFileType: NSPNGFileType]; } - (NSData *)JPEG2000Representation { return [self representationForFileType: NSJPEG2000FileType]; } - (NSData *)GIFRepresentation { return [self representationForFileType: NSGIFFileType]; } - (NSData *)BMPRepresentation { return [self representationForFileType: NSBMPFileType]; } @end
ESSImageCategory header preview
// // ESSImageCategory.h // // Created by Matthias Gansrigler on 1/24/07. // Copyright 2007 Eternal Storms Software. All rights reserved. // #import <Cocoa/Cocoa.h> @interface NSImage (ESSImageCategory) - (NSData *)JPEGRepresentation; - (NSData *)JPEG2000Representation; - (NSData *)PNGRepresentation; - (NSData *)GIFRepresentation; - (NSData *)BMPRepresentation; @endDownload Archive
Compatible with:
- Mac OS X 10.4 PPC
- Mac OS X 10.4 Intel
- Mac OS X 10.5 PPC
- Mac OS X 10.5 Intel
Comments
Comment feed
