Syntax Video
How I used CODE to Create Paper Like Images
Transcript
what's up CJ here if you saw the recent video here on the channel about GitHub stars there was a particular style in that video where all of the images and logos looked like they were cut out and put on top of paper and in this video I'm going to talk about how I did that now the process actually started with physical paper because I'm not super familiar with like figma or photoshop and I wasn't super familiar with how I was going to actually achieve that effect and what I do know is how to use a printer so I actually printed out a logo I cut it out and tried to just see like does this look like what I want it to cuz I kind of had a vision in my head of what the video would look like with all these paper cutouts but I just didn't know um and so the physical copy was really good to have and then the next thing is now that I have this print out well I want to potentially use it in a video so I need to get it onto the computer somehow so I decided to scan it in and from there I also needed to remove the background because it was going to need to be overlaid with other elements uh and so I gave that a try and
it was right I I think the the paper aesthetic worked but it being printed and then scanned was just a little bit too low Fidelity and from there I was like all right I like this look but I want it to be a little bit more polished so let's try and recreate it inside of figma and initially I had no idea what I was doing and the first thing that I came across was this idea of textures for instance I could take some pictures of crumpled white paper and then apply that to a mask that's the shape of an image that I'd like to put onto paper or the shape of the background for a particular logo and then I could apply the paper mask onto it and then it would look like that shape was cut out of paper all right check that part was done from there the actual image that was going to be on the paper I wanted it to look like it was printed on the paper and this is also where textures come into play so I found a resource that had tons of paper textures but also noise textures and if you've ever seen this look that people have achieved in videos or sometimes even like in magazines a lot of times they're using noise to just
make it look a little bit grainier like make it look a little bit low Fidelity and it kind of replicates that effect of actually being printed onto paper and so this is also fairly simple to do inside of figma but it's a little bit cumbersome essentially like copy paste the thing you want to put this texture onto create a mask so now that the noise is the shape of the image and then position that mask right on top of the image and then from there you can change the blend mode and so this is also something you can do inside a figma essentially you can choose how the image above other images affects it and so by default there's no blending going on the image is just literally on top of the other image but when you choose a blend mode like multiply or lighten or darken or color Dodge that now takes the image that's on top and changes how it affects the image below it and the masking effect I found worked for the effect that I was trying to go for was called hard light it essentially just made it look a little bit grainier and it really gave it that effect of being printed on paper and so after all that trial and error I came up with a process for how I was going to create all of these assets and images for the video but there were a lot of assets I needed to create so
the video was covering 15 different Frameworks and for each one I was covering the news and releases that they did throughout the year and for each one I would have to create several different paper assets so I knew I was going to need to create a lot of assets but I didn't know exactly how many because I was editing linearly right so each framework I did one at a time and as I was working on it I would create the paper assets and then move on to the next framework but the video is already published so I did a tally now to see how many paper assets I created and there are 286 different assets of things on top of paper if you don't believe me go watch the video and count but it was a ton but I realized this pretty early on I didn't want to have to do this process inside of figma for every single image and I now know that there are 286 of them and so if every image took roughly 4 minutes to create and there are 286 of them that would have taken almost 19 hours just of asset creation and I tried to figure out better ways or like kind of like shortcuts in sight of figma and I I couldn't come up with any if you have any thoughts definitely throw them down in the comments but personally I am a
web developer and I thought I could Rec create this whole process I was doing inside of figma in the browser right like I can position images on top of each other I also learned that CSS has blend modes and the ability to use masking images so all these same things I was doing inside of figma I could actually recreate with code so I decided to give it a try so essentially my code layers the things in the same way that I would inside a figma so you have one layer that's the mask you then have the paper that is applied to that mask so it looks like it's cut out then you have the image sitting on top of it then you have another image with the noise applied with a blend mode to the image and that's positioned exactly on top of the other image now the other thing I was able to do by automating all of this was I was able to randomize it because one of the other aspects of this is I didn't want it to look the same for every single image right CU that would get a little bit redundant it would look less organic if you had the exact same paper cutouts and the tape in the exact same position and the exact same pieces of tape for every image so because I was already writing code I could randomize
it so I had a list of 10 different masks that you could choose from and 10 different types of paper and like five different pieces of tape and it would randomize it so whenever you load an image in it would choose a random mask choose a random paper choose a random place to put the tape But ultimately I got it working with code so the exact same flow that I was doing in figma could now happen in an instant I could point it at any image I could specify any text and it would instantly appear on top of paper and look like this effect that I was going for but there was one more thing I needed to figure out which is how do I now turn that into an image that I can use inside of a video now pretty much every web browser has a way of doing this essentially you can open the developer tools right click on the element you want to export as an image and choose take a screenshot or export and it will export that one specific image and then you can use it elsewhere so that worked but it also was a little bit cumbersome right because for every image I wanted to create I'd have to load it up open the dev tools and then export so now in order to actually automate this process of turning these things into screenshots I
needed to do some research and ultimately came across Puppeteer so Puppeteer is used for a a lot of different things it is a browser automation framework essentially you can write code that launches a web browser and then interacts with the web page and does various things like that but it supports the ability of taking screenshots of specific elements or an entire page and there's also a plugin for it called Puppeteer screen recorder so I could also have some animation so this is another aspect of the video if you look closely these paper images are just like wiggling slightly and so what I did is in the code I added a CSS animation that would wiggle the element and with Puppeteer I would visit the website and then record the screen as a transparent video and so now I have a video file that I can bring into Da Vinci resolve position it anywhere because it has that transparent background and it's just like a slightly wiggling image and so now I had my new automated process and as I was working on the video these were all just scripts that I could run from the command line and so for essentially every section of
the video I would go through and figure out all the assets that I needed then I would update the code to point to those images that I wanted to turn into paper images run the code it would just spit out a bunch of transparent videos and then I could just drag and drop those into my editor and so that's the process I use for the video that was published but now I want this process to be reusable by non-technical people and just other people on my team so Randy and Caitlyn both edit videos for the syntax Channel and sometimes they might want to achieve this paper effect for videos as well and so for that I created a desktop application I took all the work that I had done to create all of these scripts and wrapped it up into a nice user interface so now any non-technical user can launch the app drop an image in and specify all of the settings so you can flip between the different masks to use or the different paper backgrounds or where the tape should be positioned and so now you don't have to know how to code you can just launch this app and adjust all of the settings and then easily export and
use those images wherever you'd like and so this was the long process of just basically going from printed out paper to using an image editor to using code to automate it to then packaging it up and making it useful for the people on my team now this is something I've done a lot throughout my career and now I kind of just get to do as a job and so hopefully you enjoyed hearing my process and my journey of basically creating all of this stuff and hopefully it inspires you to go and create things because there's a lot of other things I do on the daily that I just decide to automate I I'll be making some videos on those tools that I create for those types of things as well uh but it's just it's just something I do if if something's taking me a long time I figure out some way to make that process easier make it repeatable and now make it sharable so thank you so much for watching I'll see you in the next one [Music]
Quote it with credit and a link. Quoting Syntax