removing #.png hack from image script if the image file extension is known