Jump to content

Recommended Posts

Posted

I am new to Macros in Affinity while I am quite proficient with scripting in PaintShop Pro.

I am trying to make a Macro to fill in certain colors, based on a selection. Since I hope to apply this to different shapes, I cannot rely on a set pixel position. I can make a selection of the shape (or maybe another way) so that the Fill command would still apply even if the shape is different (and no, I cannot use the center since it might have a hole in the shape).

Is that possible in Macros?

Posted

Not understanding exactly what you want to do. Could you elaborate a bit more?

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Posted

For example, if I am recording a macro where I would click at position (300,300) to fill a selection, the next time I run it, I might be using a different size image or a different shape, so the (300,300) position is no longer inside the selection.

Here are two shapes that might be used: if I record a macro while creating the first one, Filling the selection at position 300,300, I would not be able to get the same result on the second shape (in the image, it is filled manually because the Macro tries to fill "in the hole")

image.png.c4910372cfb56d556d2af4bafd31b0cc.png

I know i can change the color in different ways (color overlay for example) but I am mostly exploring what Macros can and can't do. In some instances, I would need to fill with a pattern for example so a color overlay would not work. I am looking to see if there is a way, in a Macro, to find where a selection is, so the next step could be taken to match it.

Posted

It can help clarify your goal if you phrase what you want to achieve with the macro, rather than what you don't want  to achieve (e.g. 300,300). In your screenshot it could be all non-transparent pixels or a certain colour or colour range for instance…

Bildschirmfoto2024-12-23um12_37_23.jpg.47c7d9e10cefa64450e711e98b0e67dc.jpg

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1

Posted
3 hours ago, thomaso said:

It can help clarify your goal if you phrase what you want to achieve with the macro, rather than what you don't want  to achieve (e.g. 300,300). In your screenshot it could be all non-transparent pixels or a certain colour or colour range for instance…

From that, I can get a specific selection. That is great. Now, how do I get to fill that specific selection? For example, in this image, I have a selection of all contiguous pixels. How would I make sure I can fill only that selected area and not the rest in a Macro, since the next shape might be a star or a crescent instead of a filled square touching the little circles around?

image.png.bb476a07f7128a136da9a3010951c7c6.png  

I am mostly trying to figure out if a Macro can have a way to determine where a selection is "on its own".

Does that make more sense?

Posted
37 minutes ago, CaroleA said:

From that, I can get a specific selection. That is great. Now, how do I get to fill that specific selection?

If you have an active selection then Edit > Fill will only fill that active selection

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Posted
5 minutes ago, carl123 said:

f you have an active selection then Edit > Fill will only fill that active selection

Interesting command. I guess it could be used instead of the Fill tool.

I'll start with that and see if I can get a Macro to do all I am looking for.

Posted

Getting closer:

image.png.8e3946b31959bdd66b50069433d57e22.png

Now, I have an additional question. For this Macro, I am using images for patterns and displacement. If I am to share this Macro with someone else, I assume I would need to also share the same supplies. However, is the Macro using a "standard" location to retrieve those supplies? Where should they put them? Or should I do something specific when recording the Macro for someone else to be able to use it?

Posted
14 hours ago, CaroleA said:

Now, I have an additional question. For this Macro, I am using images for patterns and displacement. If I am to share this Macro with someone else, I assume I would need to also share the same supplies. However, is the Macro using a "standard" location to retrieve those supplies? Where should they put them? Or should I do something specific when recording the Macro for someone else to be able to use it?

Typically, a macro remembers (records) what it is working with, and will use that same thing when you replay. So, for example, if you do a Copy, and then a Paste, that macro will always Paste whatever it was you Copied when you made the recording. So it's really the Paste that gets recorded, and when replaying the macro later that same content will always be used.

I don't understand how you are "using images for patterns and displacement", so I'm not sure that answers your question. But I suspect that macros will not do what you want, unless you intend to produce one macro for each different image you want to use. If you do produce one macro per image, though, you wouldn't need to share anything beyond the macro itself, as it will be self-contained.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.3.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1

Posted
27 minutes ago, walt.farrell said:

I don't understand how you are "using images for patterns and displacement", so I'm not sure that answers your question. But I suspect that macros will not do what you want, unless you intend to produce one macro for each different image you want to use. If you do produce one macro per image, though, you wouldn't need to share anything beyond the macro itself, as it will be self-contained.

In the example I am working on, I use a particular pattern for the pink watermelon flesh, another "pattern" for the seeds, and a texture image for the displacement. For this Macro to do the same on your computer, I assume I have to include those patterns so you can have them on your computer. My question is, if I used an image that was located on my computer (path: D:\Affinity\Supplies), will the Macro look for that exact path to retrieve the supplies on your computer? If so, that will be problematic because your computer might not have the same path.

If that is the case, should I put the supplies as Assets on my computer first, record the Macro using the assets, and send you all the files, instructing you to save/import them as assets too? Will this allow the Macro to use the same supplies on your computer?

Posted
6 hours ago, CaroleA said:

