Use the pixmaps directly instead of converting them to PNG first

Also, some code cleanup