• Share this article:

Image View plugin

Thursday, February 23, 2006 - 14:20 by Wayne Beaton

I do all of my editing of the pages on eclipse.org (including editing articles for Eclipse Corner) using Eclipse Web Tools. I personally don’t mind looking at HTML, and the HTML editor provided with Web Tools is top-notch (a lot of the content on eclipse.org is represented in XML, which Web Tools handles quite well also). So, I basically have everything I need. Sure, I might like to have a fancier WYSIWYG editor, but I’m not one to complain.

I say basically, because there are a few things missing. I quite dislike having to leave the comfort of my Eclipse development environment to do things like manipulate image files and what-not. Especially since most of the things that I do to image files is pretty simple: resize and crop.

I had a couple of hours to kill while sitting on an airplane (I believe that I write more software on airplanes than anywhere else), so I started developing a couple of handy plug-ins to suit my needs. The first plug-in is an image viewer: all it does is display the selected image. I hooked into the workbench’s selection service and listen for selection changes. If an image file is selected, the view displays it.


Here, it’s displaying one of the pictures I took during the Eclipse in Motion roadtrip while we were in San Diego. The view displays a scaled-down version of the image. If you hover the mouse over the image, it pops up a window showing the image in its full-size glory. The full size image goes away when you move the mouse off the image or click it (I discovered that moving the mouse off the image just doesn’t cut it when the image is larger than the screen). At some point, I may decide to add scroll bars, but I don’t need them today so that’ll be put off until some other time.

The next plug-in generates thumbnails (scaled down variants) of pictures. The first plug-in literally took me 20 minutes to build. The second one is taking longer for two reasons: (1) making a GIF thumbnail from a JPEG image (for example) requires that I somehow intelligently create an 8-bit palette; and (2) I’ve decided to build a wizard that steps the user through the various options for creating a thumbnail and I really hate laying out user interfaces. Number (1) may go away as I am very close to deciding that it’s okay for a thumbnail to just be the same format (and use the same palette) as the original. Alternatively, I’m assuming that this is a problem that’s been solved before and that with a little research there’s probably a solution out there that I can leverage. Number (2) is going to be helped along by the Visual Editor.

Of course in a vibrant community such as ours, there are plug-ins and products that do this sort of thing already (plus a whole lot more). For example, MyEclipse has image editing and preview capabilities built into it. QuickImage appears to be about as functional as what I created (and is apparently bundled with Yoxos and Exadel Studio). Then there’s “A Basic Image Viewer” on Eclipse Corner Articles (not a plug-in, but still interesting stuff).

I’ll make my plug-ins available to anybody who wants them. I’m about mid-way through setting up an “Evangelism” site on eclipse.org where I can put stuff like this. Watch this space for more information.

Tags