Jump to content
You must now use your email address to sign in [click for more info] ×

How to automate recoloring and exporting of the same image for 200 colors?


Recommended Posts

I have an image where I want to recolor a specific object to specific values and then export said image. Now, I would need to do this for around 200 different colors (with the same image) and I am looking for ways to automate this.

From what I've found, macros would be one option but they don't allow parameterized inputs and I did not find a way to edit the macro file itself to duplicate the file and edit the values in there instead. Sadly, Affinity doesn't offer any Python or JSON API.

So, I am at my (inexperienced) wits end and wanted to ask if there are other options I could pursue?

Thanks!

Link to comment
Share on other sites

I can’t imagine this can be done in any Affinity app currently.

i would probably try to export as SVG and use any suitable script languages or text editor to change the color codes in a fixed place of that file and save the modified copy of the file under the name of the color.

You may create a vector layer and suitable blend mode (like color).

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

My posts focus on technical aspects and leave out most of social grease like „maybe“, „in my opinion“, „I might be wrong“ etc. just add copy/paste all these softeners from this signature to make reading more comfortable for you. Otherwise I’m a fine person which respects you and everyone and wants to be respected.

 

Link to comment
Share on other sites

6 minutes ago, NotMyFault said:

I can’t imagine this can be done in any Affinity app currently.

Neither can I

My tuppence worth

Hard to say without knowing the construction of your image and what output format you need
If the specific object is a vector shape then you could export as svg and use scripting to change colours and write new svgs
If it's a raster image and you want to recolour a region then you could try imagemagick with connected-components

Microsoft Windows 11 Home, Intel i7-1360P 2.20 GHz, 32 GB RAM, 1TB SSD, Intel Iris Xe
Affinity Photo - 24/05/20, Affinity Publisher - 06/12/20, KTM Superduke - 27/09/10

Link to comment
Share on other sites

If the image area to colourize is the same for each of the 200 wanted results and varies in the colour value only you might try APub's Data Merge to load the colour from a data source, possibly as image masked in APub by the wanted pixel selection.

compare:

https://excelkid.com/fill-cell-with-rgb-color/

and

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

Link to comment
Share on other sites

Another approach, without Data Merge but Macro: Create a layer (e.g. image) which contains 200 fields each with a wanted colour. Place this below the mask of the area to colourize. Use Macro to move this layer step by step to its next colour field. Save the current result … and repeat move + save.

Bildschirmfoto2024-04-13um22_29_45.thumb.jpg.fb369475a2a0fc4a63c0a50601640c72.jpg

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

Link to comment
Share on other sites

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.