gdk pixbuf error loading jpeg files due to mime type issues

This issue almost drove me crazy...

On my laptop I had an issue suddently where I could not load jpeg files in gnome applications (anything using gdk). I would get the following error:

gi.repository.GLib.GError: gdk-pixbuf-error-quark: Couldn’t recognize the image file format for file “x.jpg” (3)

After much painful digging, I did finally find the issue. I have an unoffical gpxsee package installed on the system:

http://download.opensuse.org/repositories/home:/tumic:/GPXSee/Debian_12
Version: 13.39-1

This package installs the following mime types file:

/usr/share/mime/packages/gpxsee.xml

and in that file is included the following definition:

<mime-type type="application/vnd.vakaros.vkx">
            <comment>Vakaros VKX File</comment>
            <sub-class-of type="application/octet-stream"/>
            <generic-icon name="application/octet-stream"/>
            <magic>
                    <match type="byte" offset="0" value="0xFF"/>
            </magic>
            <glob pattern="*.vkx"/>
    </mime-type>

That definition is matching a file start starts with 0xFF, which jpeg files happen to start with, and so is getting matched and then failing to load.

Removing that definition from the file and running sudo update-mime-database /usr/share/mime fixes the problem.


Previous: 2024 solar eclipse