In the last days, I worked on a feature of a project that exports a JPEG image into a new browser tab using the Blob URL/Object URL pseudo protocol:
It was curious to see, that after exporting the image in the mentioned format in the new tab, when I tried to save the image using the context menu of Google Chrome (Right click over the image and clicking Save as), the file save dialog appeared like this:
As a developer, I know that the exported image is JPEG (JPEG Interchange Format), and not JFIF (JPEG File Interchange Format). So, what's the problem then? It seems that since Chrome 68 in some Windows systems, Chrome forces users to save JPG or JPEG images in JFIF format, making this a problematic specially, when you use tools that don't work when you provide images in the JFIF format.
In this article, I will share with you some of the possible solutions that will prevent the JFIF format from being used as default extension for JPEG images in Windows.
A. Fix through the Windows Registry Editor (REGEDIT)
The first option solves this problem entirely by replacing the default extension for JPEG images in the system. Launch the Registry Editor pressing Windows + R or opening the Run dialog window in the start menu. In this window, type the
In the new window that you will find (the registry editor), navigate to the following registry key:
Computer\HKEY_CLASSES_ROOT\MIME\Database\Content Type\image/jpeg. You will find a
REG_SZ value that contains the Extension of the JPEG mimetype. Do right click on this item and click on Modify:
.jpg and click on Ok.
After saving this change, the default extension when saving JPG images will be
.jpg instead of
B. Using a Chrome Extension (Save Image as Type)
There's an useful extension namely Save image as type that you can find the Chrome Web Store. This extension allows you to save any image from the web in the following formats without needing manual conversion:
The mime type will be forced, so you won't have the problem of saving the files with the JFIF mime-type anymore.
Happy coding ❤️!