In the example I am working on, I use a particular pattern for the pink watermelon flesh, another "pattern" for the seeds, and a texture image for the displacement. For this Macro to do the same on your computer, I assume I have to include those patterns so you can have them on your computer. My question is, if I used an image that was located on my computer (path: D:\Affinity\Supplies), will the Macro look for that exact path to retrieve the supplies on your computer? If so, that will be problematic because your computer might not have the same path.

If that is the case, should I put the supplies as Assets on my computer first, record the Macro using the assets, and send you all the files, instructing you to save/import them as assets too? Will this allow the Macro to use the same supplies on your computer?

Exactly how do you "use" those items?

We really need to know the exact steps you are using in your macro (exactly what UI actions you perform while recording it).

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.3.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1

Posted

I am not proficient with Affinity yet, so I might not be doing it the most effective way, but after lots of trials and errors, I created a pattern layer that I then clipped to a shape. I thought I had to include that pattern to share with the recipient, but as I tested on a different computer, even without those assets, the macro runs correctly and seems to include those patterns directly in it.

I also found that the process of "adding an image" to create a pattern is not recorded, but adding a layer pattern is.

Here is an example (you need to start with a rasterized shape on a blank background, about 1000 pixels wide).

I suspect this will work without sharing the assets, but I might be wrong. 

cass-Watermelon4.afmacro

Posted
7 hours ago, steday said:

It work !

You probably had a smaller shape to start with, but yeah, it looks reasonable. Thicker shapes/fonts would work better.

So it seems like the patterns used in the Macro are integrated with it and I don't need to share the assets separately.

Posted

@CaroleA FYI, here's what I got when running your macro. I started with a Pie shape in AP v2.5.7, then converted the pie to Curves and filled it with Black (still vector). The macro gave me the green and cream colored outline, but the pink flesh was pure white. Perhaps I did something wrong. Mac M4, Sequoia. 

 WatermelonMacro.thumb.jpg.9628d54b64226cbe874e000afaad6a0a.jpg

 

2024 MacBook Pro M4 Max, 48GB, 1TB SSD, Sequoia OS, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish, Wacom Intuos 4 PTK-640 graphics tablet

Posted
1 minute ago, Ldina said:

 FYI, here's what I got when running your macro. I started with a Pie shape in AP v2.5.7, then converted the pie to Curves and filled it with Black (still vector). The macro gave me the green and cream colored outline, but the pink flesh was pure white. Perhaps I did something wrong. Mac M4, Sequoia. 

Strange. It goes to a white layer but it should add the pink flesh as a pattern to be clipped to that shape. It added the displacement but didn't add the pattern layer apparently.

Could there be a difference how Mac and Window versions behave? It was created on Window 10.

Posted
1 minute ago, CaroleA said:

Could there be a difference how Mac and Window versions behave? It was created on Window 10.

Beats me! I don't have a PC or any experience with Affinity on Windows. Some folks here have both Mac and Windows systems and may be able to provide answers. 

 

2024 MacBook Pro M4 Max, 48GB, 1TB SSD, Sequoia OS, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish, Wacom Intuos 4 PTK-640 graphics tablet

Posted
20 minutes ago, steday said:

same steps and it seems to work.

Same steps that I used in my above post? If so, that's very interesting. Maybe I need to close and restart Affinity Photo after loading the macro.

2024 MacBook Pro M4 Max, 48GB, 1TB SSD, Sequoia OS, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish, Wacom Intuos 4 PTK-640 graphics tablet

Posted
4 hours ago, Ldina said:

I started with a Pie shape in AP v2.5.7, then converted the pie to Curves and filled it with Black (still vector).

I did not test this but I noted that @CaroleA said this above:

Quote

Here is an example (you need to start with a rasterized shape on a blank background, about 1000 pixels wide).

Maybe that's why you got different results?

All 3 1.10.8, & all 3 V2.6 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
A
ll 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Posted

I closed down AP and restarted it after adding the macro. I still get a white fill where the pink watermelon should be, as shown earlier. Just wanted to report back. Not sure why. M4 MBP, Sequoia.

2024 MacBook Pro M4 Max, 48GB, 1TB SSD, Sequoia OS, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish, Wacom Intuos 4 PTK-640 graphics tablet

Posted
1 minute ago, R C-R said:

Maybe that's why you got different results?

When I tested and found that a starting shape that was not rasterized already would yield a different SHAPE overall, but the colors/patterns were still correct.

Posted

Not a problem for me, since I don't plan on using this macro. I was mainly curious about how the macro was constructed. I just wanted to provide some feedback since you worked so hard on this. Did I do anything wrong?

1. Created a Pie vector shape.
2. Fill and Stroke set to Black.
3. Convert to Curves.
4. Select layer and run macro.

It didn't matter if I manually rasterized the Pie vector layer first or not. Same result with white fill. I'm on a MacBook Pro, M4, Sequoia. I have no idea what Mac or OS @steday is using. Could be Intel or Apple Silicon (M1/2/3/4) and a different OS version. Perhaps that's the difference. 

2024 MacBook Pro M4 Max, 48GB, 1TB SSD, Sequoia OS, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish, Wacom Intuos 4 PTK-640 graphics tablet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.