• 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: Tue, 6 Dec 2005 08:44:33 +0100


Have you tried this code example?
I'm using this code-snippet too for generating thumbnail images and this work for me.


Manfred

--
software by MABE
http://www.software-by-mabe.com





No,
I've tried it now again, but it doesn't constrain proportion of my image.
It makes an images 100x100 px, but not scale it...

:-(

this is my code, is it wrong???


NSData* sourceData = [immagineDaFile TIFFRepresentation];
float resizeWidth = 130.0;
float resizeHeight = 130.0;

NSImage *sourceImage = [[NSImage alloc] initWithData: sourceData];
NSImage *resizedImage = [[NSImage alloc] initWithSize: NSMakeSize (resizeWidth, resizeHeight)];

NSSize originalSize = [sourceImage size];

[resizedImage lockFocus];
[sourceImage drawInRect: NSMakeRect(0, 0, resizeWidth, resizeHeight) fromRect: NSMakeRect(0, 0, originalSize.width, originalSize.height) operation: NSCompositeSourceOver fraction: 1.0];
[resizedImage unlockFocus];
NSData *resizedData = [resizedImage TIFFRepresentation];

[resizedData writeToFile: pathanteprima2
atomically: YES];

[sourceImage release];
[resizedImage release];


_______________________________________________
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>
References: 
 >resize image with cocoa (From: Francesca P <email@hidden>)
 >Re: resize image with cocoa (From: Alexey Zakhlestin <email@hidden>)
 >Re: resize image with cocoa (From: Francesca P <email@hidden>)
 >Re: resize image with cocoa (From: Alexey Zakhlestin <email@hidden>)
 >Re: resize image with cocoa (From: Francesca P <email@hidden>)
 >Re: resize image with cocoa (From: Bergmann Manfred <email@hidden>)
 >Re: resize image with cocoa (From: Francesca P <email@hidden>)

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