Skip to content

fix(common): decode the crop view image at screen resolution - #720

Merged
farfromrefug merged 1 commit into
mainfrom
fix/crop-preview-decode-size
Sep 10, 2026
Merged

fix(common): decode the crop view image at screen resolution#720
farfromrefug merged 1 commit into
mainfrom
fix/crop-preview-decode-size

Conversation

@farfromrefug

Copy link
Copy Markdown
Collaborator

Summary

CropView derived its decode size from Screen.mainScreen.widthDIPs/heightDIPs, but that value reaches decoders that expect pixels: decodeWidth ends up in Fresco's ResizeOptions, and the magnifier's loadImage({ resizeThreshold }) goes to the native processor. On a 1080x2340 screen the image was decoded at 780px and then upscaled to fill the view, so the photo shown right after a capture looked markedly blurrier than the camera preview it replaces — even though the captured file itself is sharp.

  • Reuse IMAGE_DECODE_HEIGHT (widthPixels/heightPixels), which is already what the rest of the app passes as a decode size. On a 1080x2340 device that is 780 -> 2340.
  • The magnifier loupe reads the same constant, so it sharpens too.

Note this decodes ~9x more pixels for that one bitmap, which is what every other image view in the app already does.

Testing

  • npx eslint clean, svelte-check reports 0 errors
  • built and installed on a Galaxy S22 (SM-S901U1); the blur was traced there with the actual files: the capture pulled off the device (4080x3060) is sharp at 1:1, the crop geometry is correct, and only the on-screen decode was undersized

A visual confirmation on device that the review screen now matches the preview's sharpness is still worth doing.

`CropView` computed its decode size from `Screen.mainScreen.widthDIPs`, but that number
reaches decoders that expect pixels: `decodeWidth` ends up in Fresco's `ResizeOptions`,
and `loadImage`'s `resizeThreshold` in the native processor. On a 1080x2340 screen the
image was therefore decoded at 780px and upscaled to fill the view, so a freshly captured
photo looked far blurrier than the camera preview it replaces.

Reuse `IMAGE_DECODE_HEIGHT`, which is built from `widthPixels`/`heightPixels` and is
already what the rest of the app passes as a decode size.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@farfromrefug
farfromrefug marked this pull request as ready for review September 10, 2026 15:18
@farfromrefug
farfromrefug merged commit 8ab7d27 into main Sep 10, 2026
1 check passed
@farfromrefug
farfromrefug deleted the fix/crop-preview-decode-size branch September 10, 2026 15:19
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.

1 participant