Tuesday, March 21, 2017

GiMP - delete areas outside an image

GIMP mostly does exactly the opposite of what I want in a few steps, or takes many many steps to do what I want, or the tutorials leave out one critical step that costs my weekend. In other words, I hate GIMP, but it's free. Take the following image of an old duct-taped surfboard that I found online.


Suppose I wanted to delete the background and keep the foreground surfboard. You'd think, OK, 3 minutes,3 steps: take the magic wand/select, add transparency, then bucket fill the selected parts. Two problems: 1) the surfboard has black fins, so fuzzy select goes into the surfboard, 2) bucket fill fills a selected area, not areas outside a selected areas. So now I have to do this differently, and with a shitload of steps.

Tutorials (10 minutes):

  1. Do all the selection steps, click click path nodes, then hit edit and bend them. Then Select by Path
  2. Add alpha transparency layer
  3. Delete key
Your image will be deleted and your background will be left, just as if you used the bucket fill tool.

2 hours later, the Real (10 minutes):

  1. Do all the selection steps, click click path nodes, then hit edit and bend them. Then Select by Path
  2. Select-->Invert. This swaps what's selected with what's not selected or, say, the background with the foreground.
  3. Add alpha transparency layer
  4. Delete key

Wednesday, March 15, 2017

Locale miasma

Linux has so many problems and so many solutions, but if you've been in it for years, two of the biggest little issues that turn into patience cancers are sound and locales. Note from this page the number of variables which can be accepted.

But there are memory (aka "speed") concerns involved with locale selection, which is why I typically only use "C", by uncommenting it inside /etc/locale.conf. To check:
$ locale
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=C

However, suppose I want to do something as simple as play solitare.
$ sol v=Klondike
Non UTF-8 locale (ANSI_X3.4-1968) is not supported!

What's needed is a fast way to switch locales, obviously, but without the downstream issues of perhaps font regeneration and other failures.