Re: TXT Records with NSImages
Re: TXT Records with NSImages
- Subject: Re: TXT Records with NSImages
- From: Marcel Weiher <email@hidden>
- Date: Thu, 30 Apr 2009 19:06:55 -0700
Not sure this was solved.
On 13.Mar, 2009, at 5:45 , Joe Turner wrote:
NSImage *original = [NSImage imageNamed:NSImageNameComputer];
[original setSize:NSMakeSize(10.0f, 10.0f)];
-> this will not make your bitmap 10x10 pixels, but just change the
DPI settings to make sure it is seen as 10x10 points in size. So it
might be the reason you are running into size restrictions, if your
original image is large (in terms of pixels).
NSData *image = [original TIFFRepresentation];
NSBitmapImageRep *imageRep = [NSBitmapImageRep
imageRepWithData:image];
NSData *finalData = [imageRep
representationUsingType:NSPNGFileType properties:nil];
NSDictionary *txtRecord = [NSDictionary
dictionaryWithObject:finalData forKey:@"image"];
NSData *data = [NSNetService dataFromTXTRecordDictionary:txtRecord];
if (data)
NSLog(@"Data is not nil!");
[netService setTXTRecordData:data];
_______________________________________________
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