Table of contents
A walk through how photography works in general, how it works for phones, and how I do it personally. Just so I don't forget.
Note: I'm an amateur photographer and I've never used a real camera. Take my advice with caution.
Lens
Section titled 'Lens'The lens is an array of lens elements — tiny round bent pieces of glass or plastic, controlled by motors and firmware. There are many lens elements and not just one because optics are complicated and minimizing chromatic aberration, barrel distortion, and other stuff is hard.
Focal length
Section titled 'Focal length'The focal length is a basic parameter that defines a lens. It is the distance at which you need to put the lens away from the sensor for objects infinitely far away to become in focus. It depends on how curved the lens is and is measured in mm.
Field of view
Section titled 'Field of view'Assuming constant distance away from the sensor, the lens with a longer focal length will project a physically bigger image. Since the sensor stays the same size, this results in a narrower slice of reality being captured. The narrowness of this slice can be measured in degrees. For example, a camera can have an FOV of 69°x42°. It's rarely measured this way, however, because the focal length is easier to communicate.
Except it's not quite this simple. Since the field of view depends on both the focal length and the sensor size, the focal length on its own doesn't work as measure of the field of view. So instead, you pretend that the sensor is 36x24 mm regardless of how big it actually is and use the 35 mm equivalent focal length instead.
Phone manufacturers usually advertise the 35 mm equivalent focal length while Exif metadata shows the physical focal length. It's easy to tell which one is which because your 8 mm thick phone can't have a 24 mm thick lens.
Optical zoom
Section titled 'Optical zoom'Real cameras with zoom lenses have the ability to change the focal length — optical zoom. Since they can't change the curvature of the lens, they instead, basically speaking, take a convex lens element and a concave lens element and vary the distance between them, which results in the same effect somehow.
The vast majority of phones can't do optical zoom the way real cameras do because of space limitations. So instead, they resort to one of the following hacks:
- Digital zoom
- Cropping the middle of the frame and upsampling it to the full frame size. Needless to say, this causes noticeable quality loss.
- Multiple cameras
- Putting several cameras with different focal lengths into the same phone and switching between them on the fly. Since the cameras are all located at least a few mm away from each other, jerking artifacts occur when they switch.
- Periscope lens
- Since manufacturers can't put a long lens into a phone the obvious way, they put it perpendicular to the rest of the phone and use mirrors to redirect the light. Some phones even move the lens with motors. This one is technically a subcategory of multiple cameras because I'm not aware of any phone where the main camera has a periscope lens.
- Tetraprism lens
- This one is iPhone exclusive, so it doesn't really matter. Basically, it's the same thing as a periscope lens, but instead of mirrors, there's a long piece of glass that does all the reflecting internally.
If your phone is cheap, which it most likely is, you're limited exclusively to digital zoom because even if your phone has 2 cameras, the second camera is either a depth camera, completely unusable for photography, or a shitty camera with an ultrawide lens and a sensor with quarter the megapixels of the main camera.
Focus
Section titled 'Focus'Due to how Euclidian space works, light rays from objects far away arrive almost in parallel to each other while light rays from objects near you arrive diverging. If you converge light by a different amount, you change which objects are in focus. With a lens, this can be done by moving it closer or further away from the sensor:
- If the sensor is at the focal length, the light from far away converges just enough while the light from near you doesn't converge enough. This configuration is called infinity focus.
- If the sensor is further than the focal length, the light from near you converges just enough while the light from far away converges too much and ends up diverging.
The measure of how far away the objects in focus are is usually called the focal distance or the distance to subject. It's measured in meters or, sometimes, diopters (1/m).
Minimum and hyperfocal distances
Section titled 'Minimum and hyperfocal distances'There's a limit to how close you can focus in on a subject. You can only move the lens so far until you run into a limitation caused by either the thickness of the phone or by how much the engineers were willing to invest into the lens' design. Phones are really good in this regard — the minimum focal distance is usually somewhere between 7 and 10 cm, which is good enough for most casual macro shots.
There's also a limit to how far you can focus until objects stop getting sharper and become as sharp as the objects far away. When that happens depends on both the focal length and the aperture — the longer the focal length, the further the hyperfocal distance; the wider the aperture, the further the hyperfocal distance.
Compared to real cameras' lenses, phone lenses have really close hyperfocal distances — usually, something like 2 m. This is both a blessing (it's easier to get an object in focus) and a curse (you can't take portraits of people with strong bokeh without faking it). Mostly a blessing, though.
Manual and autofocus
Section titled 'Manual and autofocus'Cameras usually have 2 modes of focus: manual and autofocus. With manual focus, you set the focal distance yourself by tweaking it until the image looks right. On real cameras, this is done by rotating a ring on the lens. On phones, it's done with a slider on the touchscreen. With autofocus, the camera picks the right focal distance itself when you take a photo.
Phones also have an additional mode: continuous focus. When it's enabled, the focal distance changes continuously, adjusting to the current subject. It's like autofocus but with immediate feedback, which is why I recommend using it instead. It'll get you most of the way through, but you'll still have to use manual focus in the few cases where continuous focus gets confused.
Now, let's address the elephant in the room: When it comes to focusing, some phones are unfortunately fucked beyond repair because they have an uncalibrated lens. This is exactly as bad as it sounds — setting the focus to a specific value doesn't mean it'll always result in the same focal distance. This, for example, renders infinity focus unusable, making it so you have to use continuous focus even for objects far away. Both my current Samsung Galaxy A05 and my old POCO C40 are in this category.
You can check whether your phone's lens is calibrated by using
Camera2 Info. If the value of
android.lens.info.focusDistanceCalibration is either 0
(UNCALIBRATED) or 1 (APPROXIMATE), you're in trouble.
Aperture
Section titled 'Aperture'The aperture is another basic parameter that defines a lens. It is how wide the diameter of the lens is. As an absolute metric, it's measured in mm. The absolute aperture isn't advertised for phones, but in general, you can be confident that the phone with a bigger sensor will have a physically wider aperture.
Real cameras can usually change the aperture by obscuring part of the lens with plastic or metal blades. Phones usually can't.
Imagine the light source as a hole that is vomiting photons at random in all directions and the camera as a bucket that catches them. The bucket is only so wide and is only open for so long, so by sheer chance, some pixels will be more lucky to receive light than others. The aperture is what controls how wide that bucket is. The wider the aperture, the more light ends up on the sensor, the higher the chance a pixel will get hit with a photon.
Increasing the focal length, on the other hand, reduces the amount of light that ends up on the sensor. In order to compensate for this, zoom lenses on real cameras change the absolute aperture when changing the focal length. As such, it's often useful to measure the aperture relative to the focal length, as a fraction. For example, if the focal length is 6 mm and the lens is 3 mm wide, the relative aperture is f/2.
Depth of field
Section titled 'Depth of field'Due to complicated science reasons that I don't understand, how much the light diverges when an object isn't in focus, aka the depth of field, depends on the absolute aperture. The wider the aperture, the shallower the slice of reality in focus is. Since phones have tiny lenses, that slice is usually pretty deep.
Due to the aforementioned quirk of Euclidean space, depth of field also depends on the distance to subject. The closer the subject, the shallower the depth of field. It's especially noticeable when taking pictures of flowers — they're close to the lens but have depth to them. This is also the reason why "phones have no bokeh" is simply not true: Indeed, you'll get no bokeh if you're taking a photo of a human 2 m away, but you'll get plenty of bokeh if you're taking a photo of a cat 30 cm away. Your choice of the subject is what matters.
Sensor
Section titled 'Sensor'The sensor sits behind the lens and consists of a grid of tiny photodiodes covered in light filters, the values of which get read out, amplified, and formed into an image. The grid has a rectangular shape which is what makes images rectangular as well.
Unlike real cameras which usually have a sensor with a 3:2 aspect ratio, phones usually have a 4:3 sensor. Due to space constraints, they're also much smaller — the vast majority is less than a centimeter wide. 12 MP, and for Quad Bayer sensors, 50 MP seem to be the most popular resolutions. Most sensors output 10 bit samples while ones from high end phones may output 12 or 14 bits.
While the sensor is reading out the value of each pixel, read noise is introduced due to electrical interference. Additionally, since every pixel is read out sequentially, objects in the frame can move while it's happening, leading to rolling shutter artifacts. A few extremely expensive real cameras have global shutter which doesn't have this issue, however.
Frontside and backside illuminated sensors
Section titled 'Frontside and backside illuminated sensors'Most ancient phones, i.e. before iPhone 4, used to have a frontside illuminated sensor — one where everything is connected in such a way that the wires lie on top of the photodiodes rather than below, absorbing some of the light. This may sound really stupid, but it is in fact similar to how human eyes are wired. All even remotely modern phones use a backside illuminated sensor which doesn't make the same mistake, so you shouldn't be worried about it.
A few high end phones made since 2023, like Sony Xperia 1 V, have a stacked sensor — an iteration on the backside illuminated sensor where the photodiodes are split from their pixel transistors and stacked on top of each other, which makes it so there are no gaps between the photodidoes. This drastically improves light sensitivity, but unfortunately, the technology is still pretty new, so it'll take years for it to arrive to low end phones.
Bayer and Quad Bayer sensors
Section titled 'Bayer and Quad Bayer sensors'The old school way of making a sensor is by using a Bayer filter — the grid is split into blocks of 2x2 pixels where 2 pixels have green filters, 1 pixel has a red filter, and 1 pixel has a blue filter.
The new and improved™ way of making a sensor is by using a Quad Bayer filter — the light filters stay the same, but instead of each one having a single photodiode underneath, it instead has 4. This setup has some advantages:
- It quadruples the number of pixels without having to add more light filters. This lets the manufacturer put a bigger number in their marketing materials without spending much more money.
- If you don't need 50 MP, you can add up the 4 pixels and treat them as one, trading the resolution for the dynamic range. It won't give you more dynamic range than a similar 12 MP sensor though. The term for this is pixel binning.
- You can use the extra resolution for better digital zoom by cropping the middle quarter of the frame when you're at the 2x scale. Apple calls this feature "optical-quality zoom".
- You can use the extra pixels to take 2 photos at once and feed them to some HDR algorithm, but let's not talk about this.
For these reasons, primarily the first one, new phones mostly come with a main camera that has a Quad Bayer sensor.
Stabilization
Section titled 'Stabilization'Cameras generally provide a way to stabilize the image, i.e. reduce shaking. Shaking is an issue because it makes exposures longer than about 1/60th of a second hard to work with due to motion blur.
The good kind of stabilization is called optical image stabilization, and it works by using accelerometers to detect which way the phone is shaking and motors to move the lens the opposite way. That is unless you use an iPhone, in which case the sensor itself moves, not the lens. Unfortunately, OIS is currently not available in the majority of low end phones.
The bad kind of stabilization is called electronic image stabilization, and all it does is crop and rotate the image for you. For still photography, it's worse than useless because it doesn't prevent motion blur caused by shaking. It can be useful for shooting videos, but other than that, there's not much reason to ever enable it.
If you're one of the unlucky people like me who don't have OIS, your options are limited. You can buy a monopod (not a tripod or a gimbal, though, because those are surprisingly expensive), but I haven't tried it myself. You can also use walls and handrails as support for your phone, preventing shaking in at least one of the axes.
Exposure and ISO
Section titled 'Exposure and ISO'Apart from the aperture, cameras have 2 additional ways to control how much light gets onto the sensor:
- Variable exposure time
- The sensor can be turned on and collecting light for different amounts of time. Old real cameras used a physical shutter for this purpose. How long the sensor is collecting light for, i.e. the exposure, is measured in seconds or fractions of a second.
- Amplification
- The values of the pixels can additionally be amplified, either by using analog circuits or digitally. How sensitive the sensor becomes after this amplification is measured using a unit called ISO which is usually a number that's a multiple of 100. A 2x increase in ISO is equivalent to 1 stop of exposure, i.e. a 2x increase in the aperture's area.
There are limits to how low and how high you can set the ISO:
- The minimum ISO is also called the native ISO because it's the one where no amplification is happening. On my phone, it's 25.
- There are 2 kinds of maximum ISO: analog and digital. On my phone, it's 800 and 3200 respectively. If you set the ISO to a value higher the maximum analog ISO, digital amplification will be used instead of analog.
My current phone, Samsung Galaxy A05, is a bit unusual in this regard, however: The maximum it'll let you set is ISO 800 and 1/5 s exposure, even though it's perfectly capable of more, and will in fact accept higher values if you override the limits. I suspect there are more phones like this.
Line of exposure
Section titled 'Line of exposure'For real cameras, there exists such a concept as the exposure triangle, and it goes something like this:
- You can open up the aperture and let more light in, but this will make the depth of field more shallow.
- You can prolong the exposure and have more time to collect light, but this will make motion blur more pronounced.
- You can increase the ISO and make the sensor more sensitive, but this will reduce the precision of each pixel and make noise more pronounced.
The lesson you're supposed to learn from this is that all 3 parameters have drawbacks, and you're supposed to make a compromise based on what you're trying to achieve artistically.
Unfortunately, this doesn't work for phones. In most cases, you can't control the aperture, so the exposure triangle flattens into a line. This is, once again, both a blessing (you only have to deal with 2 parameters instead of 3) and a curse (you're more limited artistically).
Properly exposing photos
Section titled 'Properly exposing photos'Just like with the focus, cameras have a manual exposure mode — one where you set the ISO and the exposure yourself — and an automatic exposure mode — one where the camera tries to guess. When using the latter, you can correct the camera's guess by setting the exposure compensation. You can also usually set the ISO yourself and only let the camera pick the exposure. Unless you're doing something unusual, you don't really need to set both yourself.
Here are some strategies that are useful for exposing in certain situations:
- If it's dark and you can control the lighting
- Add more light. If you're taking a photo of a bug at night, turn on your phone's flashlight. If you're taking a photo of a document, bring it closer to the room's light source or also turn on the flashlight.
- If it's dark but you can't control the lighting
- Your phone will likely resort to a longer exposure, leading to motion blur caused by your hands shaking. You can counteract this by manually setting a higher ISO, making the camera pick a shorter exposure. If your phone has OIS, this is a good time to enable it.
- In general
- Underexpose then add the exposure back in the edit. During daytime, I lower the exposure by about 1 stop, and during nighttime, I do it by about 2 stops. This shortens the overall exposure times, and if it turns out the underexposed version fits the mood better, this lets you avoid lowering the exposure on a shot with blown out highlights.
Noise
Section titled 'Noise'There's a saying that goes "Film grain isn't an artifact, it's a structural component of film". This is technically true, but it's also an incomplete thought — noise is a structural component of any captured image. Just like film is made out of grains, digital photos are made out of digital noise. When you denoise an image, you remove detail and mangle with the colors, especially if you use a flawed color space like CIELab.
So my advice regarding noise is: Give it a chance. You can learn to like it.
Taking photos
Section titled 'Taking photos'Where and when?
Section titled 'Where and when?'Half of the success of your photo depends on how interesting the subject is. As I've found out time and time again, the most interesting subjects hide in the least interesting places. The ones you wouldn't want to visit on purpose because there's nothing to do there. Like, for example:
- Suburbs
- Rural areas
- Intercity roads
- Places with abandoned buildings
- Places with no buildings
- Boring parts of popular places
When it comes to finding boring parts of popular places, using a phone actually puts you at an advantage over users of real cameras. For whatever reason, some historical landmarks and, believe it or not, botanical gardens forbid "professional photography" and ask you to pay up. Taking photos on a phone with an artistic intent isn't a thing professionals usually do.
Similarly, the exact times you wouldn't want to go outside create the best vibes for your photos. Mostly because extreme weather conditions are interesting to see. Some examples include:
- When it's really hot
- When it's really cold
- When it's raining
- When it's snowing
- When it's windy
- Just before the sunrise
- Just before the sunset
- In the middle of the night
How?
Section titled 'How?'Photography in its execution is remarkably similar to programming — the main part of the brain you use is pattern recognition:
- You learn a bunch of patterns. In programming, this'd be things like control flow constructs, data structures, and algorithms. In photography, this'd be things like camera angles, exposure settings, and processing options.
- You learn to see those patterns in the problem you're trying to solve. The only way this is done is with repetition. You keep trying things until your brain develops associations. It's basically like training muscle memory.
- You cook up or stumble upon a deranged idea that sounds enticing, especially if it seems unique. In programming, this is done by being terminally online and diving down every conceivable rabbit hole. In photography, this is done by going outside and touching grass.
- You apply the patterns you'd learned and pull it off.
For obvious reasons, I can't teach your brain the necessary pattern recognition skills. The best I can do is give you the patterns. So here are some patterns:
- Embrace imperfections
- You're shooting on a technically inferior device. No amount of processing and no amount of AI will save you from the laws of physics — the lens is just too tiny. But that doesn't mean you can't use it to your advantage. People purposefully buy shitty cameras to take photos with a certain aesthetic, and you have a shitty camera right in your pocket. All you have to do is not try to hide away from it.
- Enable a framing guide in your camera app
- It may also be called something like the "grid". It'll help you geometrically align the scene. Some people swear by the rule of thirds, but I prefer a simple crosshair.
- Wipe the lens (duh)
- No matter how careful you think you are with handling your phone, you will accidentally touch the lens and gum it up with your fingerprints. If you don't wipe the lens before shooting, the image will look like it's covered in soap.
- Get close to the subject
- Most phones' main camera has a 35 mm equivalent focal length of something like 24 mm. This is roughly equivalent to the FOV of the human eye, including peripheral vision that you don't really pay attention to. In other words, it's pretty wide. It's better to get more of the subject in frame than to crop the frame and lose quality.
- Experiment with contrast
- Your opportunities for bokeh are limited — if the subject is more than half a meter away, the background will barely be blurry. Instead, try to use the brightness of objects and their positions in the frame to separate them from each other. Or try not separating them at all.
- Avoid your own shadow
- Unless it's Lahaina Noon for you right now, the sun is never exactly right above you. As such, there's always a chance your shadow will get into frame. Unless you're doing in purpose, it'll look really stupid. Try not to make it happen.
- Zoom in when taking macro photos
- If you shoot RAW, this won't actually crop the photo, but it will make it much easier to tell if the subject is in focus.
- Take many photos of the same subject in a row
- You're not shooting on film and you can afford making and throwing away a dozen extra attempts. This increases your chances of getting a good angle. If you're doing macro photography, this also increases your chances of getting the subject into focus. If you're shooting in the dark, this also increases your chances of avoiding motion blur.
Which camera app?
Section titled 'Which camera app?'HedgeCam 2. Case closed. With how many possible quirks Android cameras can have, no other app is as survivable. It's the only one I'm aware of that lets you override broken exposure/ISO limits, disable broken focus modes, and work around a million other firmware defects.
Now, don't get me wrong — HedgeCam 2 isn't a good camera app. The settings are miles deep and hard to comb through. The UX is unintuitive, and the learning curve is extremely steep. But on the other hand, it's extensively configurable — you can enable or disable every button or text label you see on the screen, you can tweak every imaginable file saving option, and you can even export the settings into a human readable XML file. Once you torture yourself enough to understand it, it becomes hard to give up.
To RAW or not to RAW
Section titled 'To RAW or not to RAW'When it comes to saving images, camera apps usually offer 2 options — JPEG and RAW:
- In the JPEG mode, photos are processed right away and saved as, well, JPEGs — lossily compressed images ready to be viewed.
- In the RAW mode, photos are saved as DNGs (digital negatives) — raw unprocessed dumps of the sensor data + the metadata you need to develop them. You can't view them right away without at least demosaicing and white balance. And no, they're not inverted like film negatives.
In most cases, DNGs are saved with no compression whatsoever — every negative from my phone weighs exactly 25 MB regardless of how complex the image is. In some cases, they're saved with lossless compression — either lossless JPEG92 or lossless JPEG XL. In the truly baffling case of Samsung Galaxy S23 Ultra and later, when using the stock camera app, they're saved as lossy JPEG XL which destroys quality.
Most users of real cameras prefer RAW, and the reasons why they do apply to you as well:
- Being able to do white balance ahead of time
- Being able to use slower and higher quality algorithms for demosaicing and denoising
- Preserving more dynamic range for additional exposure compensation and color grading
- Not having to deal with lossy compression artifacts during development
But since you use a phone, you have an additional reason — avoiding the atrocious processing phones do that makes photos look straight up deepfried if you look at them for more than 10 seconds or dare to zoom in. Granted, if you use the right camera app, you can turn off noise reduction and edge enhancement in the processing settings, but that may not always work: On my current Samsung Galaxy A05, disabling edge enhancement does nothing. The only way to avoid it is to shoot RAW.
But unfortunately, some phones can't shoot RAW because they don't support the Camera2 API at a hardware level. If your phone is from at least the late 2010s, it most likely does, and you don't need to worry about it. If it doesn't, however, you're fucked because you not only won't get RAW, but you also won't get any processing options, and half of the manual controls will be missing. It seems like on some phones it's possible to enable it, but I wouldn't be betting on it.
Developing photos
Section titled 'Developing photos'First, a sidenote: Some people have told me that I shouldn't use the term "develop" for digital photos. They're wrong — it's literally called a Digital NeGative. What do you do with a negative? You develop it. But on a more serious note, I just like using a skeuomorphic term for this process. It makes me feel better about myself staring into the screen for several hours nonstop.
Which software
Section titled 'Which software'The most popular software for photo development is Adobe Lightroom. The problem with it is, of course, the fact that it's made by Adobe — a company that sells ridiculously overpriced software (Lightroom is $12 per month which is 4% of a minimal monthly salary in Russia as of 2025) and does predatory shit like charging you a fee to cancel a subscription. If you do decide to use it, please do me a favor and pirate it. Don't give Adobe your money.
The 2 popular open source options are Darktable and RawTherapee. Functionality-wise, they're quite similar — both are cross-platform, both do non-destructive editing using sidecar files, both support lots of formats, and both have tons of modules. There are differences, however:
- Both apps have quirks in their UX, but in general, Darktable is better looking, better documented, and better organized.
- In RawTherapee, you use a directory browser to traverse the filesystem, and the app automatically scans and imports all of the photos inside. In Darktable, you need to import photos using a file picker every time there's an addition.
- RawTherapee uses a display-referred workflow — the tools treat the sensor data as an image that you change the appearance of. Darktable uses a scene-referred workflow — the modules treat the sensor data as measurements that the display transform forms an image out of. Darktable's approach makes more sense to me.
- Darktable's display transforms — filmic, AgX, and sigmoid — are really good at adding contrast to the image without breaking it. RawTherapee has alternatives, but they're hard to find, confusing to use, and don't have great defaults.
- RawTherapee's crop tool operates on pixel coordinates and dimensions. Darktable's operates on percentage offsets, which I find extremely uncomfortable.
- RawTherapee lets you adjust tool settings for multiple images at once with the Batch Edit feature. Darktable sort of lets you do the same by selectively copying history stacks.
- Darktable lets you selectively apply any module to a specific part of the photo using masks. RawTherapee does it with a dedicated Selective Editing tool.
- In RawTherapee, you get a list of tools split into categories, and you can bookmark the most frequently used ones. In Darktable, you can choose your own categories using module groups, but you don't have to because the built-in ones are already pretty good.
The app I use is RawTherapee. In order to understand why, let's examine my workflow:
- I have a custom preset called "bare minimum". It enables the modules I use most of the time, and sets the defaults I want for both the modules that are enabled and the ones that aren't.
- The preset is backed up in my dotfiles repo. It works right away because all you need to do is drop the right files in a specific directory, and my settings are backed up as well.
- Both the preset and the settings are easy to read because I only include the relevant stuff. You don't have to guess which parts were edited.
- When I want to update the preset, which happens extremely rarely, I just copy the relevant section from a sidecar file.
Now let's compare the 2 apps in this regard:
- RawTherapee keeps all of the processing parameters inside the photo's sidecar file. Darktable, in addition to that, remembers them globally for all images inside an SQLite database. You can stop it from doing so, but it'll forget your imports every time you exit.
- In RawTherapee, you can create a preset that enables specific tools and sets their parameters. In Darktable, you can create a preset, which will only apply to one specific module, or you can create a style, which does the same thing as RawTherapee's preset.
- In RawTherapee, the app settings, sidecar files, and presets all use the same human readable, easy to modify INI format. In Darktable, the app settings are stored in a plaintext key-value store. Presets and styles can be exported into a semi-human-readable XML format (that base64 encodes modules parameters), but they're internally stored in an SQLite database and have to be imported first.
- In RawTherapee, you can make a preset the default, and it'll be automatically applied to every undeveloped negative. In Darktable, you have to use Lua scripting to achieve the same. The AutoStyle script it ships with supposedly does just that, but I never managed to get it to work.
Realistically, I could achieve this workflow in either app. It's just that, in Darktable, I'd have to write a Lua script and get used to a clunkier import system. In the end, I had to decide whether I wanted Darktable's display transforms that don't hate me or RawTherapee's crop tool that doesn't hate me, and I chose the latter.
Demosaicing
Section titled 'Demosaicing'The first issue that needs to be fixed is that a pixel on the sensor has either a red, a green, or a blue channel while a pixel on the display has all 3. You could downsample, but that'd reduce the resolution, and that's no good. You could interpolate the missing values using a simple resampling kernel, but that'd introduce aliasing, zippering, false colors, and other artifacts. So instead, you use a demosaicing algorithm which, on top of interpolation, does complicated math stuff like gradient detection.
RawTherapee's default algorithm is AMaZE, and Darktable's is RCD. Both are pretty good, but in general, AMaZE is less blurry and less prone to moire patterns, and RCD is much faster and less prone to overshoots (random pixels being too dark or too bright). I prefer AMaZE.
Vignette correction
Section titled 'Vignette correction'This may come as a surprise, but phone lenses have a strong vignette, and the only reason you don't see it is because it's corrected in software. Take a look at these 2 versions of the same photo: with vignette correction, without vignette correction. This is a night and day difference.
On one hand, this is a disaster. Correcting the vignette means brightening the edges of the frame, which in turn means reducing sample precision for a substantial portion of the frame. Remember: your phone probably only outputs 10 bit samples to begin with.
On the other hand, this actually gives you more artistic choice. You can decide not to correct it and get a genuine, honest to god vignette that doesn't look edited in (because it isn't). This works particularly well when the subject is in the center of the frame and when it's hard to tell that the vignette is even there.
The metadata needed to correct the vignette is stored in the DNG as a series of processing instructions. RawTherapee lets you disable them in the Flat-Field section of the Raw tab. In Darktable, it's in the flat field correction section of the raw black/white point module.
White balance
Section titled 'White balance'How it works
Section titled 'How it works'The most important thing you need to understand about white balance is that nature has no concept of "pure white". As you probably know, white is a combination of all visible wavelengths of light, but that's not the whole story — the distribution of those wavelengths is not uniform. In fact, it's physically impossible to make it uniform. Some white has more blue, and some white has more yellow, but both are still white.
A convenient way to quantify that is color temperature — basically speaking, the temperature you need to heat something up to so it starts glowing with that wavelength distribution. Of course, it's not perfect because some lighting technologies produce a spikier spectrum than others, but it gets the idea across. For example, old incandescent lamps have a color temperature of 2700 K.
Human eyes don't get confused by different color temperatures because they perform chromatic adaptation. When you enter a place with a different color temperature, your eyes take a few minutes to adapt, but once they do, "pure white" becomes a completely different thing. Both 2700 K and 5700 K are "pure white" if you've sat in the room for long enough (without staring into your phone the entire time).
Unlike nature, however, technology does have a concept of "pure white". Almost all displays are calibrated to 6504 K, regardless of what the ambient color temperature is. So for all intents and purposes, as long as you're looking at a computer display, 6504 K is "pure white".
So what white balance does is work around the mismatch between the color temperature of the photo and the color temperature of the display. Or actually, it does more than this — the camera's photodiodes are not all equally sensitive to light because the filters have different dyes. This gives the image a heavy green tint which needs to be worked around as well.
The software does all of that is by scaling the values of the red and
blue channels, relative to the green. In order to calculate the
coefficients, it transforms the target white point from CIE XYZ to the
sensor's RGB profile using a ColorMatrix stored in the DNG metadata.
This matrix is usually precomputed by the manufacturer, but you can,
in theory, make your own.
Cameras have an ability to determine the color temperature of the scene and store it in the DNG metadata — auto white balance. When you specify the color temperature on your own, it's called manual white balance. You don't necessarily have to specify it correctly — if you're off, the image will have a yellow or a blue tint.
How I use it
Section titled 'How I use it'I'll be upfront — I'm not a fan of auto white balance. In fact, I'd go as far as to say that it's harmful:
- In general, it's inconsistent. If you take several photos in the same location, they'll all have slightly different color rendering, which drives me insane.
- It's also easy to confuse by a scene with no neutral tones, like for example, plants.
- There are numerous cases where the unusual color temperature is part
of the vibe that you're not supposed to correct:
- Warm glow of a high pressure sodium street lamp
- Magenta tint of the sky after a sunset
- Sad overcast day
- Some weather conditions, like sandstorms, that tint the atmosphere
- Contrasting color temperatures, like a cold street vs a warm room behind a window
- Auto white balance stops you from thinking about color temperature, making you miss many possible artistic choices.
So instead, I use a small set of specific color temperatures, most of which correspond to a CIE standard illuminant:
- 5003 K aka D50
- Direct sunlight
- 5503 K aka D55
- Mild shadow
- 6504 K aka D65
- Overcast daylight
- 6004 K
- In between D55 and D65
- 4000 K
- The color temperature that most modern eye searing LED street lights have
D50 produces the result I want most of the time, so that's what I stick to for most of my photos.
RGB profile management
Section titled 'RGB profile management'Even at this point in the process, the data from the sensor still can't be displayed as-is. One of the reasons for this is that the "RGB" of the sensor is not at all the same as the "RGB" of the display. The light filters of the sensor collect wide overlapping bands of wavelengths in order to capture as much of the spectrum as possible. The subpixels of the display are narrowband and barely overlapping so the pixels can represent highly saturated colors.
There's no way to really solve this issue, but you can sort of
approximate it with a multiplication by another matrix stored in the
DNG metadata. This time, it's ForwardMatrix which is basically the
opposite of ColorMatrix — it converts the sensor's RGB values into
CIE XYZ. The software then converts it into an intermediate wide gamut
RGB profile (like Rec.2020), and after all of the processing is done,
it converts that to the RGB profile of the display (like sRGB).
Unfortunately, you can't feed those directly to a monitor either. Due to historical reasons (the way CRT TVs worked) and the lucky coincidence that it reduces memory bandwidth, you need to first do gamma encoding — give more bits to dark values and fewer bits to bright values.
It's important to note that, generally, gamma encoded values should only be used for displaying and storing images — you're not supposed to modify them without decoding them first, i.e. turning them linear. Some software does do that, but it's wrong. Luckily, both RawTherapee and Darktable do it the right way for you.
Tone curve
Section titled 'Tone curve'Gamma encoding, however, isn't enough. If you encode an image with a certain gamma, and the monitor decodes it with the same gamma, that only changes its internal representation and not the appearance. If all you do is apply demosaicing, white balance, and gamma encoding, the photo will look flat and washed out. The reason why is a bit complicated.
Real life has an insane dynamic range — the Sun is thousands of times brighter than a lightbulb. Your sensor isn't as smart as your eyes, and it can't dynamically adjust gain for every individual pixel, so it only cuts a small slice out of that dynamic range, and your eyes aren't fooled by this. Luckily, they're easy to trick — all you have to do is put the RGB intensity values through a sigmoid function (ideally, in a way that bends the hues like film), and the photo starts to look more natural.
An easy way to accomplish this is with a tone curve. It lets you create a mapping between the original intensity values and the intensity values you want to get, either by drawing a function or by tweaking sliders. In RawTherapee, you can do it with the Tone curve module of the Exposure tool. I personally set the curve type to Control Cage and the curve mode to Film-Like since those seem to act in the most intuitive way. In Darktable, you don't need a tone curve because the display transforms solve this issue for you.
Cropping, rotating, and scaling
Section titled 'Cropping, rotating, and scaling'After you've made your photo visually pleasing, you may want to additionally refine its framing by cropping. In fact, you probably should — a good crop can make or break your photo, so don't underestimate its power. If you're willing to accept resampling artifacts, you may want to rotate and scale as well.
One thing you should always keep in mind is that if there's a bright object on the edge of frame, and your crop slices it in half, it'll look really ugly. So please, mind the edges of the frame.
Things I don't do
Section titled 'Things I don't do'Due to my odd tastes, there's a number of artifacts I actually like, unlike most people: blooming, digital noise, chromatic aberration, and barrel distortion. For this reason, I don't correct them in any way whatsoever. Additionally, I don't do any sharpening or saturation boost. These not only introduce artifacts that I don't like, but also serve as a "make your photo punchier" cheat code that I don't feel like letting myself use. Limitations breed innovation, after all.