I'll talk about xterm here: it's an old piece of software and much of its terminology is now outdated. In man xterm it says:
iconName (class IconName)
Specifies a label for xterm when
iconified. Xterm provides no default value; some
window managers may assume the application name, e.g.,
"xterm"
Setting the iconName resource sets the icon label
unless overridden by zIconBeep or the control sequences
which change the window and icon labels.
That means that iconName must not be an icon image, it's just a label that's given to xterm window when it's iconified. It can be also set using -n option:
-n string
This option specifies the icon name for xterm's windows. It
is shorthand for specifying the "iconName" resource. Note
that this is not the same as the toolkit option -name (see
below). The default icon name is the application name.
After starting xterm like this, with a title != iconName I still can't see ICON string being shown after iconifying xterm window (Alt-F9 in fluxbox):
$ xterm -n ICON -T a-new-title
Digging further through xterm manpage one finds (** mine):
activeIcon (class ActiveIcon)
Specifies whether or not active
icon windows are to be used when the xterm window is
iconified, if this feature is compiled into xterm. The
active icon is a miniature representation of the
content of the window and will update as the content
changes. Not all window managers necessarily support
application icon windows. Some window managers will
allow you to enter keystrokes into the active icon
window. The default is "default".
Xterm accepts either a keyword (ignoring case) or the
number shown in parentheses:
false (0)
No active icon is shown.
true (1)
The active icon is shown. If you are using
twm, use this setting to enable active-icons.
default (2)
Xterm checks at startup, and shows an
active icon only for window managers which it
can identify and which are known to support the
feature. **These are fvwm (full support), and
window maker (limited).** A few other windows
managers (such as twm and ctwm) support active
icons, but do not support the exten- sions which
allow xterm to identify the window manager.
activeIcon is probably not directly related to iconName feature, however it gives us a clue that icon-related features in xterm work correctly only with some window managers. I recommend Xephyr for testing one either fvwm or window maker as specified in the manpage:
$ Xephyr :1 -ac -screen 800x600
and in another terminal:
$ DISPLAY=:1 wmaker
Now let's start xterm inside window maker: right click -> Applications -> Terminals -> xterm. Start xterm with -n option again:
$ xterm -n ICON -T a-new-title
Right click on the title bar and choose Miniaturize. Now you can see that an xterm icon is actually labeled ICON. Bring it back by clicking on it and see that titlebar is a-new-title. The conclusion is that iconName feature works only with some window managers, most probably older ones. If you feel strong you can browse window maker source code and patch your own window manager if it doesn't support iconName.
BTW, for changing xterm icon image see this: https://superuser.com/questions/344320/how-do-i-change-the-icon-of-an-xterm.