Skip to content

Add optional maximum photo resolution cap - #669

Open
mech01nc01 wants to merge 1 commit into
GrapheneOS:mainfrom
mech01nc01:upstream-max-resolution
Open

Add optional maximum photo resolution cap#669
mech01nc01 wants to merge 1 commit into
GrapheneOS:mainfrom
mech01nc01:upstream-max-resolution

Conversation

@mech01nc01

@mech01nc01 mech01nc01 commented Jul 30, 2026

Copy link
Copy Markdown

Adds an optional "Max resolution" setting (More settings) that caps the long
edge of captured photos to a configurable number of pixels. 0 (the default)
keeps the current behaviour of picking the largest available resolution for the
chosen aspect ratio, so nothing changes for existing users unless they opt in.

Implements the maximum-resolution setting requested in #591 and #505.

Motivation: we'd love to use this app in the field (simple, no bloat), but for
documentation photos an 8-12 MP file has no more value to us than a ~1 MP one -
it just costs storage and upload. A resolution cap solves that predictably.

Two things that should make this an easy fit:

  • No new dependency and no post-processing. Instead of resizing after capture,
    it tells CameraX to capture at a lower resolution directly - a
    ResolutionStrategy (FALLBACK_RULE_CLOSEST_LOWER_THEN_HIGHER) added to the
    existing ResolutionSelector, next to the aspect ratio strategy. This addresses
    the concern in Would you be open to someone implementing a maximum resolution setting? #591 about pulling in an image processing library.

  • It's the same mechanism QR scan mode already uses to limit its resolution
    (noted in Camera mode - allow resolution setting #505), just applied to image capture - so it's not a new concept.

Because it caps the long edge (not the aspect ratio), it works independently of
4:3 / 16:9 and across devices, unlike switching to 16:9 which only reduces
resolution on some sensors. On a test device a 1920px cap produced 1920x1440
(4:3) / 1920x1080 (16:9) instead of 4096x3072 / 4096x2304.

I went with a free pixel value to be most flexible but could also switch it to a fixed dropdown
(Off / 2560 / 1920 / 1080) if you'd prefer that.

@BryanQuigley

Copy link
Copy Markdown

Tested it out and it works for me! Thank you for pursuing this! (I'm from #505)

I've found two issues

  1. The option below Max resolution (what you added) is "Use Highest photo resolution". This has no effect on my Pixel but these options need to be mutual exclusive I think.

Maybe this means a dropdown makes more sense? A dropdown also makes it easier to change when a user say wants it back to native for a few specific pictures (and then will change it back).

  1. I was able to set 2048 on my device and it worked perfect (that's likely what I want). But I decided to try 1024 and it didn't work- seems my device has a min resolution of 1920

Add a "Max resolution" setting (More settings) that caps the long edge of
captured photos to a configurable number of pixels. 0 (the default) keeps
the current behaviour of using the largest available resolution for the
chosen aspect ratio.

The cap is applied via a CameraX ResolutionStrategy
(FALLBACK_RULE_CLOSEST_LOWER_THEN_HIGHER) alongside the existing aspect
ratio strategy, so it works independently of the aspect ratio and across
devices. Useful for keeping documentation-style photos small.

The cap and the existing "Use highest photo resolution" option are mutually
exclusive: enabling one disables and clears the other in the UI, and the cap
takes precedence if both are somehow set.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mech01nc01
mech01nc01 force-pushed the upstream-max-resolution branch from 8bc2ab1 to dbe81ff Compare August 3, 2026 11:40
@mech01nc01

Copy link
Copy Markdown
Author

Tested it out and it works for me! Thank you for pursuing this! (I'm from #505)

I've found two issues

  1. The option below Max resolution (what you added) is "Use Highest photo resolution". This has no effect on my Pixel but these options need to be mutual exclusive I think.

Maybe this means a dropdown makes more sense? A dropdown also makes it easier to change when a user say wants it back to native for a few specific pictures (and then will change it back).

  1. I was able to set 2048 on my device and it worked perfect (that's likely what I want). But I decided to try 1024 and it didn't work- seems my device has a min resolution of 1920

Thank you so much for testing this, i really appreciate it!

Both fixed: "Max resolution" and "Use highest photo resolution" are now mutually
exclusive, and I've clarified in the description that values below the device's
smallest supported size fall back to that size (which is why 1024 became 1920).

@silvaDominic

Copy link
Copy Markdown

Consider adding some before/after UI screens/videos if you're serious about getting this more attention.

Personally, I never expected anything beyond the dropdown style resolution picker that is prevalent in so many other camera apps. Not sure anything beyond or in addition to that will be considered from a UX standpoint.

Also, why the "Max" qualifier? Is it not just the plain resolution that we're picking/setting? Is there a min also? It seems to imply there's at least a "Minimum" resolution setting (or others) that is configurable which wouldn't make sense. Max, min, and everything in between are just general resolutions a user can pick.

Similarly, the 0 = Actual max resolution feels unintuitive, no? I wouldn't expect the free-form value to also act as a toggle. I'd expect a toggle "Use max camera resolution" that would disable the free-form field and then that value to be an integer > 0. But as I said, best bet is a dropdown with standard assigned values.

@mech01nc01

Copy link
Copy Markdown
Author

Also, why the "Max" qualifier? Is it not just the plain resolution that we're picking/setting?

The main reason I went with a numeric field over fixed presets: absolute values like 2560/1920/1080 etc. assume that those sizes are meaningful on every device, but the supported capture sizes vary a lot between sensors.
With a free value the cap just adapts and CameraX picks the largest supported size at or below whatever you enter, so it works regardless of a device's specific size list, where a fixed list would sometimes be too coarse or mismatched.

Again: the size is applied at capture time via CameraX, nothing is re-scaled after shot and it needs no image-processing library, so it stays dependency-free and lightweight - therefore i stayed with a setting thats compatible with every device.

@thestinger
thestinger force-pushed the main branch 5 times, most recently from 25fd41a to db39c2d Compare August 4, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants