matt.blissett.me.uk

Offline Photo Album on an Android Phone

The aim: an offline, compact copy of 35GiB of photographs to carry with me on my Android phone.

Solution: a Makefile on my Linux computer; which uses ImageMagick to produce small, lower-quality versions of all my photographs. These use about 2% of the space (797MiB) compared to the originals, but still look fine on my phone.

  1. The directory with my original photographs is ~/photos.
  2. Make a directory that will be copied (and then synchronised) to the phone, I made ~/.toPhone: mkdir ~/.toPhone; cd ~/.toPhone
  3. Make a link to the original photographs: ln -s ~/photos Source
  4. Download the Makefile: wget http://matt.blissett.me.uk/apps/scripts/offline-photos-android-phone/Makefile
  5. Run Make, with the -j option set to the number of CPUs you have: nice -n 15 make -j 4

On the phone

You need some way to copy the small photos from the computer to the phone. I used Rsync Backup For Android (note this is "for advanced Linux/Unix users"). Set this up to copy ~/.toPhone from the computer to the phone.

I used QuickPic to view the photographs.

The Makefile

# Makefile downloaded from http://matt.blissett.me.uk/apps/scripts/offline-photos-android-phone/
#

PHOTOS = $(shell find -L Source/[12M]* -type f -name '*.jpg')
# Adjust this bit:       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  to match all the photographs you want on the phone.

SHRUNK = $(patsubst Source/%.jpg, Albums/%.jpg, $(PHOTOS))

.PHONY: all
all: $(SHRUNK)

Albums/%.jpg: Source/%.jpg
	@mkdir -p "$(@D)"
	convert "$<" -resize '800x800>' -quality 40 "$@"
	touch -r "$<" "$@"