detect bmp or png at runtime