Closed N-R-K closed 1 year ago
This seems to be due to the extension check. If filename is ./-
then the following branch won't execute and imlib_image_set_format()
won't get called.
Looks like this will be more tricky than imagined. If someone uses a.com
as the output filename, then we won't set any format and imlib2 will fail since it doesn't have any .com
savers.
I was thinking it might be good idea to retry with PNG set if the error from imlib2 is due to not having a saver for that format. However, then in cases like file.webp
the user most likely is going to expect a webp output. But if imlib2 doesn't have webp saver, and we end up silently saving it as PNG, then that's unexpected.
I don't think relying on extension to get the output file format was a good idea. We should probably just add a --format
flag so users can more explicitly set the output format.
Using: scrot --format webp
resulting file was .png
, expected was .webp
, checking with medianinfo & ffmpeg says webp:
> mediainfo 2023-04-28-113049_1920x1080_scrot.png
General
Complete name : 2023-04-28-113049_1920x1080_scrot.png
Format : WebP
File size : 88.2 KiB
Image
Format : WebP
> ffprobe -hide_banner 2023-04-28-113049_1920x1080_scrot.png
Input #0, webp_pipe, from '2023-04-28-113049_1920x1080_scrot.png':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: webp, yuv420p(tv, bt470bg/unknown/unknown), 1920x1080, 25 fps, 25 tbr, 25 tbn
It's safe to just rename to webp?
Using
-F -
however works fine.Originally posted at: https://github.com/resurrecting-open-source-projects/scrot/pull/229#issuecomment-1474518175