Migrating from Pegasus to Thunderbird

December 20, 2012

I’ve been on Pegasus Mail for ages. It’s OK, but not open source, and I’ve always had the vague fear that some day my email will be locked away due to a format change. In addition, its HTML handling is not the best, and the way it does multiple accounts is a little weird. Finally, it was getting slow on my Windows XP PC due to the file system – and migrating it from one PC to another is a pain, especially if you’re changing the drive the data lives on.

So I resolved to move to Thunderbird. I started from here:

and here:

and when I did the MBox method, it seemed to work fine. Until I looked at the folder on Thunderbird and saw more messages than I’d counted on.

It appears that Thunderbird uses “\n\nFrom .*\n” to filter its messages. Ok, but Pegaus doesn’t quote the From in “From the editor:” which appears at the start of the line in some of my messages. Argh! This left me with lots of messages split in half, with weird dates and strange subjects / from / to lines.

I hacked up the following awk script, which I put in a file called peg2tbird:

/^From / && ! /\?\?\?\@\?\?\?/ { printf ">%s\n", $0 }
!(/^From / && ! /\?\?\?\@\?\?\?/ ) { printf "%s\n", $0 }

This takes any line that matches “From ” but doesn’t match “From ???@???” and puts a > in front of the From. All other lines it leaves as-is.

Then I ran:
\cygwin\bin\gawk -f peg2tbird < unx01234.mbx > tbird-mbox-file

Then I copied tbird-mbox-file to my Thunderbird Profile directory (in Mail\Local Folders).

This makes the messages look a little strange in Thunderbird – they look like “>From the editor:”. Also, some messages ended up showing with today’s date – inserted by Pegasus. (I think it was just those generated by a virus checker, so they were probably less well-formed than real messages.) Sigh. Oh well, that’s good enough for me to get my old messages migrated.


Batch-converting images

June 29, 2010

I had a wad of images that I needed to resize from 300dpi and high-resolution jpg to 4.5×6 (or 6×4.5) low resolution at 72 dpi.

First, I installed ImageMagick:
sudo aptitude install imagemagick

Then I opened GIMP and determined the pixel width and height of one image. (Image -> Canvas Size). In my case, it was 3264×2448.

Next, I resized the image to the size I wanted. That turned out to be 432×324.

In other words, I wanted my new images to be 0.132352941 of the original image. A quick test told me I was on the right track:

convert P4250049.JPG -resize 13.2352941% test.jpg

The first time I did this I forgot the % sign and got a 13×10 pixel image – not exactly what I wanted.

So, on to batch-converting everything in a directory:

mkdir ./resized
for i in *.JPG; do
echo $i
convert $i -resize 13.235941% -quality 20 ./resized/$i

And all my resized images were in the resized directory below the image directory. (Did I mention I wanted to reduce the quality so my images would be smaller too? Yep, that’s what the -quality line does.)