Download NetBeans!

20080326 Wednesday March 26, 2008

Resizing Images in NetBeans IDE

Small(ish) but annoying pet peeve of mine: I need an image for an application that I'm coding in NetBeans IDE. I go on-line and find the image that I need. I right-click the image on-line and save it right there, from my browser, into my application's source structure.

Then... dang! I open the image in the IDE and see that... its size is not what I would want it to be. So... I need to go outside the IDE (where it is cold, cold, cold) and change the image size there. Why? Because when you open the image in the IDE, you can only zoom. Not resize.

So, I've added a "Resize" menu item on image nodes in the explorer views:

When the menu item is selected, the image opens in a new dialog, which should be a TopComponent at some point, where you can resize the image (thanks to the Visual Library):

When you click OK, a new image is created (so, no worries, nothing will happen to your original image), in the same place as the old one, with a new name, consisting of the original name, plus the dimensions of your new image.

It is not perfect yet, but it is definitely already usable in most cases:

http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=6726

If your original image is very large and you want to make it smaller, you'll have problems, because the original image and the image you're resizing will overlap. As the image you're resizing gets smaller, you won't be able to see it anymore because the original image will cover it. Need to fix that. It works better if you want to make the image larger than the original.

The latest version of the plugin (1.2) includes antialiasing, but the quality of the image will definitely decrease as you increase its size. Advice on this point is very welcome.

Mar 26 2008, 01:25:27 AM PDT Permalink