It looks like the background color of this window has a fairly strong gradient, so it can vary from a fairly light blue to rather dark. I’m guessing that is the reason that your image didn’t match when the window was a different shape.
There are several ways you might solve the problem. The first would be to capture a smaller image of the icon you need, avoiding capturing the background color. I think that approach would work well for some of the icons, but others are quite small which might make this difficult.
You could also try increasing the tolerance of the image to see if that will enable it to be found on any background color. Use the Image Doctor for this. The danger of course is that once you increase the tolerance enough for the icon to be found, you may also start getting false matches in other places. The Image Doctor will increase the tolerance in steps of 5 until the image is found, and report how many places on the screen it was found. You can do fine adjustments manually to see if there is an optimal tolerance level that will work.
Or simply capture multiple images of each icon. Probably one image on the lightest color and one on the darkest color would be enough.
If none of those approaches works, you could capture an image and then edit it in an external tool to set the background pixels to be clear. Then eggPlant will ignore those pixels and the background color will no longer be a problem.
The other possibility would be to have your script set the window to be the same size each time the script is run. To do this you would script the same actions that a person would take to resize the window, whether that involves dragging a corner of the window to a new location or whatever. One good approach is to first drag the top left corner of the window to a fixed location on the screen, and then drag the lower right corner to a corresponding known location.
Hopefully one of those approaches will work for you.