Skip to content

fix: encode photos up to the 512 KiB image budget - #1691

Open
Chessing234 wants to merge 3 commits into
permissionlesstech:mainfrom
Chessing234:feat/encode-photos-to-image-budget
Open

fix: encode photos up to the 512 KiB image budget#1691
Chessing234 wants to merge 3 commits into
permissionlesstech:mainfrom
Chessing234:feat/encode-photos-to-image-budget

Conversation

@Chessing234

@Chessing234 Chessing234 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • ImageUtils crushed JPEGs to 45 KB at 448px even though FileTransferLimits.maxImageBytes is already 512 KiB. Voice notes travel at that budget; Android encodes at 512px / q=85 with no extra squeeze.
  • Encode against the protocol budget, default the long edge to 512, and always redraw so EXIF orientation is baked in for camera stills that already fit.

Test plan

  • swiftc typecheck of ImageUtils.swift under Swift 5 and 6
  • local encode harness: a noisy 1600×1200 source landed at 286256 bytes (old crush 45 KB; cap 512 KiB)
  • xcodebuild test suite — this machine has Command Line Tools only, no Xcode; CI covers processImage_usesThe512KiBBudgetInsteadOfCrushingTo45KB
  • send a camera photo over mesh and confirm it stays readable on both ends

The protocol already allows 512 KiB images and Android encodes at 512px
without a second squeeze. Crushing iOS JPEGs to 45 KB at 448px made
photos unreadable on the same radio as voice notes.
A noisy 1600x1200 source must land above the old 45 KB crush, at or
under FileTransferLimits.maxImageBytes, with a 512px long edge.
SwiftLint unused_closure_parameter fails the suite otherwise.
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