I decided to do something with ImageMagick for my 5th day’s script. My original idea for day 5 proved to be too much for one night. A script to cut triangular corners into images. Pretty simple, but this may come in handy one day while designing something.
The horizontal and vertical depths of the cuts can be defined independently. As it stands right now all four corner share the same cut depths, but I could change that at some point in the future. It wouldn’t be hard. Basically all it does is draw triangular masks, then composites them against the source image’s alpha channel in Darken mode (so we can also work directly on PNGs). It doesn’t do any background settings, so if you need a matte color behind the cuts, you’ll need to do some fairly simple processing after this is done.
Now for some examples.
This is the source image used for these examples:
(With horizontal and vertical being the same.)
./sd1.sh corner-cut StarCirno200.jpg StarCirnoTest7.png 7
./sd1.sh corner-cut StarCirno200.jpg StarCirnoTest60.png 60
(With horizontal and vertical depth defined.)
./sd1.sh corner-cut StarCirno200.jpg StarCirnoTest60-20.png 60 20
As with the rest of these “a script a day” projects, the code is available in the repo.
Interested in a script that does rounded corners? I wrote one of those a while ago. http://rrbits.com/epb/2012/06/06/rounded-corner-script/