Skip to content

Image.save_jpg cannot save to a directory that does not yet exist. #104236

Open
@calzila

Description

@calzila

Tested versions

4.4

System information

Windows 11 - Godot 4.4
MacOS 15.3.1 - Godot 4.4

Issue description

When running the Method save_jpg on the class Image, the Method will fail to save to a directory if it does not already exist on the disk.

This may be expected behaviour - however - The Error in the Output Log is very unspecific, reporting only:
ERROR: Can't save JPG at path: 'res://PATH/example/...

Would it be possible to either get the method to generate the required sub-folders needed, to save to any arbitrary path, or, get the ERROR message updated to be more descriptive as to why the JPG failed to save.

(PS - it's assumed that the same happens with the other image export types, but I have not tested these myself).

Relevent Documentation page:
https://docs.godotengine.org/en/stable/classes/class_image.html#class-image-method-save-jpg

Steps to reproduce

  1. Use the Method save_jpg to save an image.
  2. Input a path for the image to be save to, at some sub-folder that does not yet exist.
  3. Observe the ERROR.

Minimal reproduction project (MRP)

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions