I'm not really sure why taking screenshots in macOS defaults to PNG file format. I just googled this and the "answer" was:
MacOS captures screenshots using PNG as the default image format, which provides lossless compression and preserves image quality while creating relatively small files.
OK - I can understand somewhat the logic behind this - "we're a premium brand, even the screenshots should be premium, jokes aside, whilst I agree with the part about the format being lossless I'm surely (and don't call me Shirley!) that the part about small files is non-sense.
PNGs, especially when using the "Retina"-mode HiDPI, create large file as the format default compression engine is DEFLATE which is OK but the problem is not the algorithm itself, the issue is that is has to deal with a large set of data (lossless compression i.e. not one pixel can be lost). When using a 4K display in 1080p mode - that translates to really big files (usually a couple of megs).
Why is this an issue for me? I keep all my screenshots and sync them in iCloud. It be rather useful to have them - assign dates to images over large periods of time and you can reconstruct a bit of the past e.g. "What was I doing that day? Oh, I was making a meme about moths".
But I digress, I always forget how the command to change the default image format to jpeg and as far as I know still there's is no global UI way to set it - therefore here goes, the magic commands:
defaults write com.apple.screencapture type jpg killall SystemUIServer
The first line is easy to decipher as for the second one the only question is what SystemUIServer is - well, according to its man page:
SystemUIServer(8) System Manager's Manual SystemUIServer(8) NAME SystemUIServer – Presents status items in the upper right of menu bar DESCRIPTION SystemUIServer is a system service which presents status items in your menu bar. There are no options for SystemUIServer, and users should not run SystemUIServer manually. macOS July 4, 2018 macOS
The cherry on the top? How to set the location of your newly saved JPEG screenshots:
Command + Shift + 5
=> there's an UI at the bottom where you can click "Options" and select the new folder where the screenshots will be saved.