CodeKit optimizes JPEGs with a tool called JPEGOptim. By default, these optimizations are lossless, meaning there is no reduction in image quality. You can, however, enable lossy compression for smaller file sizes.
The Image Inspector
Select one or more JPEG images in CodeKit and you'll see the Image Inspector:
If you don't see this section of the Image Inspector, make sure you've selected only JPEG images.
The slider allows you to trade image quality for smaller file sizes. When this is set to 100%, JPEGOptim works by deleting extra metadata and then recompressing your image file. No changes are made to the actual image data, however, so this process has no effect on the visual quality of the image.
At lower qualities, JPEGOptim begins modifying image data to achieve lower file sizes. Below 85%, you may start to see "artifacts" in the optimized image. The lowest quality you can use effectively will vary from image to image, but 85%-90% is a good starting point.
A Note About "Initial Size"
This is how large an image was the first time CodeKit ever saw it. The value never changes. So, if you start with a small image (say, 50x50 px) and then replace it with a bigger one (say, 5000x5000 px), it's possible that the current size may be larger than the initial size, even after optimization. In this case, the initial size isn't really accurate because it was set when a smaller file occupied the path.
Output Path & Action
These options apply to files of all types. They are explained in Setting Output Paths & Actions.
Normally, CodeKit will not copy or process a file if its output path is the same as its input path. The exception to this is images.
On The Horizon
In March 2017, Google released a new JPEG encoder named Guetzli. This encoder produces JPEGs that are about 35% smaller than existing methods.
Guetzli is not quite ready for CodeKit, however. The algorithm currently takes about 30 minutes and 15 gigabytes of RAM to process a large JPEG image. Even relatively small images take 10 minutes and multiple GB of memory. The Guetzli team is working to improve these shortcomings and, once they do, I'll incorporate the algorithm into CodeKit.