How to write ipeg image created with CGImageRef?
How to write ipeg image created with CGImageRef?
- Subject: How to write ipeg image created with CGImageRef?
- From: norio ota <email@hidden>
- Date: Fri, 10 Jul 2009 22:42:34 +0900
Hi,
I'm trying to save an NSBitmapImageRep initialized with -
initWithCGImage: onto a disk.
But the image of the saved file is bad. This means only black and
white horizontal lines are drawn meaninglessly.
The _rep in the below code is the NSBitmapImageRep instance allocated
and initialized with -initWithCGImage: as I said at the beginning,
and the image rep has alpha.
- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError
{
NSDictionary* properties = [NSDictionary
dictionaryWithObjectsAndKeys:
[NSNumber
numberWithFloat:0.7], NSImageCompressionFactor,
[NSNumber
numberWithBool:YES], NSImageProgressive, nil];
NSData* result = [_rep representationUsingType:NSJPEGFileType
properties:properties];
return result;
}
The NSBitmapImageRep is logged like the following:
0x15ce70 Size={400, 264} ColorSpace=NSCalibratedRGBColorSpace BPS=8
BPP=32 Pixels=400x264 Alpha=YES Planar=NO Format=2
Would you tell me what I'm missing?
Thank you for reading this message.
Norio
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden