Fix problem with scaling palleted images.