aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-03-06 22:24:32 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2023-03-06 22:24:32 +0100
commit5b4f601fc74a1ed607fb93fea7cabc4cc3a1f5ba (patch)
tree1c58a774c46705ca0da707b85d60749d59b6707a /src
parent3579773d924c2866f6a1663fc34c4d3694ac1df2 (diff)
downloadsebastiano.tronto.net-5b4f601fc74a1ed607fb93fea7cabc4cc3a1f5ba.tar.gz
sebastiano.tronto.net-5b4f601fc74a1ed607fb93fea7cabc4cc3a1f5ba.zip
Resized images + blog post
Diffstat (limited to 'src')
-rw-r--r--src/blog/2022-09-10-netbooks/darkstar.jpgbin3578876 -> 155458 bytes
-rw-r--r--src/blog/2022-09-10-netbooks/final.jpgbin6089913 -> 224546 bytes
-rw-r--r--src/blog/2022-09-10-netbooks/hd.jpgbin5031032 -> 197080 bytes
-rw-r--r--src/blog/2022-09-10-netbooks/scramble.jpgbin4134845 -> 206364 bytes
-rw-r--r--src/blog/2022-12-30-blog-ready/pc-planner.jpgbin6497789 -> 203907 bytes
-rw-r--r--src/blog/2023-01-28-windows-desktop/settings.pngbin43045 -> 69520 bytes
-rw-r--r--src/blog/2023-01-28-windows-desktop/tiling.pngbin68884 -> 27650 bytes
-rw-r--r--src/blog/2023-02-25-job-control/jobs-diagram.pngbin56672 -> 37996 bytes
-rw-r--r--src/blog/2023-03-06-resize-pictures/resize-pictures.md86
-rw-r--r--src/blog/blog.md1
-rw-r--r--src/blog/feed.xml7
-rw-r--r--src/favicon.pngbin8829 -> 4828 bytes
-rw-r--r--src/me.pngbin223247 -> 226377 bytes
-rw-r--r--src/speedcubing/cubing.pngbin813446 -> 721767 bytes
14 files changed, 94 insertions, 0 deletions
diff --git a/src/blog/2022-09-10-netbooks/darkstar.jpg b/src/blog/2022-09-10-netbooks/darkstar.jpg
index 3d32dd1..fb736dd 100644
--- a/src/blog/2022-09-10-netbooks/darkstar.jpg
+++ b/src/blog/2022-09-10-netbooks/darkstar.jpg
Binary files differ
diff --git a/src/blog/2022-09-10-netbooks/final.jpg b/src/blog/2022-09-10-netbooks/final.jpg
index 63b33bf..7789e14 100644
--- a/src/blog/2022-09-10-netbooks/final.jpg
+++ b/src/blog/2022-09-10-netbooks/final.jpg
Binary files differ
diff --git a/src/blog/2022-09-10-netbooks/hd.jpg b/src/blog/2022-09-10-netbooks/hd.jpg
index 525726b..dcc84b5 100644
--- a/src/blog/2022-09-10-netbooks/hd.jpg
+++ b/src/blog/2022-09-10-netbooks/hd.jpg
Binary files differ
diff --git a/src/blog/2022-09-10-netbooks/scramble.jpg b/src/blog/2022-09-10-netbooks/scramble.jpg
index 0d9cb5f..e9c6017 100644
--- a/src/blog/2022-09-10-netbooks/scramble.jpg
+++ b/src/blog/2022-09-10-netbooks/scramble.jpg
Binary files differ
diff --git a/src/blog/2022-12-30-blog-ready/pc-planner.jpg b/src/blog/2022-12-30-blog-ready/pc-planner.jpg
index 8fb52e5..dc7d803 100644
--- a/src/blog/2022-12-30-blog-ready/pc-planner.jpg
+++ b/src/blog/2022-12-30-blog-ready/pc-planner.jpg
Binary files differ
diff --git a/src/blog/2023-01-28-windows-desktop/settings.png b/src/blog/2023-01-28-windows-desktop/settings.png
index 85ec492..84bd2c2 100644
--- a/src/blog/2023-01-28-windows-desktop/settings.png
+++ b/src/blog/2023-01-28-windows-desktop/settings.png
Binary files differ
diff --git a/src/blog/2023-01-28-windows-desktop/tiling.png b/src/blog/2023-01-28-windows-desktop/tiling.png
index dd1f3ec..ef28431 100644
--- a/src/blog/2023-01-28-windows-desktop/tiling.png
+++ b/src/blog/2023-01-28-windows-desktop/tiling.png
Binary files differ
diff --git a/src/blog/2023-02-25-job-control/jobs-diagram.png b/src/blog/2023-02-25-job-control/jobs-diagram.png
index 484e7b9..d61a769 100644
--- a/src/blog/2023-02-25-job-control/jobs-diagram.png
+++ b/src/blog/2023-02-25-job-control/jobs-diagram.png
Binary files differ
diff --git a/src/blog/2023-03-06-resize-pictures/resize-pictures.md b/src/blog/2023-03-06-resize-pictures/resize-pictures.md
new file mode 100644
index 0000000..c28340f
--- /dev/null
+++ b/src/blog/2023-03-06-resize-pictures/resize-pictures.md
@@ -0,0 +1,86 @@
1# Resizing my website's pictures with ImageMagick and find(1)
2
3I have noticed that most of the pictures I have uploaded on this website
4are incredibly large:
5
6```
7$ du -h -d 1 sebastiano.tronto.net
842M sebastiano.tronto.net/gemini
942M sebastiano.tronto.net/http
1042M sebastiano.tronto.net/src
11100M sebastiano.tronto.net/.git
12225M sebastiano.tronto.net
13```
14
15Stupid modern phones and their multi-megapixel cameras!
16I definitely do not want my minimalist blog to waste your bandwidth,
17I have to fix this. I could just go through all my pictures and resize
18them with something like [gimp](https://www.gimp.org/) - there are like
1910 of them. But that's boring. Let's do it with the command line instead.
20
21## ImageMagick
22
23The obvious question is: how do we even edit an image file
24with the command line? Luckily, there is a tool for that:
25[ImageMagick](https://imagemagick.org/). This piece of software
26does a ton of things, and I do not use it very often. So I always
27need to look up what I want to do.
28
29One way to invoke ImageMagick is by calling the `convert` command,
30which can take a
31[`-resize`](https://imagemagick.org/script/command-line-options.php#resize)
32option, followed by a
33[`geometry`](https://imagemagick.org/script/command-line-processing.php#geometry)
34argument. After checking the online manual, I understood that the
35command I was looking for was:
36
37```
38$ convert picture.jpg -resize "750>" picture.jpg
39```
40
41which resizes `picture.jpg` by scaling it down to at most 750px width -
42keeping the ratio between width and height, and leaving it untouched if it
43is already smaller. The value 750 was chosen after a couple of attempts,
44it seems a good compromise between quality and size.
45
46And now I just have to do this for all the pictures. Of course, running
47the same command 10 times with a different argument is out of question.
48
49## find(1)
50
51*(No "man page reading club" this time, but don't
52worry, the series will be back soon.)*
53
54A standard UNIX command, [`find`](https://man.openbsd.org/find) allows
55you to scan a folder for files with certain properties (for example,
56a certain name pattern) and perform actions on them (for example,
57running a command). The OpenBSD and GNU versions of find have some
58differences, check your local manual page. The commands I use
59here have been tested on the GNU version, but should be standard.
60
61To look for file and simply print their name, we can use `-name`:
62
63```
64$ find src -name \*.jpg -or -name \*.png
65src/me.png
66src/favicon.png
67src/speedcubing/cubing.png
68src/blog/2023-01-28-windows-desktop/settings.png
69src/blog/2023-01-28-windows-desktop/tiling.png
70src/blog/2022-09-10-netbooks/darkstar.jpg
71src/blog/2022-09-10-netbooks/final.jpg
72src/blog/2022-09-10-netbooks/scramble.jpg
73src/blog/2022-09-10-netbooks/hd.jpg
74src/blog/2023-02-25-job-control/jobs-diagram.png
75src/blog/2022-12-30-blog-ready/pc-planner.jpg
76```
77
78Now we can use `-exec` to run a command on each of these files,
79using `{}` to refer to the file's name:
80
81```
82find src \( -name \*.jpg -or -name \*.png \) -exec convert {} -resize "750>" {} \;
83```
84
85We get a couple of warnings about grayscale images, but whatever.
86This seems to have worked.
diff --git a/src/blog/blog.md b/src/blog/blog.md
index 8bd57ea..c74c703 100644
--- a/src/blog/blog.md
+++ b/src/blog/blog.md
@@ -5,6 +5,7 @@
5 5
6## 2023 6## 2023
7 7
8* 2023-03-06 [Resizing my website's pictures with ImageMagick and find(1)](2023-03-06-resize-pictures)
8* 2023-02-25 [Job control: one shell is all you need](2023-02-25-job-control) 9* 2023-02-25 [Job control: one shell is all you need](2023-02-25-job-control)
9* 2023-01-28 [The year of the Windows desktop](2023-01-28-windows-desktop) 10* 2023-01-28 [The year of the Windows desktop](2023-01-28-windows-desktop)
10* 2023-01-11 [Aaron Swartz](2023-01-11-aaron-swartz) 11* 2023-01-11 [Aaron Swartz](2023-01-11-aaron-swartz)
diff --git a/src/blog/feed.xml b/src/blog/feed.xml
index 88f547b..ab75982 100644
--- a/src/blog/feed.xml
+++ b/src/blog/feed.xml
@@ -9,6 +9,13 @@ Thoughts about software, computers and whatever I feel like sharing
9</description> 9</description>
10 10
11<item> 11<item>
12<title>Resizing my website's pictures with ImageMagick and find(1)</title>
13<link>https://sebastiano.tronto.net/blog/2023-03-06-resize-pictures</link>
14<description>Resizing my website's pictures with ImageMagick and find(1)</description>
15<pubDate>2023-03-06</pubDate>
16</item>
17
18<item>
12<title>Job control: one shell is all you need</title> 19<title>Job control: one shell is all you need</title>
13<link>https://sebastiano.tronto.net/blog/2023-02-25-job-control</link> 20<link>https://sebastiano.tronto.net/blog/2023-02-25-job-control</link>
14<description>Job control: one shell is all you need</description> 21<description>Job control: one shell is all you need</description>
diff --git a/src/favicon.png b/src/favicon.png
index 8a6b202..fca1e66 100644
--- a/src/favicon.png
+++ b/src/favicon.png
Binary files differ
diff --git a/src/me.png b/src/me.png
index 816c96f..0afd2ca 100644
--- a/src/me.png
+++ b/src/me.png
Binary files differ
diff --git a/src/speedcubing/cubing.png b/src/speedcubing/cubing.png
index 2c188d8..7ee8943 100644
--- a/src/speedcubing/cubing.png
+++ b/src/speedcubing/cubing.png
Binary files differ

Generated with cgit - Back to sebastiano.tronto.net