refactored png reader to image class