findimagedupes: find visually similar images on Ubuntu

image_editor_compI was trying to order my camera images when I found that I have already copied, resized, renamed many of them previously and now I can’t find a way to get rid of duplicates. What I needed was a tool to find visually similar images. After searching a while I found findimagedupes which is available in synaptic. A dry run showed promising results and soon I found it can also detect similar images with different aspect ratios, more than 2 similar images etc. Performance is quite good considering I ran it on a directory having around 7000 files in it. Now going through the output list to delete the extra copies.

Usage

$ findimagedupes Pictures/ > dups
//get the output in dups file

Installation

To install on Ubuntu:

$ sudo apt-get install findimagedupes

Webpage: findimagedupes

Similar software

nautilus-columns for Ubuntu

nautilus_compnautilus-columns is a powerful python script that allows viewing of music (eg. ID3 info, album, artist, bitrate, track no.) and image file metadata (eg. EXIF info, image size, date shot) and information in Nautilus list view. Last time I checked this script was not available for Ubuntu Precise as it was not working with nautilus 3.x. I have made the changes to the script to make it work with nautilus 3.x and sent the modifications to the PPA administrator. Hopefully it will be available as a deb package soon. I have uploaded the modified script here. Place it in the following directory:
~/.local/share/nautilus-python/extensions/

and restart nautilus:

$ nautilus -q

To install nautilus-columns on Ubuntu:

$ sudo add-apt-repository ppa:nilarimogard/webupd8
$ sudo apt-get update
$ sudo apt-get install nautilus-columns

Update: Though it is very powerful, the problem with this extension is that it tends to read all the information about the audio, video, image, PDF files when a directory is opened. This makes the directory loading slow. I am not sure if nautilus has any mechanism to support on-demand loading of extensions because it seems that this happens even if the directory view is set to icon view. I made changes to the script to load only the image size and nothing else to check how it goes. Nautilus opened the directories faster. Here is the example script with only one functionality – show image dimensions in list view.

Thanks to Andrew now it is available in the PPA as well! 🙂

Roll windows with scroll [Unity on Precise]

To enable window rolling in Ubuntu 12.04 when you are using Unity edit the following entry in Configuration Editor:

/ ▸ apps ▸ gwd ▸ mouse_wheel_action

and change the value to “shade” without quotes. Now mouse wheel scroll-up on title bar rolls your windows and scroll-down unrolls them.

Update: To set the mouse_wheel_action key (or reset it) without installing Configuration Editor (which is not installed by default) use the following commands as current user:

$ gconftool-2 -s /apps/gwd/mouse_wheel_action -t string “shade”
$ gconftool-2 -s /apps/gwd/mouse_wheel_action -t string “none”

Set Acer laptop brightness on Ubuntu at boot

As I use my laptop continuously for hours, I set the brightness very low so that my eyes don’t hurt. My laptop is Acer Aspire 5738z and I had to struggle a bit to figure out how to set and control the brightness level at boot-up to avoid doing it manually. Here’s the whole procedure on tested Ubuntu 12.04:

First add the following in your /etc/default/grub file: acpi_osi=Linux in GRUB_CMDLINE_LINUX_DEFAULT line. For example, mine is:

GRUB_CMDLINE_LINUX_DEFAULT="quiet nosplash acpi_osi=Linux i8042.nomux"

Update GRUB for the change to take effect

$ sudo update-grub2

This will enable you to use the brightness keys in keyboard which in case of some Acer models doesn’t work just after installing Ubuntu. Now you need to know which Graphics Controller you are using. To check, run

$ sudo lspci|grep -i graphics
00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07)
00:02.1 Display controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07)

In my case it is the first one. If you are not sure run the following commands:

$ sudo setpci -s 00:02.0 F4.B=45
//where 00:02.0 is your controller ID from the above command
$ sudo setpci -s 00:02.1 F4.B=45

and check after running which one your brightness changes. Here I am setting the brightness level to 45 (which is also the value I use regularly). You can test with 30 to make sure the change in brightness is easily detectable.

To check in which file the brightness value is set just run the same command as a non root user. An error is thrown which shows that you do not have permission to modify the file:

$ sudo setpci -s 00:02.0 F4.B=45
pcilib: Cannot open /sys/bus/pci/devices/0000:00:02.0/config

A hexdump of the file shows something like:

