I often take pictures with food as the subject (foreground) and a monument in the background.

Problem: Using a Pixel 6 smartphone, either subject or background is blurry.

Reading How do I keep both the background and foreground in the image in focus at the same time?, I suspect this may be because the Pixel 6 has what is often described in smartphone literature as an ultra-wide sensor (Sony IMX386 1/1.31″ sensor, 1.2µm pixels, 24 mm equivalent f/1.85-aperture lens).

Question: Is there any way (probably a focus stacking software-based solution but I am open to anything else) to capture both sharp foreground and background onto the same picture file? Maybe I missed a setting, or maybe an app exists specifically to do quick focus stacking for the Pixel 6?

Smartphones can do HDR, so it sounds to me that they could do this as well when the user wants (taking several pictures then merging quickly without letting the user see that several pictures were taken). Is it fundamentally more difficult to achieve than HDR, for some reason?


  • The foreground object is around 1 meter from the lens and the background object is around 1 kilometer from the lens.
  • Same issue when taking a picture of my friend 5 meters away with the Eiffel Tower 5 kilometers in the back: Either one is unrecognizable, and the phone fails to capture what any other smartphones can do easily.
  • I am not using Portrait Mode (the new name for Lens Blur).
  • \$\begingroup\$ It's not really correct to speak about an ultra-wide sensor. The lens and the sensor are two different things (working together of course), but it's the lens that determines the angle of view, not really the sensor per se. \$\endgroup\$
    – osullic
    Dec 5, 2022 at 12:44
  • 2
    \$\begingroup\$ Are you sure that you don't have some Lens Blur type effect enabled? \$\endgroup\$
    – osullic
    Dec 5, 2022 at 12:54
  • \$\begingroup\$ @osullic Angle of view is a direct product of both the lens focal length and the sensor size. Consider an 80mm lens. On a 1/2.3" sensor, diagonal AoV is 5.6°. With µ4/3 it's 15.5°. APS-C gives 20°, FF yields 30.3°, 4X5 winds up with 86° AoV, and 8X10 is 124°. \$\endgroup\$
    – Michael C
    Dec 5, 2022 at 21:28
  • 1
    \$\begingroup\$ I just knew someone was going to argue with me! I'm well aware of all of that. Still - it is not right to talk of a wide-angle sensor. And your counter-example is facetious, because all your hypothetical 80mm lenses have different size image circles. You can't put a phone lens on a large format camera, and all of a sudden expect to have a wide-angle field of view. And I know you know that too. But here we are, veering off-topic. \$\endgroup\$
    – osullic
    Dec 5, 2022 at 23:20
  • \$\begingroup\$ @osullic: I am not using Portrait Mode (the new name for Lens Blur). \$\endgroup\$ Dec 8, 2022 at 10:34

4 Answers 4


The amount of optical background (or foreground) blur is controlled by several parameters:

  1. Focal length: longer focal lengths give more background blur, shorter focal lengths less
  2. Aperture: wide open shots give more background blur, stopped down shots give less background blur
  3. Sensor size: bigger sensors give more background blur if effective focal length stays the same (having the same field of view -- not the same as physical focal length staying the same) and if aperture F-number stays the same, smaller sensors give less blur in these circumstances
  4. Subject distance: macro shots (shots of something nearby) give more background blur, shots of something further away give less background blur

I'm sorry to say your Pixel 6 can't take the photos you want. A smartphone camera has a fixed aperture and it's usually relatively wide (something like f/1.8). The focal length is usually normal, not superwide, not tele. Sensor size is small, but do keep in mind that the small sensor size works to reduce background blur whereas the wide aperture works to increase background blur. So the small sensor doesn't give you an entirely background blur free image. Additionally, for a smartphone the Pixel 6 sensor is extraordinarily large.

What you can adjust is the subject distance. Move the food further away from the camera (or the camera further away from the food), and you reduce the blur.

However, this may not give you the composition you want.

Background blur is:

b = f*m_s / N * x_d / (s ± x_d)

where f is focal length, m_s is subject magnification (e.g. 2 meter human is 24mm on sensor => magnification 24/2000 = 0.012), N is aperture F-number, x_d is distance between subject and background, and s is subject distance.

You can combine (1) and (2) by considering aperture size in millimeters (f/N in the formula). So for example 5mm f/1.8 is 2.8mm. It gives a certain blur disc size. However, that blur disc size is a certain fraction of the sensor size. With a smaller sensor (where 5mm gives a narrower field of view), the blur disc size stays constant so there's more blur. However, on a smaller sensor you would use a shorter focal length, let's say 2.5mm, where 2.5mm/1.8 would be 1.4mm. Also the shorter focal length would have different subject magnification (half of the magnification). So you cut blur disc size into one fourth, and cut sensor size to one half, so the blur disc size divided by sensor size is half of what it used to be.

On Pixel 6, you you have 12.2mm sensor diagonal, f/1.9 and 26mm equivalent focal length. The crop factor is 3.5 (calculated from pixel size and count, may be slightly inaccurate, assuming 4/3 aspect ratio which might not be correct). So you have 7.4mm physical focal length and f/1.9. That's aperture opening of 3.9mm, compared to sensor diagonal of 12.2mm or aperture 32% of sensor diagonal.

