Refactor ImageResource, reduce its size