$ sudo hexdump /sys/bus/pci/devices/0000:00:02.0/config
0000000 8086 2a42 0407 0090 0007 0300 0000 0080
0000010 0004 f400 0000 0000 000c d000 0000 0000
0000020 1801 0000 0000 0000 0000 0000 1025 0205
0000030 0000 0000 0090 0000 0000 0000 010b 0000
0000040 0000 0000 0048 0000 0009 110a 6488 1c00
0000050 8001 0370 0019 0000 0000 0000 0000 bc00
0000060 0000 0000 0000 0002 0000 0000 0000 0000
0000070 0000 0000 0000 0000 0000 0000 0000 0000
*
0000090 d005 0001 300c fee0 4189 0000 0000 0000
00000a0 0000 0000 0009 2006 0000 0000 0000 0000
00000b0 0000 0000 0000 0000 0000 0000 0000 0000
00000c0 0000 0000 0000 0000 0000 0000 0140 0000
00000d0 0001 0023 0000 0000 0000 0000 0034 0000
00000e0 0000 0000 0000 0000 8000 1a00 2041 0000
00000f0 1c0d 0734 0045 0000 0fa0 0007 0020 bbb7
0000100

As you can see, the sixth byte from 00000f0 is set to 45.

To run this at startup as root, add the command (e.g. setpci -s 00:02.0 F4.B=45) in your rc.local file and enable it. To avoid touching rc.local I have added it in the /etc/init/setvtrgb.conf file as the last line. Check this post of mine for a way to use a script using sudo, add it as a Startup Application and execute without any password if you are using ext4.

Manual default file associations on Ubuntu

settings_compUpdate: This article was written for Precise. Ubuntu 14.04 has options in the File Properties GUI to associate a file type with a command. This method works on the LXDE desktop environment too.

Ubuntu Precise didn’t provide any option to create file associations with an application by locating the application manually or using path to the application. I believe this is absolutely lame and not sure whether it will be working in the released version. Hasn’t enough freedom already been snatched by throwing away the root login? I faced an issue a few minutes back. My friend sent me a video in FLV format and I played it in SMPlayer which is set by default. When I tried to do a skip-forward SMPlayer crashed. I found that running the video manually from the terminal using MPlayer doesn’t have any issues and I can skip-forward at will. I am not interested in searching the fix for this in SMPlayer right now (may be a switch needs to be passed while invoking MPlayer). So I thought of setting the default application for playing FLV files to MPlayer. I did the following:

$ grep -inr flv *
./.local/share/applications/mimeapps.list:7:video/x-flv=smplayer.desktop
./.local/share/applications/mimeapps.list:23:video/x-flv=smplayer.desktop;

I opened mimeapps.list and changed “smplayer” in lines 7 and 23 to “mplayer”. Now it’s time to find the file smplayer.desktop and create a copy as mplayer.desktop.

$ su
Password:
# find / -iname smplayer.desktop
/usr/share/applications/smplayer.desktop
^C
# cp /usr/share/applications/smplayer.desktop \
/usr/share/applications/mplayer.desktop

Now I edited the file mplayer.desktop and changed the following lines:

Exec=smplayer %U
Name=SMPlayer
TO
Exec=mplayer %U
Name=MPlayer

I didn’t bother changing the Icon=smplayer entry as in my case MPlayer is not installed with its own icons. Now, I ran the FLV file again and VoilĂ ! It started in MPlayer.

Update: There’s a quick (and better) way of achieving the same from the terminal using the mimeopen command, as this post explains.

Quick reminders on Ubuntu

remember

Often my wife asks me to run some errands while I am glued to my laptop. I reply – “OK. Will do in 10 minutes!” but invariably I forget it within seconds though I was willing to do it. This repeats several times and finally I get up after an hour or so. The same thing happened today when my landlord requested me to turn off the water pump after half an hour. If you have read this earlier post of mine you know that I can’t help it how hard I try to remember. So I started looking for a simple way to handle these situations without having to remember.

Pretty soon I found a smart way of doing it using at and zenity without installing any additional exotic software.
Here’s how I did it:

I created a new file in my home folder named mytodo. I added the following lines in it:

zenity --info --display=:0.0 --text \
"Time to get outta my face - your laptop"
//added the second line so that I do not need to touch the first line

To get this reminder after 1 minute I ran the following in my terminal and closed it:

$ at -f mytodo now +1 min
warning: commands will be executed using /bin/sh
job 18 at Mon Apr 16 22:57:00 2012
$

To make the process simpler I have written a small C program. Download it from here.
Usage:

$ reminder 5 time to get up!
//where 5 is time in mins and rest is the string to pop-up

In order to remember anything now I just need to edit the second line in mytodo file and schedule it with required timespan using at from the terminal which I can get easily from the bash history.

Convert images on Ubuntu using eog

image_editor_compeog (Image Viewer) is a very simple and fast image viewer installed by default in Ubuntu Precise. A powerful feature of this tiny utility is the ability to convert image files, for example, when you want to convert a PNG screenshot to JPEG to save space or mail quickly.

To convert, open the image in eog and select “Save as” from menu. In the next window, select the desired output format from the drop down list in bottom right and change the name of the new file to use the appropriate extension.

Webpage: eog