Added isRef flag to the Image structure. Ref images cannot free image data.