I've been comparing JPGs that have been exported from Photoshop from a layered and a flattened version. The jpg from the flattened version seems to always be about half the size. All jpgs were created using the same settings, same pixel size etc. So, does this mean the jpg created from the flattened image is lower quality? I that I should avoid exporting from a flattened version? I don't understand why the file size would be different, since I expected during the export process that the file would be flattened anyway. Any clarification is appreciated.
You can easily test 'differences' in two seemingly identical images using Photoshop itself.
In Photoshop, open both JPEGs. Hold down the Option or Alt key, and go to Image > Apply Image. Set whichever image isn't listed as the target as the source. Set the Channel as RGB. Set the Blending to Subtract, with an Opacity of 100, a Scale of 1, and an Offset of 128. If the images were truly identical, every pixel in the image would be a solid level 128 gray. Pixels that aren't level 128 gray are different by the amount they depart from 128 gray. You can use Levels to exaggerate the difference, which makes patterns easier to see. Random speckles are noise, embossed effects are errors in the zero position, or misregistration and you may see slight differences just due to the JPEG compression which AFAIK, is never 'identical'. But you should see very small differences in the two JPEGs. Try this with a TIFF, the results should be idential.
Author “Color Management for Photographers" & "Photoshop CC Color Management/pluralsight"