diff options
author | Dante Catalfamo | 2022-10-24 02:10:17 -0400 |
---|---|---|
committer | Dante Catalfamo | 2022-10-24 02:10:17 -0400 |
commit | 8b4557826f56449dfc5a9ff461de14d6f3a19bbb (patch) | |
tree | c72c6c150414ac0edef48d580a700e7e6629f02a /content | |
parent | 74e286534e3a650d7d85132a737c1b23e38d782f (diff) | |
download | blog-8b4557826f56449dfc5a9ff461de14d6f3a19bbb.tar.gz blog-8b4557826f56449dfc5a9ff461de14d6f3a19bbb.tar.bz2 blog-8b4557826f56449dfc5a9ff461de14d6f3a19bbb.zip |
Creating a high quality gif with transparency post
Diffstat (limited to 'content')
-rw-r--r-- | content/posts/creating-a-high-quality-gif-with-transparency/index.org | 64 | ||||
-rw-r--r-- | content/posts/making-a-nice-gif/index.org | 66 |
2 files changed, 64 insertions, 66 deletions
diff --git a/content/posts/creating-a-high-quality-gif-with-transparency/index.org b/content/posts/creating-a-high-quality-gif-with-transparency/index.org new file mode 100644 index 0000000..ef7b56e --- /dev/null +++ b/content/posts/creating-a-high-quality-gif-with-transparency/index.org @@ -0,0 +1,64 @@ +#+TITLE: Creating a High Quality GIF with Transparency +#+DATE: 2022-10-24T02:02:00-04:00 +#+DRAFT: false +#+DESCRIPTION: My process for creating a high quality, optimized gif with transparency +#+TAGS[]: gimp, kdenlive, ffmeg, gif +#+KEYWORDS[]: gimp, kdenlive, ffmeg, gif +#+SLUG: +#+SUMMARY: + +I spent quite a bit of time trying to figure out the process to create +the gif at the top of my [[{{< ref "how-bsd-authentication-works" >}}][How BSD Authentication Works]] blog post, so I +thought I'd share it. + +Here's how to create a small, high quality gif with transparency using +a video and an image as source material. + +I'd wanted to combine the image of puffy (the blowfish) and the +spinning gears to represent the OpenBSD internals. + +Initially I went made several attempts using different software +like =ffmpeg=, =shotcut=, and =obs=, but none of them were able to +create what I was looking for. + +This is the process that I ended up with that worked for me. + +First I created the image I wanted for the overlay in GIMP. This was +the OpenBSD mascot with a cutout in the center. I then found a gif of +spinning gears. I opened the gif up in Kdenlive and used the colorize +filter to get them all yellow so it would fit in with the puffer fish +theme. + +Then I imported the overlay image (Puffy with the cutout) and +placed it on top. I then rearranged and transformed things until it +was how I wanted. + +From there I went to render the video in Kdenlive, and used the =Video +with Alpha > Alpha MOV= preset. I'd tried using the =webm= preset +first but =ffmpeg= seems to be more picky about that, plus this +=mov= is lossless so it's better for this purpose anyways. + +I then took that video and split it up into frames using =ffmpeg=. + +#+begin_src sh +mkdir movframes +ffmpeg -i bsd\ auth.mov movframes/auth%03d.png +#+end_src + +I then opened the first frame in GIMP. From there I opened the +remaining frames as layers through =File > Open as Layers=, and +selected the remaining frames using shift click. + +I then exported them as a =gif=, making sure to check =animated= in +the export menu, and set the time delay between frames. + +The =gif= that's exported from GIMP was alright, but it wasn't very +optimized and the timing seems to not work correctly all the time +for some reason. + +To fix this I used =gifsicle= to both optimize the gif and set the +framerate correctly. + +#+begin_src sh +gifsicle -d 4 -O3 -o output.gif input.gif +#+end_src diff --git a/content/posts/making-a-nice-gif/index.org b/content/posts/making-a-nice-gif/index.org deleted file mode 100644 index e54b807..0000000 --- a/content/posts/making-a-nice-gif/index.org +++ /dev/null @@ -1,66 +0,0 @@ -#+TITLE: Making a Nice GIF -#+DATE: 2021-10-23T19:23:14-04:00 -#+DRAFT: true -#+DESCRIPTION: -#+TAGS[]: -#+KEYWORDS[]: -#+SLUG: -#+SUMMARY: - -I just spent a good couple hours trying to figure out how to create -a high quality gif with transparency using a video and an image as -source material. - -I ended up finding a process that turned out wonderfully and ended -up creating a beautiful and small gif. - -I'm combining images to create a header image for my bsd auth post -and I thought it would be fun to have a cutout of Puffy with -spinning gears inside. - -Initially I went through several tries using different software -like =ffmpeg=, =shotcut=, and =obs=, to name a few. - -This is the process that I ended up with that worked for me. - -First I created the image I wanted for the overlay in GIMP. I then -got the gif of the spinning gears from google images. I opened the -gif up in Kdenlive and used the colorize filter to get them all -yellow so it would fit in with the puffer fish theme. - -Then I imported the overlay image (Puffy with the cutout) and -placed it on top. I then rearranged and transformed things until it -was how I wanted. - -From there I went to render the video in Kdenlive, and used the -=Video with Alpha > Alpha MOV= preset. I tried using the =webm= -presets but =ffmpeg= seems to be more picky about that, plus this -=mov= is lossless so it's better anyways. - -I then took that video and split it up into frames using =ffmpeg=. - -#+begin_src sh -mkdir movframes -ffmpeg -i bsd\ auth.mov movframes/auth%03d.png -#+end_src - -I then opened the first frame in GIMP. From there I opened the -remaining frames as layers through =File > Open as Layers=, and -selected the remaining frames using shift click. - -I then exported them as a =gif=, making sure to check =animated= in -the export menu, and set the time delay between frames. - -The =gif= that's exported from GIMP is alright, but it's not very -optimized and the timing seems to not work correctly all the time -for some reason. - -To fix this I used =gifsicle= to both optimize the gif and set the -framerate correctly. - -#+begin_src sh -gifsicle -d 4 -O3 -o output.gif input.gif -#+end_src - -After all that I finally had a great looking, small, and fast gif -with transparency. |