Skip to content

apple: send photos and videos sized by content without metadata, with Send as Original per item - #164

Merged
morajabi merged 14 commits into
mainfrom
media-send-originals
Nov 23, 2026
Merged

morajabi merged 14 commits into
mainfrom
media-send-originals

Conversation

@morajabi

Copy link
Copy Markdown
Contributor

Photos and videos now leave the Apple clients compressed, sized for what they are, and without location or camera details. Send as Original sends one item's exact file instead, chosen from that item's menu.

Sending

  • Camera photos go at 1600 px (JPEG 0.8). Screenshots and other images go at up to 2560 px, and stay PNG only when they have visible transparency. Pixels are turned upright, metadata is dropped, and the color profile is kept.
  • Camera video goes at 720p and 3 Mbps; screen recordings at 1080p and up to 5 Mbps. H.264 that is already within those limits is passed through with its metadata removed.
  • Photos are prepared off the main thread when they're attached. The untouched source is kept beside each photo and video, as an APFS clone in the temporary folder that's cleared after 3 days.

Send as Original

  • On iPhone and iPad, press and hold a photo or video tile; on Mac, right-click it. Send as Original turns the item into a file right in the composer. The menu shows the file's size and whether it includes a location.
  • On an image or video file the item is checked. Choosing it again turns the file back into a compressed photo or video.
  • A switched file joins the album after the photos and videos, using main's album send. The iOS strip shows that order.
  • A photo marked up in Quick Look is prepared like any photo, and its edited file is kept as its original.

Not changed

No protocol, database or draft-format changes. Phase 2 (a clean server copy for non-Apple senders) and phase 3 (the receive side) are separate.

Validation

  • InlineKit: 50 tests in 5 suites (Drafts2, media send preparation, original store, cache sweep, albums). InlineMacUI: 8 tests.
  • iOS and macOS Debug builds.
  • Not yet tried on a device or simulator.

Known tradeoffs

  • Pressing Send while an item is switching (a fraction of a second) sends its old form.
  • A video still being prepared gets its menu once it's ready.
  • Pasted images and stickers keep no original, so they can't switch.
  • Quick Look markup edits the prepared copy, so a marked-up photo's original is that size.

🤖 Generated with Claude Code

Photos are prepared once at attach, off the main thread, by one shared preparer: camera
photos at 1600 px, screenshots and other images at 2560 px, JPEG 0.8, PNG only when a pixel
is transparent. Pixels are written upright with no location, camera or time, and the color
profile is kept. The upload path checks the file again, so older drafts are cleaned too.
Camera video goes at 720p and 3 Mbps, screen recordings at 1080p up to 5 Mbps; H.264 within
those limits is remuxed, and exports drop location and device. Nothing falls back to the raw
file: a photo that can't be prepared goes as a file, a video that can't be prepared fails.
The untouched original behind each attachment is kept for 3 days so the composer's Original
toggle can send it as a document, metadata included. Replaces ImageCompression.
…e main thread

An Original chip leads the attachment strip when photos or videos are attached. With it on,
each one is sent as its untouched file, and it resets after the send. Picked photos are read
from their files so camera details choose the size and the original is kept; paste, recent
photos and the camera prepare in the background. The unused photo preview screens are gone,
and the share extension uses the shared photo and video preparation.
An Original checkbox ends the media row when photos or videos are attached, for messages and
new threads. With it on, each one is sent as its untouched file, and it resets after the send.
Images from a file are prepared from that file, the media picker builds a small preview
instead of decoding the full image on the main thread, and GIFs keep their animation.
- Send as Original is now a conversion. switchedForOriginal turns a photo
  or video into a document of its kept original, and an image or video
  document back into a compressed photo or video. discardUnsent removes
  whichever form isn't kept.
- canSwitchOriginal covers photos, videos and image or video files (not
  GIF or SVG). The menu summary reads size and location for files too.
- A switched file joins the album after its photos and videos, as album
  sends already order files.
- Drafts2.replaceAttachment keeps an attachment's place when it switches.
- Removes the send-time swap (withOriginals, replacedWithOriginalDocument).
- Removes the Original chip from the attachment strip.
- Photo, video and image or video file tiles get a long-press menu: Send
  as Original (checked on files, with size and location) and Remove.
  Choosing it switches the item in place, with a spinner and a crossfade.
