• 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: Scaling an NSImage non-destructively
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Scaling an NSImage non-destructively


  • Subject: RE: Scaling an NSImage non-destructively
  • From: Keith Blount <email@hidden>
  • Date: Tue, 30 Nov 2004 00:00:49 -0800 (PST)
  • Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys

Again, sorry for replying to my own thread. I've been
trying to solve this problem, but it still has me
stumped. Brief recount: All I want to do is scale an
image in such a way that if I save it and restore it
using something like TIFFRepresentation, if I rescale
it again all the data from the original image is still
intact (ie. so that it is not resampled and doesn't
result in a blocky image in the image is scaled down
and then back up again). I thought that if I created a
scaled image rep, this wouldn't destroy the data in
the original image, like this:

[image setSize:s];
NSImage *newImage = [[NSImage alloc] initWithSize:s];
//[newImage setDataRetained:YES]; // makes no
difference
[newImage setScalesWhenResized:YES];
NSBitmapImageRep *rep = [[NSBitmapImageRep alloc]
initWithData:[image TIFFRepresentation]];
[newImage addRepresentation:rep];

But this doesn't work - when I display newImage it
returns to the original size of image. And if I try
saving newImage by locking focus on rep, the image is
resampled and looks horrible if scaled down and then
up. The problem seems to be with TIFFRepresentation -
this seems to resample the image. Is this right?

Many thanks in advance for any pointers, I seem to
have been struggling with this problem on and off for
months.
Keith




__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail
 _______________________________________________
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

  • Prev by Date: Value Binding to NSTextView subclass
  • Next by Date: Re: Value Binding to NSTextView subclass
  • Previous by thread: Scaling an NSImage non-destructively
  • Next by thread: Hex Edit controls
  • Index(es):
    • Date
    • Thread