• 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
Scaling TIFFRepresentation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scaling TIFFRepresentation


  • Subject: Scaling TIFFRepresentation
  • From: Michael Briscoe <email@hidden>
  • Date: Wed, 15 May 2002 11:25:13 -0700

Hello All,

I'm trying to add an export feature to my program, and it seems to work, except for the scaling. At first I tried to scale the NSBitmapImageRep data directly by setting it's size; all that did was to change it's resolution (dpi). So then I created an NSImage using the NSBitmapImageRep data, and scaled that. According to my NSLog that appears to work, BUT the files are saved at the original screen size. I'm stumped!

Here's my code:

// saveTIFFFrame
-(void) saveTIFFFrame:(int)frameNo
{
NSBitmapImageRep *imageRep;
NSData *tiffData;
NSImage *screenImage;
NSString *filename;
BOOL success;
NSSize imageSize;
float imageScale;

imageScale = 0.25;
[self lockFocus];
imageRep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:[self frame]] autorelease];
[self unlockFocus];
if (imageRep) {
screenImage = [[[NSImage alloc] initWithData:[imageRep TIFFRepresentation]] autorelease];
imageSize = [screenImage size];
imageSize.width = imageSize.width * imageScale;
imageSize.height = imageSize.height * imageScale;
[screenImage setScalesWhenResized:YES];
[screenImage setSize:imageSize];
imageSize = [screenImage size];
NSLog(@"screenImage size = width:%f height:%f", imageSize.width, imageSize.height);
tiffData = [screenImage TIFFRepresentation];
filename = [[NSString stringWithFormat:@"%@ %d", qtPath, frameNo] stringByAppendingPathExtension:@"tiff"];
NSLog(@"filename = %@", filename);
success = [tiffData writeToFile:filename atomically:NO];
NSLog(@"saveTIFFFrame: success = %d", success);
}
}

Any help would be appreciated!


Best Regards,
Michael Briscoe
SkyRocket Multimedia
http://www.digitalfireworks.com/SkyRocket/index.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Scaling TIFFRepresentation
      • From: Nathan Day <email@hidden>
  • Prev by Date: Re: Newbie reference question
  • Next by Date: Re: Simple NSTableView Question - Newbie
  • Previous by thread: How to launch AppleScript routine?
  • Next by thread: Re: Scaling TIFFRepresentation
  • Index(es):
    • Date
    • Thread