• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to write ipeg image created with CGImageRef?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: How to write ipeg image created with CGImageRef?
      • From: Scott Thompson <email@hidden>
  • Prev by Date: NSCondition (unlocked when not locked)
  • Next by Date: Cocoa Frontend to SDL App
  • Previous by thread: Re: NSCondition (unlocked when not locked)
  • Next by thread: Re: How to write ipeg image created with CGImageRef?
  • Index(es):
    • Date
    • Thread