I've been in the process of migrating from Windows 10 to Linux (Debian w/ Gnome) on all of my computers lately. I have plans on writing a more detailed post about my experience down the line, but wanted to cover one thing in particular as its own post.
I draw, and my program of choice for digital art has changed over time. I started with FireAlpaca, before a friend convinced me to purchase Clip Studio. It's a fantastic art program, and was comfortably my daily driver for years of art, through different styles and characters. It's packed with way more features than most people realize, and at least at the time, I got a copy for a very reasonable one-time $60 purchase.
The only downside is, it's not on Linux.
Now, I've heard mixed things about users running CSP through Wine or Proton or whatever. And I don't doubt it's possible to do something like that - but, using tools like that has always seemed like a compromise to me. Plus, Linux has it's own great drawing tool. Krita! Krita is a free, open source drawing and image manipulation program, and it's available on all platforms, so I was able to test the water while still on Windows. Overall, it's got it's differences - but I was able to adapt pretty quickly, and I'm sure over time I'll learn the muscle memory needed to use it more proficiently.
CSP can export .PSD files, and Krita can import them. So I figured I could just bring my library over and keep working on it. But there's two issues with that.
- Krita handles masking and layer groups differently, and isn't really compatible with how CSP does it. Imported files come out with weird inconsistencies.
- CSP has no mass export functionality, that I could find.
Krita (and other programs like Aseprite) expose themselves to the command line, and let you run commands to export files from their respective format to something more distributable, like PNG or JPEG. Because it's a command line program, you can easily script it to iterate over all the files in a folder, exporting them all. It's a really, really nice feature that, so far as I can tell, CSP doesn't have.
So, even if Krita didn't have the file format issues, I'd need to sit and manually export every file by hand. Ignoring the fact I alredy spend way too much time on my computer, and something like that wouldn't be doing my wrists any favors, it would just be tedious. I'm a programmer, surely there's some way to easily automate boring tasks on Windows.
That's when I was lucky enough to remember a program a friend had showed me, way back in middle school.
My friend used AutoHotKey to create macros and tools for playing games like Counter Strike. I'd also heard about it in Tom Scott's The Art of the Bodge video. And all these years later, it came back to help me.
AutoHotKey is general-purpose automation software for Windows. It can be scripted to do essentially anything the user of the pc can do, in response to all sorts of events (namely, key presses - for the original purpose of creating hotkeys). This means it can click windows, execute keystrokes, wait for windows to pop up, and everything else I would have to do by hand to export my library of art.
I started by doing a dry run, exporting a file as a human. I wanted to avoid mouse input entierly, and thankfully CSP responds to keyboard shortcuts well. A few keystrokes is all it took to get to the export menu, and since it exports to the same directory as the source image, I didn't need to worry about file name collisions.
AHK doesn't have to interact with your system through user inputs, though, and I was able to get it to iterate over all the files in a directory the user selects. That way I could point it at a folder, have it open a file in CSP by running it, and then go through the whole series of actions to export it.
There were a couple 'misfires', and I ended up needing to re-run it a few times. To avoid re-exporting files and needing to deal with the 'override' popup, I made it ignore anything that already existed with the target export name.
And after a few tests and failed runs... it worked! It took a while due to the delays added, but I was able to go for a walk and come back to all my files exported. I ended up choosing .PNG instead of .PSD as a format - really, I didn't need to edit these later on, just reference them. Thankfully, now that Krita is my tool of choice, this should be a lot easier next time around.
In case you're curious, or find yourself in a similar position to me, here's my script. It's janky and the timing might not work for you, but it should at least be a decent starting point to build off.
#Requires AutoHotkey v2.0.18+
; Replace with your initial directory
TargetFolder := DirSelect("C:\Users")
Loop Files , TargetFolder "\*.clip", "R" {
; Make sure file doesn't already exist
if FileExist(StrReplace(A_LoopFilePath, ".clip", ".png")) {
continue
}
; Open File
Run A_LoopFilePath
Sleep 500
Loop {
; Assuming CSP is focused, run the file export
; Select the 'export png' option
Send "{Alt}FRR{Right}{Down}{Down}{Enter}"
Sleep 250
; Wait for the save dialog to appear, then hit enter
if WinWaitActive("Export (Single Layer)", "", 1) {
break
}
}
Send "{Enter}"
Sleep 200
; Go through CSPs export menus
WinWaitActive "PNG export settings"
Send "{Enter}"
Sleep 1000
Send "{Enter}"
; Close document
Sleep 1000
Send "^w"
; Pause before opening the next one
Sleep 500
}