How to merge two NSImage to one

I have to merge to pictures as NSImage to one with Swift 4 code

Where can I find an example or code ?

When you say merge, do you mean side by side ? Or one over the other ?

Side by side.


Not only, I would like to use the same function to create a matrix of NSImage (MAC OS X app, not iOS app).


I am looking a way to create a page of images icons in X rows and Y columns (like a matrix) , but at the moment I do not have any idea from where to start (Swift beginner....)


Any help is gold for me...

So, you want to draw it, not save in, a new image ?


Let's assume you want to draw 2 images side by side.


1st solution:

- in the view, create 2 UIImageView and connect to outlets

- load the outlets image with the 2 images you want to insert.


2nd solution :

- declare the view where you want to draw as a subclass of UIView

- in its draw() function, draw all the images where you want with a call to draw(at:)

See here how to set the graphics context for doing so

h ttps://stackoverflow.com/questions/39950125/how-do-i-draw-on-an-image-in-swift

I am looking a way to create a page of images icons in X rows and Y columns (like a matrix) …

It sounds like an NSCollectionView would be a good match here, using NSImageView for the cells.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
How to merge two NSImage to one
 
 
Q