All Questions
384 questions
1
vote
0
answers
57
views
Converting [NSImage imageTypes] to UTType array
I am trying to use the new -[NSOpenPanel setAllowedContentTypes:] and looking for equivalent of -[NSOpenPanel setAllowedFileTypes:[NSImage imageTypes]].
Is this equivalent:
openPanel....
0
votes
0
answers
65
views
NSImage resizing 10bit image using CGContext
I have 10 bit image file (HEIC, AVIF) loaded using NSImage. When attempting to resize using CGContext I get following message multiple times
This method should not be called on the main thread as it ...
0
votes
0
answers
171
views
Convert white pixels to transparency in NSImage / Swift - how to improve?
I've been trying to find a good way to convert white pixels in an NSImage on the fly to transparent pixels. I've seen Swift examples for UIImage, but not NSImage. Below is what I've created (and ...
1
vote
1
answer
198
views
Huge NSImage memory leak
I'm trying to write a command line program to extract thumbnails from a large number of arbitrary images but am hitting what looks like a fundamental memory leak in NSImage.
Even with all the other ...
-1
votes
1
answer
339
views
Swift Cocoa - How to load system image "NSCaution" into NSImageView?
I'm trying to load the system image called NSCaution programmatically. I can easily load it with Interface Builder since it's one of the displayed options for NSImageView:
However, the following ...
-1
votes
1
answer
97
views
Looking for simple example to write text into a NSImage using Cocoa
NSImage *myNewIconImage=[[NSImage imageNamed:@"FanImage"] copy];
[myNewIconImage lockFocus];
[@"15" drawAtPoint:NSZeroPoint withAttributes:nil];
[myNewIconImage ...
0
votes
1
answer
594
views
Resizing NSImage producing Image of Incorrect size when saved to disk
I'm using the following code to Resize an NSimage
func resizeinbuilt(withSize targetSize: NSSize) -> NSImage? {
let frame = NSRect(x: 0, y: 0, width: targetSize.width, height: targetSize....
0
votes
0
answers
184
views
CGImageForProposedRect and CGImageRelease
When I load an NSImage with imageNamed, the OS owns the memory, but when I call CGImageForProposedRect, Apple says "This may be an existing CGImage if one is available. If not, a new CGImage is ...
0
votes
0
answers
410
views
NSImage does not Change for Light/Dark Appearances
I am developing a Mac Cocoa app. And I have a set of images to adopt for both light and dark modes.
I followed the instructions here: https://developer.apple.com/documentation/uikit/uiimage/...
0
votes
0
answers
219
views
NSCompositingOperation examples anywhere?
I'd like to explore some of the more obscure NSCompositingOperation options, like NSCompositingOperationColorDodge and NSCompositingOperationSoftLight and so forth, to find the right way to implement ...
0
votes
1
answer
153
views
How to prevent rendering artifacts in PDFKit/NSImage?
I'm trying to create a tool to rasterise vector images—stored in PDF files—on macOS, but the resulting images contain artifacts around the edges of some shapes. Preview.app, on the other hand, always ...
0
votes
1
answer
143
views
[NSImage window]: unrecognized selector sent to instance 0x7fbb246a9e10 in PyObjC
I'm trying to add an image to an NSPanel, by calling the .addSubvew_(image) method in Python, but I keep getting [NSImage window]: unrecognized selector sent to instance 0x7fbb246a9e10. I'm not sure, ...
1
vote
1
answer
1k
views
Converting an NSBitmapImageRep to NSImage
I'm flipping between NSImage and NSBitmapImageRep(because only NSBitmapImageRep lets me find-replace colors per-pixel, but only NSImages can be used in a NSImageView/NSImageCell's setImage). I know ...
0
votes
1
answer
110
views
In Swift or Objective-C, how to get a jpeg image's current compression factor?
Using Swift or Objective-C in a macOS application, I need some snippet to gather the current JPEG compression factor of an image file. Any help is greatly appreciated. Thanks
1
vote
1
answer
58
views
Add CATextLayer on Top of NSImageView
I'm trying to display text on top of an NSImage.I use the following code
let myTextLayer = CATextLayer()
myTextLayer.string = "My text"
...