XuCxSxMk Posted April 13, 2024 Posted April 13, 2024 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! Quote
NotMyFault Posted April 13, 2024 Posted April 13, 2024 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). David in Яuislip 1 Quote Mac mini M1 A2348 | MBP M3 Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080 LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K 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. I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.
David in Яuislip Posted April 13, 2024 Posted April 13, 2024 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 Quote 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
thomaso Posted April 13, 2024 Posted April 13, 2024 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 Quote • MacBookPro Retina 15" | macOS 10.14.6 | Eizo 27" | Affinity V1 • iPad 10.Gen. | iOS 18.5. | Affinity V2.6
thomaso Posted April 13, 2024 Posted April 13, 2024 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. firstdefence 1 Quote • MacBookPro Retina 15" | macOS 10.14.6 | Eizo 27" | Affinity V1 • iPad 10.Gen. | iOS 18.5. | Affinity V2.6
Recommended Posts
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.