Tips for optimizing images

Not that long ago, disk space was an expensive commodity: five gigabytes of space for a website could cost you more than €30 per month. Today, you pay that for a whole year and the double or more of disk space. Some hosts even offer “unlimited” storage for a similar monthly price.

Even though disk space has become cheaper, you might be bound to hit the limit of your hosting provider. In order to delay that, you can (and should!) optimize the images you use. This can be done in several ways, but I’m going to document the ones I use.

First, avoid PNG’s unless you need transparency in the image. The format is open, which is great, but the more color information it has the more disk space it tends to use. You can easily confirm this by saving a photo in PNG and JPEG, and then see how much space they take. Chances are the PNG one will use at least two times more disk space than the JPEG one.

Second, if you use GNU/Linux, *BSD or macOS, leverage the jpegoptim utility. This tool does some neat things, like removing the metadata information (EXIF, XMP, etc) and applying lossless optimizations to help you reduce the file size. With the PNG images, you can use optipng to accomplish the same thing. There are also some websites that let you optimize your images (before uploading them to your website), like

This two simple things allowed me to save more than 5GB of disk space for Espalha Factos the first time it was done. It might not sound a lot, but it was around 4,17% of the total disk space.


sncli – Simplenote Command Line Interface

Notes can be a great way to store information for later reference. That’s why I’m always on the look for the “perfect” note-taking app. I use Google Keep for grocery lists and saving random links I want to read but don’t have top priority, because it’s available in most platforms. Yet, for storing notes in a (somewhat) knowledge base format, I hadn’t found a solution.

I’ve tried some apps and services, but they always fell short. One of those services was Simplenote; not because it didn’t have what I needed, but because I hadn’t found a command-line application to interact with the service when I don’t have a graphical session running. Until today.

While randomly browsing the web, I stumbled upon sncli, a command-line interface for Simplenote. The tool is written in Python3, and you only need the interpreter and Pip to install it. The configuration is simple, but the keybinds are awkward. To be honest, they seem to be configurable in the configuration file, located at ‘$HOME/.snclirc’, but I haven’t done that yet.

One of the cool things about this app is it allows you to use your preferred text editor. In my case, that’s micro. I find the keybinds in this text editor simple to use (mostly because they are the same as most text editors with a GUI).

Another nice feature is the ability to flag notes as markdown content. This allows a faster visual identification of them in the notes list. There are other flags, for example to identify which notes haven’t been synced.

Other notable features include regex and Google-like search, versioning, piping (inside sncli) notes content to external command and creating notes on the command-line with a simple pipe (echo “Testing” | sncli -t Test create -).

By the way, this was written in sncli.



A 11ª temporada de Ficheiros Secretos começou. Ver esta série é uma viagem de regresso à adolescência, à ansiedade causada pela espera do próximo episódio, à paixoneta pela agente Scully. E é bom. Esta foi a primeira série televisiva de ficção científica que me colou ao ecrã como uma lapa a uma rocha e é com muito agrado que posso ver mais uma temporada.