您的位置:首页 > 移动开发 > IOS开发

iOS  将图像数据转换成…

2013-09-22 14:24 295 查看
#import


 

@interface
NSImage
(ESSImageCategory)


- (
NSData

*)
JPEGRepresentation
;


- (
NSData

*)
JPEG2000Representation
;


- (
NSData

*)
PNGRepresentation
;


- (
NSData

*)
GIFRepresentation
;


- (
NSData

*)
BMPRepresentation
;


@end


 

//===================================


//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

*)JPEG
2
0
0
0
Representation


{


  
return

[
self

representationForFileType
:

NSJPEG2000FileType
]; 


}


 

- (
NSData

*)GIFRepresentation


{


  
return

[
self

representationForFileType
:

NSGIFFileType
]; 


}


 

- (
NSData

*)BMPRepresentation


{


  
return

[
self

representationForFileType
:

NSBMPFileType
];   


}


 

@end


 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: