What does JPEG actually do? (in camera)

I watched this video recently about a subject that frequently crops up in Photography on the nature of JPEG compression, and just how much compression should be applied, and what resolution you should use (in camera) if you’re a JPEG-shooter.

Even though the video was a bit turgid in places, it got me to thinking about what a JPEG image looks like coming out of my camera against the RAW image I process. I watched it right to the end which showed some sticking power. I’ll give you what I interpreted as the main points of interest.

Pixels are more important than the Quality slider when saving a JPEG for the best image. So save with loads of Pixels – original number if possible, don’t drop the resolution therefore – and use a lower quality setting to reduce image size if that’s an issue for the card in your camera. Then in post-production, as suggested in what I consider (imho) to be the best written expose of JPEG and Lightroom by Friedl, when you drop below 72-80% quality (compression) there’s not much decrease in image size, and very little drop-off in visual presentation.

I’m fortunate to have two card slots in the Sony A7r MkIII and have set it up so that a JPEG image is sent to the second slot. This image is configurable by Quality (ie resolution – X-Fine, Fine, Standard) and Size (ie relating to the amount of compression applied – high 42m, medium 18m and small 11m). I thought it might be interesting to see what the images looked like when taken in a challenging lighting situation that required ISO 4000 to get a shot at 1/60@f4 on a 24mm lens. I thought I’d look at the RAW image as well to see how “superior” it was!!!

Well that was interesting. Out of the camera all the JPEG images were sharper and that really puzzled me. Why? It took me a short while to realise that I’d forgotten the reason why I shot in RAW in the first place. Duh! RAW just captures what the camera sees. It doesn’t apply any corrections. It just sees the image and records it. Phew! I realised I had to look at Noise Reduction and Sharpening to get the RAW image close to what the JPEG was giving me, but I have to admit the JPEG taken at Xtra-Fine and High gave a very good image straight out of the camera (that’s the one on the right above), and if I didn’t want to do any post-processing, I’d have been happy with it.

[Note the shot on the left is the unprocessed RAW image saved with no compression; the one in the centre is the processed RAW image at 80% quality (compression)]

Some statistics for the JPEG shots:

Size of image from camera Original Resolution Cropped Resolution Saved at 80% compression Saved at 100% (no) compression
XF-H 23.4MB 7952×5304 2137×2137 946KB 2.8MB
XF-S 7.3MB 3984×2656 1070×1070 365KB 886KB
Std-H 7.6MB 7952×7952 2102×2102 901KB 2.4MB
Std-S 2.7MB 3984×2656 1088×1088 384KB 824KB

XF = Xtra-Fine (high resolution)
Std = “standard” resolution
H = High File Size (ie little compression to reduce file size)
S = Small (ie considerable compression to reduce file size)

I cropped all the images including the RAW image (originally 85.8Mb in size) to a square to get a comparable image at each resolution. For the RAW image this was 2126×2126 – comparable with the XF-L and Std-L JPEG images. I then saved the images at 80% Quality and 100% Quality (ie no compression) in Lightroom. For the RAW file this gave figures of 4.9Mb for the 100% Quality, and 1.5Mb for the 80% Quality. So you end up getting a JPEG from a RAW file (at this resolution) that is not greatly different from the JPEG taken from the camera.

How did I get the RAW to outperform the JPEG? I had to look at a number of sliders in Lightroom. Starting with Noise Reduction and then moving on to using Texture to arrive at an image that I liked. So the question is … is it worth using JPEG to just capture the moment. The answer is most definitely YES. I’ve always said that, and this piece of empirical research suggests that JPEG in the Sony camera is very good at noise reduction and sharpening. You may lose the colour information and the tones are not represented quite as well; but in this poor lighting situation where the ISO is very high (ISO 4000) the quality of the JPEG image is very good. So, armed with this information I just need to make a decision on how I set the camera up. Do I want to save a JPEG image as a backup to the RAW, in which case I need to set it to XF-H (in my notation), or for taking the card out of the camera to share on social media, in which case I would probably set the camera to record the JPEG shot as a Std-S image.

These are some of the test shots taken whilst I had my feet up! You can download the originals from the [Download] link under the photo if you want to more closely examine them.

The uncropped Std-S JPEG image saved at 100% [Download]

The cropped JPEG image saved from Lr at 100% reducing the file size to 2.8Mb; a loss of detail, but generally excellent noise reduction. [Download]

