update hasAlphaChannel() for 8bit images

update method hasAlphaChannel() to check transparency with 8bit images.
Without this, it creates black backgrounds.
Issue found by interrobang and Martijn Geerts. Thanks guys.