• 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
Re: TXT Records with NSImages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: question about mutable vs. non-mutable
  • Next by Date: Re: Repositioning the Field Editor [solved]
  • Previous by thread: Re: question about mutable vs. non-mutable
  • Next by thread: Modifying NSTableView cell data just prior to invoking field editor
  • Index(es):
    • Date
    • Thread