Installing Ubuntu on a HP Pavilion laptop

So I decided to install Ubuntu on my daughter’s new laptop, more specifically a HP Pavilion. The choice of this particular laptop was because it looked nice, and had good specs for the money. It was first after the purchase I read all the complaints people have about the weird UEFI implementation on HP laptops. So I started the install process with some worries.

Reading on various forums, people seemed to have been doing all sorts of strange things to be able to install Ubuntu on HP laptops, including modifying the UEFI setup, changing the BIOS, and so on. I recall that on my Lenovo laptop I had to work quite a bit to turn off all the fancy auto-Windows-stuff.

I am not sure if HP has changed something recently or not, but the final procedure was super-easy: I just hit the F9 button on startup and got a normal “old-school” boot selector. Here I chose the USB drive, and the Ubuntu installer fired up.

I have installed Linux (primarily various Ubuntu versions) on a number of laptops over the years, and it is very seldom that I get into problems with drivers. Also this time things went smoothly, everything worked perfectly right after the install. I think it is important to continue repeating this message, because I still hear people saying that it is tricky to get Ubuntu to play with different hardware. True, there used to be driver issues some years ago, but personally I haven’t experienced that in five years or so.

Which Linux version to choose for a 9-year old?

My 9-year old daughter is getting her first laptop. But which OS should she get started with?

I have been using various versions of Ubuntu as my main OS for around 5 years now, currently using Ubuntu Studio on my main laptop. This distro is based on XFCE, a very lightweight yet versatile OS. The reason for choosing Ubuntu Studio over the regular XUbuntu was to get a bunch of music apps by default. I haven’t been able to explore these as much as I wanted to, unfortunately, primarily due to everything happening at our new centre (RITMO) and master’s programme (MCT).

Even though I like Ubuntu Studio myself, it is not a distro I would install on my daughter’s machine. Buying a new computer with Windows 10 pre-installed, one could argue that it would be best to leave her with that. This may also help her to be more familiar with the computers they are using at school, which run Windows 7 at the moment. But the question in the store about whether I wanted to buy some antivirus-software with the new laptop, was enough to ensure me that a Linux distro would be a better choice.

I have heard that some people like distros such as Edubuntu for kids, but it does not seem to be maintained? After thinking about it for a little while, I have concluded that it is probably useful for a kid to learn to use a normal OS. If you compare how things were a decade or two ago, most modern-day OSes are comparably easy to use anyways.

Finally I decided to make it simple, and installed the regular Ubuntu distro based on GNOME. It looks “modern”, has large icons, and is fairly easy to navigate due to the streamlining of menus, and so on.

Creating circular thumbnails in the terminal

Circular pictures (like the one to the right) has become increasingly popular on the web. We have, for example, included circular pictures in RITMO’s annual report, and we therefore also wanted to use circular pictures in a presentation at our upcoming LARGO conference. The question, then, is how to create such circular pictures?

The circular pictures in the annual report are made through a CSS overlay. So if you try to right-click and save one of those, you will get the original rectangular version. It is, of course, possible to add circular thumbnails in the presentation software, using the circular crop function in PowerPoint or add mask function in Keynote. The challenge with these, however, is that you may get into trouble if you move your presentation from one program to another. I often prefer to make presentations in Google Presentation, and there is no such feature there.

The most bullot-proof solution is therefore to create new circular images. This can be done in photo editing programs, such as the circle image function in GIMP. But for a centre of the size of RITMO (50+ people), and with many people coming and leaving all the time, I would rather prefer an automatic solution. I therefore decided to figure out how to do this in the terminal.

It turns out that Imagemagick comes to the rescue once again. Here is a one-liner for creating a circular PNG image from a JPG file:

convert alexander.jpg \( +clone -threshold -1 -negate -fill white -draw "circle 100,100 100,0" \) -alpha off -compose copy_opacity -composite alexander_circle.png

This will take a regular image like this:

and make it into a circular image like this:

Since the original was a 200x200px image, I used the code “circle 100,100 100,0” in the script to ensure that the circle would be in the centre of the image.

The next step was to extend the script to read all the JPG files in a folder and convert them into circular images. This can be done like this (at least on Ubuntu):

#!/bin/bash

for i in *.jpg;
do
  name=`echo $i | cut -d'.' -f1`;
  convert "$i" \
  \( +clone -threshold -1 -negate -fill white -draw "circle 100,100 100,0" \) \
  -alpha off -compose copy_opacity -composite $name.png;
done

Save the script as circle_image.sh (or whatever else you prefer), make it runable (chmod u+x circle_image.sh), and run it (sh circle_image.sh), and you get a bunch of circular images that you can be used in any program around. Scripting is fun!

Rotate lots of image on Ubuntu

I often find myself with a bunch of images that are not properly rotated. Many cameras write the rotation information to the EXIF header of the image file, but the file itself is not actually rotated. Some photo editors do this automagically when you import the files, but I prefer to copy files manually to my drive.

I therefore have a little one-liner that can rotate all the files in a folder:

find . *.jpg -exec jhead -autorot {} \;

It works recursively, and is very quick!