A professional photographer would grab a full frame camera, pick a 24-70mm lens zoomed to 26mm, say "screw diffraction", set aperture at f/22, turn image stabilization on and use a long exposure time, maybe a very little bit fill flash with a flashgun if the lighting requires it. Then the aperture would be 26mm/22 = 1.18mm compared to sensor diagonal 43.3mm or aperture 2.7% of sensor diagonal. However, 3.5 times bigger subject magnification with a full frame camera mean the comparable number is 3.5*2.7% = 9.45% compared to 32% of Pixel 6.

Pixel 6 is useful for low light shooting with something that fits into your pocket. Pixel 6 isn't the proper camera for the photos you want to take. For food photography with sharp background, you don't want to use Pixel 6. You want to use a camera with a lens that has adjustable aperture and image stabilization.

Also, many phone cameras these days have a portrait mode in which background blur is simulated. In this case, it isn't a real optical effect. You can turn the effect off in the camera app. For the picture of your friend 5 meters away, this could be the cause.


The answer you've linked to has several factors you can change to achieve a sharp fore- and background. Two of them are most relevant to you:

  • Aperture: Smaller aperture gives more DOF.
    Example: (All examples for Nikon D5100 or other APS-C 1.5x crop camera.)
    55mm f/5.6, focus at 10 feet: DOF range from 9 to 11 feet (2 feet total)
    55mm f/22, focus at 10 feet: DOF range from 7 to 18 feet (11 feet total)
  • Focal length: Shorter focal length gives more DOF.
    55mm f/5.6, focus at 10 feet: DOF range 9 - 11 feet
    18mm f/5.6, focus at 10 feet: DOF range 5 feet to infinity

I don't have a Pixel 6 myself, but from I read on the internet I understand it does not offer manual controls of any of above parameters, so you'll need to try a third party camera app.

However, photos taken in portrait mode, seem to have a depth option (another link on the subject). With that you can set what part of the photo is in focus, after you've taken the photo.

  • 1
    \$\begingroup\$ A smartphone camera I'm 100% sure has a fixed aperture. It isn't adjustable. So unless using the portrait mode (in which case it's artificially blurring the background), the only controllable parameter is subject distance. Taking a macro shot blurs background, taking a shot of something far away doesn't. Food as subject is almost certainly a macro shot. \$\endgroup\$
    – juhist
    Dec 5, 2022 at 17:52
  • \$\begingroup\$ Oh yes, I see. I always assumed I could adjust the aperture in my "pro" camera mode, but apparantly it's limited to shutterspeed, ISO, focus distance and white balance. \$\endgroup\$ Dec 5, 2022 at 18:45
  • \$\begingroup\$ @juhist Many smartphones do portrait mode by taking multiple exposures in quick succession. Some are focused on the subject, some are focused at MFD to make the background as blurry as possible. Then the best result(s) from each are combined computationally. \$\endgroup\$
    – Michael C
    Dec 12, 2022 at 0:15

(Sony IMX386 1/1.31″ sensor, 1.2µm pixels, 24 mm equivalent f/1.85-aperture lens).

So, to me, a 1/1.3"-format sensor is 9.6 x 7.2 mm, and that means its crop factor is 3x. That's much bigger than most other smartphone cameras (typically 5x or 6x). So, a proportionately longer lens, and a big fixed max. aperture of f/1.8, all of which decreases your depth of field (how much of the scene can be held in focus, front to back).

Plugging 9.6mm x 7.2mm in as your format size into this calculator, the CoC is .008mm, and your focal length is probably 8mm (3x crop factor, 24mm equivalency, then 24/3 => 8mm is your actual focal length). And your aperture is fixed at f/1.8. Focus distance 1m. If I plug all that into this DoF calculator, I get the following:

  • Near limit: 0.82m
  • Far limit: 1.28m
  • DoF: 0.46m

So you basically get 46cm that can be held in focus front-to-back. That's it. You cannot stretch that out to a kilometer.

Same issue when taking a picture of my friend 5 meters away with the Eiffel Tower 5 kilometers in the back: Either one is unrecognizable, and the phone fails to capture what any other smartphones can do easily.

Plugging 5m into that calculator:

  • Near limit: 2.37 m
  • Far limit: infinity
  • DoF: Infinite

So, I think your friend was probably closer than 5m. :D At 4m, you're limited to 34m DoF.

Question: Is there a way to capture both sharp foreground and background on the same picture?

Have your near subject be 5m or more away from the camera.


With the same lens and sensor that is installed on your mobile phone, you can take photos using the hyperfocal distance technique so that the background and the foreground you want are in an acceptable focus at the same time. In fact, the hyperfocal distance is the closest distance that a The LENS can focus and still have subjects sharp enough to infinity. That is, the focus distance with the maximum depth of field. When the lens is focused at this distance, all subjects within half the hyperfocal distance to infinity are acceptably sharp. You can get help from this link for more guidance and calculation of hyperfocal distance.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.