Tuesday, June 24, 2008

Java 2D image-processing gotchas

I've been working with Java 2D a fair bit over the past few weeks and encountered a fair number of gotchas, or least behavior that seemed strange to me at first but that eventually made sense, once I thought about it and/or UTSL and figured out why it was working that way.

By way of background, I've mostly been developing web applications for the past eight years, so my experience with Java 2D is minimal. I've been investigating the image-processing capabilities of Java 2D because I need to implement a new feature for my photography web site, photoSIG. The feature will blur thumbnail images of photos on the photo-browsing pages if the "content rating" of those photos is either R or X, and the page is displaying advertising. The purpose of this new feature is to recover some advertising inventory that I currently can't use because advertisers don't want their ads appearing on the same page as R or X photos, even if they're thumbnails.

At various points in the process of working through all of these issues, I was feeling pretty unhappy with Java 2D and started to view it as another example of a Java API that is ostensibly very powerful but that is clunky and cumbersome to use. But I pressed on, because Java 2D has been around a while, and I felt that it must be better than my initial impression would suggest. Also, I noticed that I was unable to find a lot of web pages, blogs, and/or public postings complaining about the sorts of problems that I was having, which led me to think that maybe I was doing something wrong. It turned out that in most cases, I was doing something wrong, but Java 2D wasn't giving me much in the way of diagnostic assistance. After figuring out the solutions to my problems, I decided to post them here, in case other people run into the same difficulties.


Post a Comment

<< Home