Questions tagged [nsimage]

on Mac OS X, an NSImage object is a high-level class for manipulating image data

681 questions
4
votes
1 answer

Creating NSImage from CGImageRef causes image pixel size to double

capture is a CGImageRef returned from a call to CGWindowListCreateImage(). When I try to turn it into an NSImage directly via initWithCGImage:size: it mysteriously doubles in size. If I instead manually create an NSBitmapImageRep from capture and…
jaz303
  • 1,136
  • 9
  • 11
4
votes
2 answers

NSImage initWithContentsOfURL missing alpha channel when loading TIFFs

In my app I use initWithContentsOfURL to load various types of image (JPEG, TIFF, PNG, GIF, etc) into an image, and then into an OpenGL texture. The only type that loads an image with an alpha channel is png. (in the list above, only PNG and TIFF…
Duncan C
  • 128,072
  • 22
  • 173
  • 272
4
votes
1 answer

NSImage from website URL

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
nosedive25
  • 2,477
  • 5
  • 30
  • 45
4
votes
1 answer

Obj-C factory method not exposed to Swift subclasses

More specifically imageNamed does not get exposed to Swift subclasses of NSImage even when all other convenience inits are inherited. According to Apple's docs Objective-C factory methods "get mapped as convenience initializers in…
Teo Sartori
  • 1,082
  • 14
  • 24
4
votes
2 answers

Adding blur to an NSImage using Swift

I'm searching for a way to add a blur effect to a NSImage using Swift. developing for iOS, UIImage provides a method like applyLightEffectAtFrame:frame ... but i could not find something equal for Cocoa/an OSX-App. edit 1: i tried to use…
ixany
  • 5,433
  • 9
  • 41
  • 65
4
votes
3 answers

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…
Ricky
  • 309
  • 1
  • 5
  • 13
4
votes
2 answers

How to overlap (superimpose) an image over a file icon using Cocoa?

I have to make a prototype application where I superimpose a small image over the file icons of a given folder. Let's say I have a folder /MyDocuments/ and there are three files /MyDocuments/Doc1.rtf /MyDocuments/Doc1.pdf and…
Ashish
  • 3,028
  • 5
  • 28
  • 35
4
votes
1 answer

Creating an image badge with Cocoa/OSX

I need to create an image badge in Cocoa. Basically I need to take two images one smaller then the other and overlay the smaller image over the larger image with a certain offset. Does Cocoa provide any utility to make this sort of thing easier?
Mike2012
  • 7,629
  • 15
  • 84
  • 135
4
votes
3 answers

Draw standard NSImage inverted (white instead of black)

I'm trying to draw a standard NSImage in white instead of black. The following works fine for drawing the image in black in the current NSGraphicsContext: NSImage* image = [NSImage imageNamed:NSImageNameEnterFullScreenTemplate]; [image drawInRect:r…
smartgo
  • 160
  • 2
  • 6
4
votes
1 answer

Replacing one colour with another in an NSImage

I have an NSImage and want to replace one color in it with another (e.g. replace all the blue with a green colour) Is there an easy way to do this and if not, how could I get this functionality?
Amy
  • 41
  • 1
4
votes
2 answers

drawRect not drawing NSImage

I have a custom NSView .h-file #import @interface CustomView : NSView @property BOOL shallDraw; - (void) setTheShallDraw:(BOOL)draw; @end .m-file #import "CustomView.h" @implementation CustomView - (id)…
4
votes
2 answers

Create Image programmatically in Objective-C

I want to know is it is possible to create a blank image programmatically in Objective-C (Mac osx)? My requirement is I want to create a watermark, so one source image is there.. But i need to create an another image and add some text to that image…
Jio
  • 1,146
  • 1
  • 9
  • 22
4
votes
2 answers

Getting a CGIImageRef from an NSImage in Cocoa on Mac OS X

I need to get a CGIImageRef from an NSImage. Is there an easy way to do this in Cocoa for Mac OS X?
Mike2012
  • 7,629
  • 15
  • 84
  • 135
4
votes
0 answers

CALayer NSImage contents not choosing correct representation

I am setting NSImages to the contents of several CALayers. All of these images have 4 reps, 1x, 2x, 5x and 10x. 3 of these images scale seemingly fine when I set the contentsScale when my view changes it's backingScaleFactor but one of them seems to…
Alex Zielenski
  • 3,591
  • 1
  • 26
  • 44
4
votes
1 answer

How to get suitable CGImage from combined TIFF for display scale

I have two PNGs in a Mac project. Normal and @2x. Xcode combines these into a single TIFF with the @2x being at index 0 and the @1x at index 1. What is the suggested approach to get the appropriate image as CGImageRef version (for use with Quartz)…
Cocoanetics
  • 8,171
  • 2
  • 30
  • 57