- The strip shows attachments in send order, photos and videos before
  files. Document tiles with a thumbnail show their extension.
- A marked-up photo is prepared like any photo, and its edited file is
  kept as its original (savePhoto no longer takes optimize).
- Removes the Original checkbox from the media row.
- Photo and video tiles and image or video file rows get Send as Original
  in their menu (video tiles gain a menu with Remove). Switching replaces
  the draft attachment and moves it between the media row and the file
  list, in Glass, Legacy and new-thread compose.
- Sends no longer swap in originals at send time.
…nal, keep a gif's original, and re-prepare uploads staged by older builds

- a photo that goes as a file because it is too thin to show or couldn't be
  prepared keeps its own bytes only when they carry no camera, place or time
  details; otherwise it goes as a full-resolution copy without them, or not at
  all. a video that couldn't be prepared and carries a location is refused
  instead of sent untouched.
- a staged photo body is reused only when it is already prepared, and video
  staging descriptors carry a version. anything an older build staged (which
  could be the untouched original) is discarded with its sidecars, so the
  upload starts over from a prepared body under a new identity.
- an animation converted from a gif keeps the gif as its original, so send as
  original sends the gif instead of the converted video; a gif file switches
  back to an animation.
…for photos being prepared

- send waits while an item switches between photo and original, so it never
  goes in the form being left (an original carries its location). a failed
  switch cancels the waiting send.
- pasted, dropped and recent-strip photos hold a pending tile before they are
  prepared, so a send waits for them and they land in this draft instead of
  the next one. photos are prepared two at a time, and the library picker
  loads two items at a time.
- the share extension sends a photo that goes as a file without its camera,
  place or time details.
send would go with the form being left, and an original carries its location.
@morajabi

Copy link
Copy Markdown
Contributor Author

Pushed the review fixes (d15655d apple, a0de573 ios, 5d2f56d macos):

  • Send during a switch. On iOS, Send waits until Send as Original finishes switching an item, so it never goes in the form being left; a failed switch cancels the waiting send. On macOS, Send is disabled while an item switches.
  • Fallbacks keep no metadata. A photo that goes as a file without anyone choosing Original (too thin to show, or preparation failed) keeps its own bytes only when they carry no camera, place or time details; otherwise it goes as a full-resolution copy without them, in the app and the share extension. A video that couldn't be prepared and carries a location is refused instead of sent untouched.
  • Older staged uploads. A staged photo body is reused only if it's already prepared, and video staging descriptors now carry a version. Anything an older build staged is discarded, so the upload starts over from a prepared body under a new identity.
  • GIFs. An animation keeps its GIF as the original, so Send as Original sends the GIF, not the converted video, and a GIF file switches back to an animation.
  • From uploads: finish whole-file uploads sooner, save picked photos off the main thread, keep album order after relaunch #166. Pasted, dropped and recent-strip photos hold a pending tile before they're prepared, so a send waits for them and they land in this draft, not the next one. Photos are prepared two at a time.

InlineKit tests cover a located photo sent as a file (the sent bytes have no GPS or camera tags), the GIF original, GIF eligibility and old video descriptors. Not yet tried on a device.

…d video that may carry details

from the pre-merge review:
- a photo whose upload had to prepare it is staged in its prepared format.
  a retry that reuses that body now sends the same name and type, which the
  server checks against the same upload; it used to send the caller's (a png
  name for a staged jpeg) and every retry failed the create.
- a video that couldn't be prepared goes as its untouched file only when its
  metadata can be read and carries no camera, place or time details; one that
  can't be read is refused too.
- originals left by unsent drafts are swept when a video is attached as well.
…n images with a file behind them

- a row configured again built a new menu and inserted the same menu item,
  which appkit refuses while the item is still in the old menu. the item now
  leaves its old menu first.
- an image too thin or tiny to show as a photo, with a file behind it, now goes
  through the draft's photo preparation, which sends it as a file without
  camera, place or time details instead of the untouched file.
@morajabi
morajabi merged commit e71c312 into main Nov 23, 2026
38 of 39 checks passed
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