Professional Development

Pro-D
  • Front Page
  • Contact
  • Log in
  • « Installed and tested NetBeans 6.0
  • More work on reflection and prefs »

Conversion of the icon image library to PNG

Posted by mholmes on 11 Jun 2007 in Activity log

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.

This entry was posted by Martin and filed under Activity log.

Professional Development

This blog is used to record research and learning we do which is not part of a specific project, such as learning a new programming language in anticipation of using it for future projects, or installing and testing development tools that may be useful.
  • Home
  • Recently
  • Archives
  • Categories
  • Latest comments

Search

Categories

  • All
  • Activity log
  • Announcements
  • Tasks

XML Feeds

  • RSS 2.0: Posts
  • Atom: Posts
What is RSS?

Recent Posts

  • Expenses claim
  • Another hour on QT
  • A little QT learning
  • Repro training
  • POS tagging tool
  • QT: learning about directory views and models
  • QT: Preparing icon collection for use as a resource
  • QT: learning about namespaces, enums, and writing classes
  • QT: Successful portable app with SVG icons
  • QT work

Sidebar 2

This is the "Sidebar 2" container. You can place any widget you like in here. In the evo toolbar at the top of this page, select "Customize", then "Blog Widgets".

This collection ©2026 by admin • Help • Website builder