Questions tagged [nsimage]

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

681 questions
5
votes
1 answer

Resize CGImageRef without anti-liasing

I am trying to resize a 10x10 pixel CGImageRef, captured like this: CGImageRef imageRef = CGImageCreateWithImageInRect(screenShot, CGRectMake(mouseLoc.x-5, screen_height-mouseLoc.y-5, 10, 10)); CGContextRef mainViewContentContext =…
Marek
  • 83
  • 1
  • 4
5
votes
1 answer

Set a system image to NSImageView programatically in Swift

You can set a system image(SF Symbol) in UIKit with UIImage(systemName: "pencil"). For macOS apps you can set a system image in storyboard. However, I couldn't find a way to set a system image for macOS programatically. So is this possible, or is…
unknown
  • 788
  • 9
  • 24
5
votes
7 answers

Resize and Save NSImage?

I have an NSImageView which I get an image for from an NSOpenPanel. That works great. Now, how can I take that NSImage, half its size and save it as the same format in the same directory as the original as well? If you can help at all with anything…
Josh Kahane
  • 16,765
  • 45
  • 140
  • 253
5
votes
3 answers

Cocoa - Fade between two NSImage's?

I have a menu with an NSImage showing some information, and when it gets updated I would like the new (updated) image to fade in. I know it is easy on the iPhone, but is this possible in OS X ?
Nippysaurus
  • 20,110
  • 21
  • 77
  • 129
5
votes
2 answers

Easiest way to draw an NSImage dimmed out (like a disabled view)

If I'm not really fussy about the exact tone etc of the dimmed image, is there a quick and dirty way to draw an NSImage slightly dimmed, like this? I've searched online and can't really find what I'm looking for (but I'm not very good when it comes…
d11wtq
  • 34,788
  • 19
  • 120
  • 195
5
votes
1 answer

Mac OS Xcode Swift 2.2 Combine 2 or more NS images into a one new NSImage

I am looking for example code how to merge NSImages into one new NSImage for Mac OS (not Iphone IOS). Thx
FJC
  • 213
  • 2
  • 9
5
votes
1 answer

NSImage drawInRect and NSView cacheDisplayInRect memory retained

Application that I am working process images. It's like user drops at max 4 images and app layout them based on user's selected template. One image might be added 2-3 times in final view. Each image in layout is drawn in NSView (drawRect method of…
M P
  • 352
  • 3
  • 14
5
votes
0 answers

I would like to convert an NSImage into an mp4

Adam Jensen has done a fantastic job @ crafting some swift code to convert an image into a mov. https://gist.github.com/acj/6ae90aa1ebb8cad6b47b The above works great, but I would like to do the job with device with slightly more CPU and some real…
user3069232
  • 8,587
  • 7
  • 46
  • 87
5
votes
2 answers

NSImage - can't load image from file

I program command-line application that will load image from Supporting Files. Image is copied in Supporting Files, but when I use following code, variable imgC returns nil. NSString* pathC = @"galaxy.jpg"; NSImage* imgC = [NSImage imageNamed:…
jrck
  • 119
  • 1
  • 2
  • 6
5
votes
0 answers

Image size of image in an NSButton

I'm trying to add an image to an NSButton. No matter what dimensions I make the image it is being cropped (see the button to the left in the screenshot). This is a simple NSRoundedBezelStyle NSButton. In this case my image is 15x15 and the button…
RobertJoseph
  • 7,968
  • 12
  • 68
  • 113
5
votes
1 answer

NSImage drawInRect and TemplateImages

In have an NSImage is a template image (that is, [NSImage isTemplate] returns YES). When I use it inside an NSImageView, it is drawn correctly as a template image. However, if I draw it manually using drawInRect:fromRect:operation:fraction:, it is…
TheNextman
  • 12,428
  • 2
  • 36
  • 75
5
votes
1 answer

Image resizing on retina device

I'm developing an app for Mac OS X. I'm trying to resize any NSImage into a specific size like 200x300. It is working fine for Non-retina Mac. But For Retina Mac, it is resizing the image as 400x600 which is just double, as we expected. My project…
iPhoneDv
  • 1,969
  • 1
  • 19
  • 34
5
votes
3 answers

Cocoa, objective-c how to resize a png image?

I'm new to cocoa and what I'm trying to do is resize a NSImage, but it looks like I'm doing something wrong as my image's don't get resized. I had a look at the other questions and this approach looked like it should work: -…
Rokas
  • 57
  • 1
  • 5
5
votes
2 answers

Cocoa draw text on NSImage

I have an NSSegmentedControl(todayButton) that contains an image. I'm trying to draw some text onto the image using the following: NSImage *img = [todayButton imageForSegment:0] [img lockFocus] [@"15" drawAtPoint:NSZeroPoint…
Firenze
  • 308
  • 1
  • 9
5
votes
1 answer

Mac app not using retina @2x image files

I am trying to update my app to support retina displays but when it runs on a Retina MacBook Pro the @2x versions of the images aren't being used. Below are the methods I'm using in my app to set the image views. In the XML parser class: [[self…
wigging
  • 8,492
  • 12
  • 75
  • 117