summaryrefslogtreecommitdiff
path: root/blog/2021-08-14.md
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-04-19 14:27:32 +0300
committereug-vs <eugene@eug-vs.xyz>2022-04-19 14:27:32 +0300
commita7a039a704360f102ac8c678533c5cf113a499a1 (patch)
tree92179e76e294e2f0e41cc670a34eff7231d782d2 /blog/2021-08-14.md
parente6a2cbada3d44908c74974223a5328b43969e689 (diff)
downloadeug-vs-xyz-a7a039a704360f102ac8c678533c5cf113a499a1.tar.gz
feat: use more of the wiki-style
Diffstat (limited to 'blog/2021-08-14.md')
-rw-r--r--blog/2021-08-14.md10
1 files changed, 5 insertions, 5 deletions
diff --git a/blog/2021-08-14.md b/blog/2021-08-14.md
index a49aad5..e98d78f 100644
--- a/blog/2021-08-14.md
+++ b/blog/2021-08-14.md
@@ -2,7 +2,7 @@
I'm pretty sure everyone knows that sometimes finding a good **PNG** can be very hard, while there's always a bunch of the same **JPEG** images with the white background.
After searching for 10 minutes, you decide to remove background yourself - using [GIMP](https://gimp.org) or something like `Photoshop` or `PAINT.NET` if you are on Windows. **Forget about it!** I'm gonna show you how you can use [imagemagick](https://imagemagick.org/) to automate basic tasks like removing background and cropping images.
-## Telegram sticker pack
+# Telegram sticker pack
Every time I use Telegram stickers, I feel tired scrolling through many different packs trying to find the sticker I want. Sometimes, you just want them all to be in one place. That's why I created **Based Wojak** - a sticker pack which is automatically generated from random source images that I find on the internet.
![based-wojak](https://user-images.githubusercontent.com/51545008/129426994-2a787714-772d-4010-b295-6ae00346bdbc.png)
@@ -16,7 +16,7 @@ The collection itself is very small right now as you can see, but I plan to exte
https://t.me/addstickers/BasedWojak
-## Imagemagick
+# Imagemagick
Now, let's see how I've done that. Here's the GitHub :github: repo so you can follow:
https://github.com/eug-vs/telegram-based-wojak
@@ -62,7 +62,7 @@ Now let's have a closer look at the recipe for creating `out/%.png` from `src/%.
![imagemagick-logo](/public/emoji/imagemagick.png)
-### Removing the background
+## Removing the background
To remove background, I use `-floodfill`, here's how [imagemagick wiki](https://imagemagick.org/script/command-line-options.php) describes it:
> -floodfill {+-}x{+-}y color
>
@@ -72,9 +72,9 @@ To remove background, I use `-floodfill`, here's how [imagemagick wiki](https://
I use it two times: one in the top-left corner and one in the top-right. Top-left corner pixel obviously has a coordinate `+0+0`. To get the X coordinate of right-most pixel I have to use this expression: `+%[fx:w-1]`, Y coordinate stays at `0` of course. Since I already supplied `-fuzz` and `-fill none`, both operations will replace the white background with `none`, starting from two top corners of the image using the supplied fuzziness value.
-### Cropping the image
+## Cropping the image
After we removed background, most of the time we can trim a lot of extra space so that our image size corresponds to its content. Simple `-trim +repage` does the trick.
-### Adjusting the size
+## Adjusting the size
All we have to do now is to make sure the sticker respects the size with `-resize` option. It will resize it in a way so it fits into `512x512` box without changing the aspect ratio (largest side will always be `512px`).