Odd (and oddly transient) software (mis)behavior:
Could not find file 'gifski.dll'.
ScreenToGif seemingly losing or forgetting gifski.dll

Categories
HerpDerp Is that the way it is? Mucking About With Things Sodding soldering The Diary of Lupin Pooter TØØLS
Clip of a clip of a clip of yours truly soldering some pins into a prototyping board using Kester K100LD solder wire with additional flux, chosen to show circle-chasing rainbow light patterns caused by the reflection of the microscope’s LED ring light on the surface of air bubbles in the flux.
A longer and less-cropped version of this video is embedded in the preceding post on this site:
Getting back into the soldering saddle (Indium SAC305 vs. Kester K100LD with and without extra flux).

ScreenToGif (also: NickeManarin/ScreenToGif) is excellent, incredibly useful, and (in my experience) very reliable open-source software. I’m equally thankful for the existence of Gifski (sources: sindresorhus/Gifski [MIT-licensed]). I often use ScreenToGif for short screen recordings and for editing existing animated GIFs and frequently employ the STG animated GIF export sub-option that utilizes gifski. Additionally, the hundred-by-hundred-pixel animated GIF thumbnail for this post as well as most of the other animated thumbnails on this site were generated by running directories full of PNGs, generated from videos using the equally superb FFmpeg (sources mirrored here: FFmpeg/FFmpeg [LGPL/GPL-licensed]) software, through gifski.

Yesterday, I encountered an odd issue where ScreenToGif seemed unable to use its own bundled or downloaded-at-install-time version of gifski (gifski.dll).

A more detailed or perhaps just more verbose description of what happened: an attempt to export a modified version of a large animated GIF, via File > Save as and, in the Save as submenu that slides in from the right edge of STG, going with the Gif option and Gifski as the Encoder, failed and a message (Could not find file ‘gifski.dll’.) popped up in the upper right-hand corner pop-up where one ordinarily would see the progress bar for the file encoding/saving operation.

ScreenToGif also helpfully wrote a YY_MM_DD-named log file to a subdirectory nested within an eponymous directory created in the same folder as the GIF which I was editing: ScreenToGif/Logs/24_04_24.txt. The first entries in the log file are plaintive sqawks about not being able to connect to update servers (Unable to connect to the remote server, Impossible to check for updates on Github, Impossible to check for updates on Fosshub, yadda yadda) that are possibly related to my blocking outgoing and/or incoming connections for most software on the machine in question.

In any case, the pertinent part comes at the end:

â–º Title - 
	Encode
â–¬ Message - 
	Could not find file 'gifski.dll'.
â—‹ Type - 
	System.IO.FileNotFoundException
♦ [Version] Date/Hour - 
	[2.27.3] 04/24/2024 16:06:16
â–² Source - 
	mscorlib
â–¼ TargetSite - 
	Void WinIOError(Int32, System.String)
â™  StackTrace - 
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileInfo.get_Length()
   at ScreenToGif.Util.GifskiInterop..ctor()
   at ScreenToGif.Util.EncodingManager.d__26.MoveNext()

This message block appears more than once, but fewer times than the number of times I recall unsuccessfully trying to save that modified GIF. The gifski.dll file was still where it had always been and where it continues to reside, in the same folder as ScreenToGif.exe itself.

ScreenToGif's UI for specifying the paths to FFmpeg, gifski, etc. showing the default (bundled/downloaded-at-install-time) gifski.dll path and the path to another copy of gifski.dll that I downloaded in accordance with advice from ScreenToGif's creator in a reply to an issue posted on GitHub.
ScreenToGif’s UI for specifying the paths to FFmpeg, gifski, etc. showing the default (bundled/downloaded-at-install-time) gifski.dll path and the path to another copy of gifski.dll that I downloaded in accordance with advice from ScreenToGif’s creator in a reply to an issue posted on GitHub.

Among the results that turned up when I searched online for that error message were a few issues (i.e. bug reports with comment threads appended) on ScreenToGif’s GitHub repository. Nothing exactly like what I was seeing, but close-ish. In a response to It seems that I can’t download gifski.dll completely #572 (from back in 2020), ScreenToGif’s creator and maintainer replied with a download link to a gifski.dll. On a whim, I downloaded that file and changed the relevant ScreenToGif setting to point to it. A screencap of the relevant menu showing the default gifski path value and again with STG pointed at the just-downloaded copy is shown above.

That seemed to fix the problem, because I was able to save that large GIF file. Out of curiosity, I went into the ScreenToGif settings again today and changed the path back to its original value and STG was able to save GIFs using gifski just fine.

Whatever the issue was, it seems to have been transient and to have resolved itself somehow.