nsimage

Emulating NSImage drawInRect:fromRect:operation:fraction with UIImage

I really need to emulate the behavior of NSImage's drawInRect:fromRect:operation:fraction using UIImage and I'm wondering what's the best approach or (better), if somebody already did this and willing to share the code. I tried doing this using CGImageCreateWithImageInRect (see code at the end) but I'm not getting the expected results. ...

Error saving NSImage as NSData

Hi there. I am using the following code to save a frame of a movie to my desktop: NSCIImageRep *imageRep = [NSCIImageRep imageRepWithCIImage:[CIImage imageWithCVImageBuffer:imageBuffer]]; NSImage *image = [[[NSImage alloc] initWithSize:[imageRep size]] autorelease]; [image addRepresentation:imageRep]; CVBufferRelease(imageBuffer); NSAr...

How to composite several NSImages into one big image?

I have a collection of objects which describe an image-name, its size and it's X/Y location. The collection is sorted by "layers", so I can composite the images in a sort of painter's algorithm. From this, I can determine the rectangle necessary to hold all of the images, so now what I want to do is: Create some sort of buffer to hol...

How do I add artwork to an iTunes track with obj-c AppScript?

aTrack is an ITReference* object, value is an NSImage* object, initialized via a URL to a jpeg. [[[[[aTrack artworks] data_] set] to:value] send]; I get the following message in GDB: 2010-03-09 16:59:42.860 Sandbox[2260:a0f] Can't pack object of class NSImage (unsupported type): <NSImage 0x10054a440 Size={0, 0} Reps=( I then tried ...

Trying to resize an NSImage which turns into NSData

I have an NSImage which I am trying to resize like so; NSImage *capturePreviewFill = [[NSImage alloc] initWithData:previewData]; NSSize newSize; newSize.height = 160; newSize.width = 120; [capturePreviewFill setScalesWhenResized:YES]; [capturePreviewFill setSize:newSize]; NSData *resizedPreviewData = [capturePreviewFill TIFFRepresentat...

Turning an NSImage* into a CGImageRef?

Is there an easy way to do this that works in 10.5? In 10.6 I can use nsImage CGImageForProposedRect: NULL context: NULL hints: NULL If I'm not using 1b black and white images (Like Group 4 TIFF), I can use bitmaps, but cgbitmaps seem to not like that setup... Is there a general way of doing this? I need to do this because I have an ...

NSImage from website URL

Hello, I need to create an NSImage from a url and then set it to an image view in my application. I tried some code I found online but it didn't work. If anyone knows how to do this any help would be great. Thanks ...

Load NSImage from url but only some url's work

I have some code that loads an image file off the web and puts it in an image view. The problem is it works with everything except Google Charts. This is frustrating because I was relying on this to graph data for my app. Heres the url I need to load: Click to see my test chart. Im not sure why NSImage seems to refuse to load this when i...

Where are the image files for the constants in NSImage located?

I'd like to get the image files for the constants definied in NSImage.h, like NSImageNameGoRightTemplate for example. I'd like to copy and edit some of them. Does anybody know where those images are located? I'm too stupid to find them on the drive... ...

Draw shadow under NSImage

Currently I'm drawing an NSImage in a custom NSCell like so: - (void)drawInteriorWithFrame:(NSRect)theCellFrame inView:(NSView *)theControlView { // roundedCornerImage creates a new NSImage with rounded corners, rather than clipping. [[anIcon roundedCornerImage:5] drawInRect:anIconBox fromRect:NSZeroRect operation:NSCompositeSou...

How to read PNG image to NSImage

Hi how can i read PNG image to NSImage. I tried the following way,but when i get the width and size of the image i'm getting some weird value.. if any one can direct me in right path.. highly appropriate.. NSImage * picture = [[NSImage alloc] initWithContentsOfFile: [bundleRoot stringByAppendingString:tString]]; NSLog(@"sixe %d %d...

How to use NSImage hitTestRect:withImageDestinationRect:context:hints:flipped: METHOD

I want to use Nsimage instance method hitTestRect:withImageDestinationRect:context:hints:flipped: in Iphone . But the problem is that NSimage is in Appkit framework and Appkit framework is not for Iphone development. Can anybody help me to solve this problem? ...

[Cocoa] NSImage transparency

I'm trying to set a custom drag icon for use in an NSTableView. Everything seems to work but I've run into a problem due to my inexperience with Quartz. - (NSImage *)dragImageForRowsWithIndexes:(NSIndexSet *)dragRows tableColumns:(NSArray *)tableColumns event:(NSEvent *)dragEvent offset:(NSPointPointer)dragImageOffset { NSImage *dragIm...

Best way of testing if an NSImage / CGImageRef is completely transparent

I have an image with tiles that I am splitting up and creating individual tiles with. However, these images typically contain completely blank areas (tiles in this case) that I wish to exclude. These areas are completely transparent. Now, how do I go about detecting them? Could read the tile pixel by pixel, by way of NSBitmapImageRep...

NSImage different size in code different shown by Finder/Preview

I have a couple of images that i use in my application(one of them is attached). The strange thing is that the real image size(shown by finder and preview) is 1200x701 px. When I access image from the code and as for its size, I get 360x210px. What is going on? Code I'm using to get the size of the image: NSImage *newImg = [[NSImage...

load particular .icns size

In my cocoa app, how can I load/scale my .icns file? In this case, I want to load up my 16x16 image. ...

How to save a NSImage as a new file

Hi! How can I save a NSImage as a new file (png, jpg, ...) in a certain directory? Thank you for answering my "noobish" question. ...

Zooming in on CIImage or NSImage?

Hi there. I am taking photos from a webcam in my Cocoa application and I would like to zoom in on the centre of the image I receive. I start by receiving a CIImage and eventually save an NSImage. How would I go about zooming in on either of these objects? I'd appreciate any advice. Thanks, Ricky. ...

Export/Import NSImage as ICO

Hi everyone, I would like to save and read an ICO file. It doesnt matter if its NSImage or NSBitmapImageRep or anything. It just needs to be done. How could this be accomplished? ...

How do I take a "screenshot" of an NSView?

I need to take the contents of an NSView and put them in an NSImage, for an experimental project. Is this possible? I did some Googling, tried two methods that I found - but they didn't really work. Any suggestions? ...