stable-diffusion.cpp icon indicating copy to clipboard operation
stable-diffusion.cpp copied to clipboard

Output image not saved if directory does not exists

Open olivbrau opened this issue 1 year ago • 1 comments

I think that if we use -o option with a path that does not exist yet, nothing is saved. And the log says : save result image to xxx without error message.

I think it would be nice if sd checked the existence of the directory and created it if necessary before saving the image.

olivbrau avatar Dec 23 '24 21:12 olivbrau

I have just added PR #912 to solve this. Unfortunately the library used does not give any detailed information about possible errors. In fact stb_image_write.h (line 77) tells: "Each function returns 0 on failure and non-0 on success."

I think : "created it if necessary before saving the image...."
... seems to be impossible. Consider there are many other reasons for failures, for example missing R/W access to the wanted path.

akleine avatar Oct 23 '25 13:10 akleine