Batch resising for web
Smaller environment (Photo credit: wikipedia)
I recently tried to measure the environmental impact of this website. I used
an online tool. The result shows the easiest way
to improve my score was to reduce image sizes. This could easily be done with
ImageMagick.
I wrote a small bach script to resize my files:
#!/bin/bash
# resize images for web use
target_size=200 # in kb
output_dir="web"
mkdir -p $output_dir
resize_image() {
echo "image $1..."
output_file=$output_dir/$1
cp "$1" "$output_file"
current_size=$(( $(stat -c%s "$output_file") / 1024 ))
factor=95
while (( current_size > target_size ))
do
echo "current size: $current_size"
current_size=$(( $(stat -c%s "$output_file") / 1024 ))
magick "$1" -resize $factor% "$output_file"
factor=$(( factor - 5 ))
done
}
for image in *jpg
do
resize_image "$image"
done
It tries several resize factor (while loop, factor being redefined line 20)
until the output size is lower than a predefined threshold.
Then, I needed to replace path in all my articles.
Back online
I've migrated the blog from wordpress to pelican. Static files, quite easy to
use.
The migration process went well. The pelican import tool is easy to use
and my rst linter highlighted the few errors done by the import tools (mainly
empty sections).
There are still few artefacts due to …
Read More
happy birthday
[caption id="" align="alignright" width="350"]
Birthday candle (Photo credit: Wikipedia)[/caption]
One year ago, I begun this blog. The first post was about what I expected from the blog. Lets look backward. This blog contains:
- about 60 posts published
- almost all are posts in english
- few posts are in …
Read More
OPML importer plugin
As I want to share the source of my opinions, I decided to put a
blogroll on this
blog. (Un)fortunatly, the number of blog I (try to) follow is huge. I
have a backup of this list on a
OPML file, as any reasonable …
Read More
migration completed
I finished migration from movabletype to
wordpress . So here is all what I have
done.
I made a backup of all files (a simple
tar.gz ) and a
database dump
(mysqldump is your friend). it was not compulsary as the needed file is …
Read More
Migration in progress
Finally, I decided to migrate from
movabletype to wordpress.
I still don’t know if it is a good idea, but soon I’ll write about this
process (installation and configuration of
wordpress, export from movable
type , import into
wordpress, post migration actions, adaptation to this new blog
engine ,…) because …
Read More
How to make section in a movable type entry

User guide (Photo credit: Karen Roe)
As the title don't suggest, I don't know how to make section in a movabletype powered blog. I tried editing in html and putting < h2 > tags, but nothing is visible when the entry is posted (but the header2 tags are there).
Maybe I should …
Read More
Movable type and plugin installation
When I decided to open a blog, I choose to use a
CMS I didn't know about. The result is that it was not easy.
This post describe the main steps.
- The choice of a CMS
- The location of the blog
- The installation of the CMS
- The installation of the …
Read More
Movable type and plugin installation
When I decided to open a blog, I choose to use a
CMS I didn't know about. The result is that it was not easy.
This post describe the main steps.
- The choice of a CMS
- The location of the blog
- The installation of the CMS
- The installation of the …
Read More