{"id":569,"date":"2014-09-06T04:54:24","date_gmt":"2014-09-06T10:54:24","guid":{"rendered":"http:\/\/rrbits.com\/epb\/?p=569"},"modified":"2014-09-06T05:00:40","modified_gmt":"2014-09-06T11:00:40","slug":"a-script-a-day-corner-cut-day-0505","status":"publish","type":"post","link":"https:\/\/rrbits.com\/epb\/2014\/09\/06\/a-script-a-day-corner-cut-day-0505\/","title":{"rendered":"A Script A Day &#8211; Corner Cut &#8211; Day 05\/05"},"content":{"rendered":"<p>I decided to do something with ImageMagick for my 5th day&#8217;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.<\/p>\n<p><!--more--><\/p>\n<p>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.\u00a0 It wouldn&#8217;t be hard.\u00a0 Basically all it does is draw triangular masks, then composites them against the source image&#8217;s alpha channel in Darken mode (so we can also work directly on PNGs). It doesn&#8217;t do any background settings, so if you need a matte color behind the cuts, you&#8217;ll need to do some fairly simple processing after this is done.<\/p>\n<p>Now for some examples.<\/p>\n<p>This is the source image used for these examples:<\/p>\n<a href=\"https:\/\/rrbits.com\/epb\/files\/2014\/09\/StarCirno200.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-570\" src=\"https:\/\/rrbits.com\/epb\/files\/2014\/09\/StarCirno200.jpg\" alt=\"StarCirno200\" width=\"200\" height=\"113\" \/><\/a>\n<p>(With horizontal and vertical being the same.)<\/p>\n<pre>.\/sd1.sh corner-cut StarCirno200.jpg StarCirnoTest7.png 7<\/pre>\n<a href=\"https:\/\/rrbits.com\/epb\/files\/2014\/09\/StarCirnoTest7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-571\" src=\"https:\/\/rrbits.com\/epb\/files\/2014\/09\/StarCirnoTest7.png\" alt=\"StarCirnoTest7\" width=\"200\" height=\"113\" \/><\/a>\n<pre>.\/sd1.sh corner-cut StarCirno200.jpg StarCirnoTest60.png 60<\/pre>\n<a href=\"https:\/\/rrbits.com\/epb\/files\/2014\/09\/StarCirnoTest60.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-574\" src=\"https:\/\/rrbits.com\/epb\/files\/2014\/09\/StarCirnoTest60.png\" alt=\"StarCirnoTest60\" width=\"200\" height=\"113\" \/><\/a>\n<p>(With horizontal and vertical depth defined.)<\/p>\n<pre>.\/sd1.sh corner-cut StarCirno200.jpg StarCirnoTest60-20.png 60 20<\/pre>\n<a href=\"https:\/\/rrbits.com\/epb\/files\/2014\/09\/StarCirnoTest60-20.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-575\" src=\"https:\/\/rrbits.com\/epb\/files\/2014\/09\/StarCirnoTest60-20.png\" alt=\"StarCirnoTest60-20\" width=\"200\" height=\"113\" \/><\/a>\n<p>As with the rest of these &#8220;a script a day&#8221; projects, the code is available in the <a href=\"https:\/\/bitbucket.org\/epb9000\/script-a-day\/\">repo<\/a>.<\/p>\n<p>Interested in a script that does rounded corners? I wrote one of those a while ago. <a href=\"https:\/\/rrbits.com\/epb\/2012\/06\/06\/rounded-corner-script\/\">https:\/\/rrbits.com\/epb\/2012\/06\/06\/rounded-corner-script\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I decided to do something with ImageMagick for my 5th day&#8217;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.<\/p>\n","protected":false},"author":1,"featured_media":577,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42,3999],"tags":[4256,4243,4006,4257],"class_list":["post-569","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-programming","tag-bash","tag-image-manipulation","tag-imagemagick","tag-script-a-day"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/posts\/569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/comments?post=569"}],"version-history":[{"count":3,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/posts\/569\/revisions"}],"predecessor-version":[{"id":579,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/posts\/569\/revisions\/579"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/media\/577"}],"wp:attachment":[{"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/media?parent=569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/categories?post=569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rrbits.com\/epb\/wp-json\/wp\/v2\/tags?post=569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}