Found another copy in renderer/Cinematic.cpp. Move the newer implementation from renderer/Image_files.cpp in its own file and use the libjpeg v8c license blob (which is where this code comes from). Adapt README too with the v8c license.