The cropped RAW image, grain and noise present because of high ISO [Download]

The finished RAW image at 80% Quality, after Noise Reduction – luminance and sharpening applied, as well as a bit of Texture added. Image size now 1.7Mb reduced from 6.4Mb cropped image. [Download]

So a final conclusion … if you’re a JPEG-man, I guess you should do the minimum amount of compression in camera, and you should shoot at the highest possible resolution. Then in post-processing you can safely save your JPEG at a reasonably high-rate of compression (lower quality setting) whilst keeping the resolution as high as you can. Does that rather obvious statement make sense?

Publishing images from Lightroom to Flickr, Dropbox and the web

This is not a post that replaces or upgrades any information published elsewhere … it just clarifies in my mind what I should do when I setup a Publish service in Lightroom, or Export from Lightroom with the intention of using an image on another service. Just to be clear, there is no right solution, just a number of things you need to bear in mind. What are these?

Well to start with, the output medium or device, is critical as it will affect the sizing decision of the image you make prior to publishing, or export.

There is the format of the image which is related to the above – it might be TIFF if the image is to be printed, otherwise it is likely to be PNG (from Lr Classic 8.4, August 2019), or more likely JPEG.

Then there is the compression, or quality, you decide to accept if you’re converting from RAW to JPEG. This won’t be an issue if you’re already working with a native JPEG image, unless it’s produced a very large file size when you might consider some further compression, prior to the re-sizing I discuss below.

So … the output device. If it’s going to a print shop you’ll probably be selecting TIFF and will size the image as you require it – so I’ll ignore that except to say that you need to enquire what Resolution the print shop can accept – the file size will be large, depend on that! If it’s going to your printer then you’re going to print to the maximum size that your printer will allow and you should use the Print module in Lightroom, but making sure that you let the printer control the  Colour Management. You might need to convert to JPEG to print to your printer, if there is no device driver for your printer in Lightroom and then you will have to Export first; but if you’re using the Print module in Lightroom, this will not be necessary.

If the export is to a display screen you need to know the dimensions that the screen will support. There is no sense in sizing an image larger than the device is capable of displaying as that will just produce an image file size larger than it needs to be. Likewise it’s debatable whether it’s desirable to enlarge an image to match the dimensions of the device as that will involve interpolation (inventing data) and the image quality will therefore drop – let the device do the re-sizing if necessary!

So the Lightroom settings for a 4K screen might be either of …

… or …

… of which I’d probably select the latter. Note the Resolution field. This is totally superfluous when exporting an image for a screen display, or indeed for the web. Note also the Sharpen options which you should choose appropriately. If you’ve sharpened in the Lightroom Develop module already, you might not want to further Sharpen here.

If you’re exporting to Flickr or Google Photos then you need to take note of the size that the service will accept. For Flickr each image will have to be less than 200Mb (or it will be compressed), but with a cap on file storage space of 1Tb and 1000 images in total it makes sense to use an Image Sizing long edge value of 1024px. For Flickr Pro users there is no limit, so you can size as you wish. If you’re using Google Photos then the “free” allowance limit is 16mp for each image, so it’s perhaps worth bearing this in mind and using an Image Sizing Megapixel size of 16mp.

If you’re Exporting (Publishing) to the web you need to consider the maximum size that you can “get away with”, because the smaller the image size, the faster it will load. Generally, I’d probably use a Long Edge Value of 1024px and Sharpen to a High level.

Now we come to the RAW to JPEG conversion, which like re-sizing of the image dimensions  will also affect the file size of your image.

Lightroom fortunately provides only one parameter to consider here, after you’ve chosen the Colour Space which should normally be sRGB. This parameter is called Quality. It doesn’t call it “compression” because it is taken as read that JPEG is a lossy format, and that compression and loss of data will take place in the transformation. It is left to you to decide what level of Quality you can accept. To help you Jeffrey Friedl has written an excellent, one might even go so far as saying the definitive, article on the subject. So much so that I’m not going to even try and summarise it. But having read it – which you should, you might also choose to look at this one too.

From reading this and my own experiments, I’ve decided to adopt a Quality setting of 72 as my general purpose setting. It’s NOT a good idea to Limit the File Size here – instead look at re-sizing the image as previously described to reduce the file size, if necessary.

So to export to Dropbox for instance, to share images on a 4K screen, my settings would be …

And that’s it.