added minimum image size check