forked from open-edge-platform/datumaro
-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
save_image()uses the "png" extension by default for non-stringfpparam. It should be an error instead, because otherwise it can lead to unexpected image conversions.
Potential fix:
if isinstance(dst, IOBase):
if not ext:
raise ValueError("Image extension must be specified")
else:
# NOTE: Check destination path for existence
# OpenCV silently fails if target directory does not exist
dst_dir = osp.dirname(dst)
if dst_dir:
if create_dir:
os.makedirs(dst_dir, exist_ok=True)
elif not osp.isdir(dst_dir):
raise FileNotFoundError("Directory does not exist: '%s'" % dst_dir)
# file extension and actual encoding can differ
ext = ext if ext else osp.splitext(dst)[1]save_image()doesn't support crypters for no reason when Pillow backend is used.Imageshould not have a default extension of "png". It can be a default extension forVideoFrame, which currently doesn't have a default format.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels