Creating Embroidered Charts with R and ImageMagick

(aman.bh)

78 points | by speckx 5 days ago ago

5 comments

  • behnamoh 14 hours ago ago

    Related: Does anyone know how we can have monochrome plots that look like the ones you see in old books? They were gorgeous, especially with how creative they had to be in an era that had no UNICODE characters. The ink would also leak and often the lines were rounded and spread out a bit.

    I was able to get close: https://imgur.com/a/zLiYlnG

    • amnbh 13 hours ago ago

      OP of the article here, this looks cool!

      Since you're looking at print for reference, it is usually very difficult to get the same imperfections with our nice, optimized-for-clarity digital tools. You already have a nice base layer, which with some similar post-processing can get you what you want. I find it helpful to look at the reference you have in mind and then work backwards from it layer by layer. For example, you can zoom into risograph prints to look at the textures or look at how people recreate print misregistration/ink offset in Photoshop to start with and then try to translate it into code (or just Photoshop if you like!). I gave it a quick shot but more can be done: https://i.ibb.co/QvZvjNpf/output.png

      magick input.png \ \( +clone -blur 0x0.6 -roll +1+1 -level 60%,100% \) -compose Darken -composite \ -level 48%,55% \ \( +clone +level-colors grey50 -attenuate 3.5 +noise Gaussian -colorspace gray \ -alpha set -channel A -evaluate set 10% +channel \) \ -compose Hardlight -composite \ output.png

      • behnamoh 11 hours ago ago

        thanks for your comment, your version also looks very old-book-y!

        I'll try to work on it more. Something that I find tough is the balance between readability of text vs the "FakeBold effect".

  • 1a527dd5 9 hours ago ago

    I love ImageMagick. I've used it a few times to make a PDF look scanned.

    convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf

  • throwaway2046 15 hours ago ago

    That's quite an authentic looking effect! Using it for charts is definitely not the first thing that comes to mind, but it does make them more appealing in a way.