Allow use of kicad-cli for KiKit present
The native kicad-cli now offers a way to render board images from the CLI . Since some users (including me) had some dependency issues with PcbDraw, this PR adds the option to use kicad-cli for board images by adding a --renderer switch to kikit present.
Kicad-cli is not perfect unfortunately, as there is no way currently to output appropriately sized images directly. As a workaround, this uses image magick to crop the images generated by KiCad.
Let me know if you're willing to upstream this and if there are any changes to make.
Hi! I have plans to revisit PCBDraw and actually use the rendering facilities in Kicad-cli. However, lately, I have struggled to find enough time to make larger changes to my tools. Overall, I would prefer fixing PcbDraw. However, given the circumstances, I think your solution is appropriate and I will be happy to merge the PR.
I see two minor problems we need to resolve in your PR:
- In my other projects, I run into the issue that locating the
kicad-clibinary might be challenging (especially on Windows). I usually end up with a function that tries a bunch of heuristics. But maybe there is a better way? - I would prefer not to depend on ImageMagick. I think that we do all the transformation you need with Python-native libraries that will install automatically with KiKit.
I also had issues installing pcbdraw with the latest version of kikit, due to the pcbnewtransition package, that is when I found @vroland fork implementing a new render engine. My OS is Windows and while the kicad-cli executable was found no problem, even with ImageMagick installed the code found a convert utility under Windows for converting FAT to NTFS volumes definitely not the convert needed.