Loads an image from the given NSData of specified format(JPEG)
Previously I ask a question "How to convert data to JPEG Format?" and solution of this is:
NSImage * strImage = [[NSImage alloc]initWithContentsOfFile:imagePath] ;
NSData *imageData = [strImage TIFFRepresentation];
NSBitmapImageRep *imageRe开发者_JAVA百科p = [NSBitmapImageRep imageRepWithData:imageData];
NSNumber *compressionFactor = [NSNumber numberWithFloat:0.9];
NSDictionary *imageProps = [NSDictionary dictionaryWithObject:compressionFactor
forKey:NSImageCompressionFactor];
imageData = [imageRep representationUsingType:NSJPEGFileType properties:imageProps];
NSString * str = [imageData base64Encoding];
Now I have a question, how to convert this str again into imageData.
plz help me for this too.
I want same thing to do for which QImage loadFromData() do. I am giving link for help. http://doc.qt.nokia.com/4.6/qimage.html#loadFromData-2
If the jpeg is stored in an NSData
object:
NSImage* image = [[NSImage alloc] initWithData:jpegData];
精彩评论