Ask HN: Why do smartphones take 16MB photos if 16MB of information is not there?
I find that most photos from an iPhone can be scaled down to ~400KB in an image editor and be indistinguishable from the original. There is no extra information in the excess data that the camera stores. What's going on here? Why doesn't JPEG compress away the excess 15MB automatically at the moment the photo is taken? Why isn't there an option in the UI to shoot at a lower resolution? Assuming that the excess 15MB is noise, why doesn't the camera itself automatically decide the optimum resolution?
6 comments
[ 2.1 ms ] story [ 22.7 ms ] threadWhat do you mean by "scaled down?" Scaled down implies reduced size. Are you reducing the size (fewer pixels) or increasing the compression with the same effective size (same number of pixels)?
How do you judge that it is indistinguishable from the original? If you zoom in on the original vs. the scaled down image I expect you will see a difference.
> If you zoom in on the original vs. the scaled down image I expect you will see a difference.
I do not see a difference (other than noise) if I zoom in. I.e., I can almost always scale down to a size that is some fraction of original in which the original and the scaled down photo are indistinguishable even when zoomed in. I'll zoom in on something like the license plate on a car to judge the point at which the original and resized images are equally readable or equally un-readable.
To examine "true" resolution of an image one could look at its autocorrelation or Fourier spectrum [2]
[1] https://en.wikipedia.org/wiki/Kell_factor
[2] https://photo.stackexchange.com/questions/107911/how-to-dete...
JPEG in particular has the problem that a constant quality setting doesn't get constant quality result. You might look at one photo and decide that quality 40 is good enough for a particular use. Some other image might require quality 55 to be good enough.
Thus you can't automatically compress images with JPEG on a large scale and know you'll be happy with the results. I compressed a million images years ago and regretted it because many of them were overcompressed.
Newer image formats have ways to specify perceptual quality that come much closer to "set and forget"
What a lossy compression algorithm is doing is to decide how unexpected a give bit of data is, assuming a certain model of image interpretation. There were decades of work thrown at it back when 512x512 pixels was high resolution, to create mathematical models of human vision that most closely match how people actually see the differences between images. This lets a computer decide how much changing a given pixel would effect how much a person would notice it being different. Doing this in an efficient and effective manner was not easy.
The least surprising bits get thrown away, in such a way that the process can be reversed to recreate the original image as closely as possible given the error budget and constraints of the encoding method, and the vision model used.
There camera sensor itself is optimized for doing one job... capturing light and converting that to a voltage. There are dedicated processors elsewhere that handle JPEG and other compression methods.
There is always an adjustment of quality available with lossy compression, everyone has their own preference for how much of the picture quality they are willing to lose, which is why there is usually a slider or preset somewhere you can adjust.
Professional photographers who are in high-stakes shoots record everything the sensor sees, without loss, in a RAW file. The incremental cost of the extra storage is far less than risking quality in these situations. Often a JPEG will be made at the same time, with the same file numbering to make it quicker to go through photos at the first sorting.
Steve Jobs could have picked some arbitrary value of compression, but that wouldn't have made it right.