Conversion of the icon image library to PNG
In a number of my applications, mainly IMT and Markin, I've been building a large library of interface icons based on the Nuvola GUI icons. All of them are in SVG format, and for Delphi use, I convert each one into 12 different BMP files, for three states (normal, hot, disabled) and four sizes (16, 24, 32, 48). These would be very useful for our Java GUI apps, but they need to be in transparent PNG formats, so I began investigating how best to do the conversions. I do my Delphi conversions using a script I wrote in the GIMP, one image at a time. However, for the entire library, which is now 145 images, that would be very tedious, and it would help to have a conversion tool which could later be adapted to provide other formats where required.
I started by learning that Inkscape has basic command-line functionality which enables me to load an SVG file and convert it to another size. I decided to call this functionality from a simple Delphi app, to give me more flexibility than batch files will provide. Having got the Delphi app to create PNGs at all four sizes, the next stage was to figure out how to create the disabled and hot images. At first, I thought ImageMagick would be the solution to this. I discovered that IM can do the lightening needed to produce a "hot" image like this:
convert minor.jpg -sigmoidal-contrast 4,0% minor_04.jpg
Next, I began to look for ways to produce the grayscale disabled images. IM can do this, too:
convert test.png -modulate 100,0 grey_brightness.png
These examples come from this excellent site.
So ImageMagick looks like the best tool to do the conversions. Initially, I decided it would be simplest to make copies of all the existing images in the hot
and disabled
folders, and then process those in-place. After some hacking around, I found I could only get Delphi to do that by using XCOPY instead of COPY. That's now working. I'm now reconsidering that approach, though, and I think it might be simpler to go through each of the images in each of the size folders, and create output hot and disabled images in their appropriate folders. using ImageMagick. That's for anotehr day -- ran out of time today.
Once this is done, I'll need to look at ways to assign images to actions in Java apps in an efficient and centralized way, as I'm able to do in Delphi, and figure out how Java might be able to use disabled and hot images as well as normal ones.