• 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: resize image with cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: resize image with cocoa


  • Subject: Re: resize image with cocoa
  • From: Francesca P <email@hidden>
  • Date: Mon, 5 Dec 2005 16:58:45 +0100


Il giorno 05/dic/05, alle ore 15:34, Brian Ganninger ha scritto:

A more thorough answer then scaling and setting sizes like this is investigate the power of NSAffineTransform, which will allow you to rotate, scale, and otherwise transform the image (not every single transform ever, but a fair chunk of the basics.) This will give you finer grain control over how it behaves (if you so desire).

As to saving, you simply need to use NSFileManager.

// typed in Mail
NSImage *imageToSave = [NSImage imageNamed:@"FooBar"]; // gives us an image from app's bundle

// you should provide your own path, making sure all components exist except the file itself
if([[NSFileManager defaultManager] createFileAtPath:@"/ FolderToSaveInto/OurNewImage.tiff"
contents:[imageToSave TIFFRepresentation]
attributes:nil])
{
NSLog(@"we have file save");
}

// you can define your own attribute dictionary or send nil to use the default
// TIFFRepresentation was used as it provides NSData for easy file writing, and would likely have the best fidelity
// untested - but I believe it should work... note that you should save as a supported format of NSImage,
// or just straight use the same format as it came in as

Hope that helps.



uhm,
I'm trying,
but can I save as JPEG image??

Thanks
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: resize image with cocoa
      • From: Francesca P <email@hidden>
    • Re: resize image with cocoa
      • From: "I. Savant" <email@hidden>
References: 
 >Re: resize image with cocoa (From: Sergei Borodavkin <email@hidden>)
 >Re: resize image with cocoa (From: Francesca P <email@hidden>)

  • Prev by Date: Re: Thread safety of Cocoa Bindings
  • Next by Date: Re: resize image with cocoa
  • Previous by thread: Re: resize image with cocoa
  • Next by thread: Re: resize image with cocoa
  • Index(es):
    • Date
    • Thread