Make Preview auto append file extension in macOS 10.15 Catalina

I have set the file extension to be shown in Finder settings.

When I open a JPEG in Preview, and try to File > Export and re-save it as JPEG for lower/higher quality, the file name's file extension is gone. I have to manually add .jpg in the file name when I save the file.

How to prevent Preview remove the file extension?

PS: It seems to be fixed in 10.16 Big Sur


I cannot replicate this behaviour in Big Sur. File > Export in Preview has a file extension, and that changes when I alter the format type.

In fact, even if I remove the file extension in the dialog, the file still gets a .jpg file extension.

However, a quick test of unchecking the Finder option to show extensions shows that it doesn't work: even after restarting Finder and opening new windows, the option doesn't change. So that might be a bug.

You could try the command line option instead:

defaults write NSGlobalDomain AppleShowAllExtensions -bool true

and then Force Quit the Finder, or restart.

If the option is still set to hide, then you won't see the extension in file dialogs. (In effect, you're name files myfile.jpg.jpg, but the last extension is hidden, and the first one is indeed 'useless'.)