Photo thumbnail generation in J2ME

I have been working on a photo-application in J2ME. The main challenge turned out to be thumbnail generation. This isn’t really hard to do in the first place, the problem is the limited memory available. Trying to load photos captured with your mobile’s camera will most likely give you memory problems.

There is however one solution, which is to extract the thumbnail stored in the photo’s EXIF. Both Sony Ericsson and Nokia generate and put the thumbnail in the JPEG when you take a photo, but there is of course no guarantee that all photos have one.

The algorithm for extracting the thumbnail should be something like this: (where rByte is the byte you read)

1. Read through byte stream until you get rByte & 0xFF == 0xD8

2. Read thumbnail data until you find rByte & 0xFF == 0xD9

I found the necessary code as part of a slideshow tutorial (look for ImageFunctions.java in the downloadable source code)

Java Service Wrapper

Today I tested Java Service Wrapper by Tanuki Software. Basically it’s software for running your Java application as a service or daemon, and really eases the task of starting, stopping, logging and monitoring your application.

It worked like a dream, and was fairly easy to set up!

Confirmation, 3MX and work

This weekend I went to Asker, near Oslo, to attend my cousin Johanne’s confirmation. The church ceremony was exactly as boring as I thought it would be, but dinner and cakes at Johanne’s place “healed the wounds”.

Back in Trondheim, I’m now ready for a week of mathematics. My brother is in desperate need of help for preparing for his secondary high school exam in maths (3mx).

After a few lazy months, I now have more to fill my workdays with. Some might think it’s best to work a lot during the winter, but I prefer it the other way around since I have a lot more energy during the warmer and brighter period of the year. In other words, my motivation is top notch at the moment!

My next chess event is Trondheimsmesterskapet, starting next monday. It’s a 5 round monrad, classic chess tournament. My goal is 1st of 2nd place.