You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rewind screenshots are stored with a ~21% black band baked in (SCK scalesToFit + point-derived size) #11207
Rewind screenshots are stored with a wide black band baked into the image. Measured on a real captured frame: the band runs from x 1007 to x 1213.5 of the frame — 21% of the image width. Useful pixels end up 773×541 inside a 1382×541 player stage, about 30% of the surface displaying it.
It is in the stored image, not the layout. The band sits inside the app-coloured border, which RewindPage.swift:711–725 draws at the photo's exact computed bounds. Nothing in RewindPage, RewindStorage.loadScreenshotImage, or the frame loader composites onto a canvas. No display-side change can remove it — the pixels are on disk that way.
Leading suspect (desktop/macos/Desktop/Sources/Rewind/Services/ScreenCaptureService.swift:888-892):
With scalesToFit = true, ScreenCaptureKit letterboxes with black whenever the requested output aspect differs from the source's. config.width/height are set from a size derived from window geometry in points, while SCK captures in pixels — on a Retina display that is a 2× factor, and any resulting aspect mismatch is filled with black rather than cropped or rescaled.
A second candidate worth ruling out: VideoChunkEncoder's aspect-change debounce retaining a wider chunk canvas across a resize, so frames captured after a window narrows are padded to the older, wider canvas.
Not investigated: whether this affects every captured window or only some (e.g. only windows whose aspect differs from the display's), and whether the same padding reaches the video chunks as well as the stills. Both are worth establishing before fixing, since they point at different lines.
Filed rather than fixed because it surfaced during layout work on the Rewind page and is a capture-path defect, not a display one.
Investigated at 685d896b4b. The leading suspect in the report is ruled out — but I could not capture a frame on this machine, so the replacement hypothesis is unverified and I did not open a PR.
1. scalesToFit + point-derived size cannot letterbox here
First, the path moved: it is desktop/macos/Desktop/Sources/ScreenCaptureService.swift, not .../Rewind/Services/.... The cited config is captureConfiguration(for:maxSize:) (ScreenCaptureService.swift:885-899), and it does not set width/height straight from window geometry — it goes through ScreenCaptureService.captureDimensions (:869-882):
That has been the shape since 1bc1327994 (2026-07-14), i.e. already in place when this was filed. The requested aspect is derived from window.frame's own ratio, so it equals the source aspect by construction and scalesToFit has nothing to pad. Points-vs-pixels is a resolution factor, not an aspect factor — a 2x Retina source scaled into a 1x-sized destination of the same ratio comes back downscaled, not letterboxed. The only mismatch left is Int() truncation, which is sub-pixel.
Both capture entry points share that config (captureWithScreenCaptureKit:915, captureWindowCGImage:972), so neither can produce a 21% band this way.
2. The second candidate (video-chunk canvas) also does not letterbox
VideoChunkEncoder.createPixelBuffer draws into the full canvas rect (VideoChunkEncoder.swift:1028):
A frame that differs from the retained chunk canvas is therefore stretched, not padded. (Frames beyond the 20% threshold are dropped during the 2s debounce, :293-333.) So the aspect-debounce path can distort a frame by up to 20% but cannot bake in black.
3. What fits the evidence instead: transparent margin flattened to black
A one-sided, non-centred band is wrong for scalesToFit (it centres). It is the right shape for alpha becoming black:
SCContentFilter(desktopIndependentWindow:) includes the window's shadow/transparent margin unless config.ignoreShadowsSingleWindow = true, and SCStreamConfiguration.backgroundColor defaults to clear. Neither is set in captureConfiguration.
Those transparent pixels then hit two lossy-to-black sinks: JPEG has no alpha (encodeJPEG / jpegData(from:)), and createPixelBuffer draws onto a zeroed BGRA buffer with premultipliedFirst — untouched pixels stay 0,0,0.
That predicts black exactly where the window is transparent, in the stored bytes, on whichever side the transparent region sits — which is what the report measured.
Why no PR
The check is one capture, but this process is denied Screen Recording TCC (SCStreamErrorDomain Code=-3801), so I can neither reproduce the band nor confirm the fix. The experiment for whoever picks this up: capture one window with the current config, then re-capture with config.ignoreShadowsSingleWindow = true and config.backgroundColor = .black/.white, and diff the black-column count. If it drops to zero, the fix is those two lines in captureConfiguration (plus an opaque fill before context.draw for the video path). Ruling that in also answers the report's open question about whether it hits every window — it would hit only windows with transparent margins.
Activity
fix(desktop): pin Rewind's frame controls to the photograph, not the …
kodjima33 commentedon Aug 10, 2026
Investigated at
685d896b4b. The leading suspect in the report is ruled out — but I could not capture a frame on this machine, so the replacement hypothesis is unverified and I did not open a PR.1.
scalesToFit+ point-derived size cannot letterbox hereFirst, the path moved: it is
desktop/macos/Desktop/Sources/ScreenCaptureService.swift, not.../Rewind/Services/.... The cited config iscaptureConfiguration(for:maxSize:)(ScreenCaptureService.swift:885-899), and it does not setwidth/heightstraight from window geometry — it goes throughScreenCaptureService.captureDimensions(:869-882):That has been the shape since
1bc1327994(2026-07-14), i.e. already in place when this was filed. The requested aspect is derived fromwindow.frame's own ratio, so it equals the source aspect by construction andscalesToFithas nothing to pad. Points-vs-pixels is a resolution factor, not an aspect factor — a 2x Retina source scaled into a 1x-sized destination of the same ratio comes back downscaled, not letterboxed. The only mismatch left isInt()truncation, which is sub-pixel.Both capture entry points share that config (
captureWithScreenCaptureKit:915,captureWindowCGImage:972), so neither can produce a 21% band this way.2. The second candidate (video-chunk canvas) also does not letterbox
VideoChunkEncoder.createPixelBufferdraws into the full canvas rect (VideoChunkEncoder.swift:1028):A frame that differs from the retained chunk canvas is therefore stretched, not padded. (Frames beyond the 20% threshold are dropped during the 2s debounce,
:293-333.) So the aspect-debounce path can distort a frame by up to 20% but cannot bake in black.3. What fits the evidence instead: transparent margin flattened to black
A one-sided, non-centred band is wrong for
scalesToFit(it centres). It is the right shape for alpha becoming black:SCContentFilter(desktopIndependentWindow:)includes the window's shadow/transparent margin unlessconfig.ignoreShadowsSingleWindow = true, andSCStreamConfiguration.backgroundColordefaults to clear. Neither is set incaptureConfiguration.encodeJPEG/jpegData(from:)), andcreatePixelBufferdraws onto a zeroed BGRA buffer withpremultipliedFirst— untouched pixels stay0,0,0.That predicts black exactly where the window is transparent, in the stored bytes, on whichever side the transparent region sits — which is what the report measured.
Why no PR
The check is one capture, but this process is denied Screen Recording TCC (
SCStreamErrorDomain Code=-3801), so I can neither reproduce the band nor confirm the fix. The experiment for whoever picks this up: capture one window with the current config, then re-capture withconfig.ignoreShadowsSingleWindow = trueandconfig.backgroundColor = .black/.white, and diff the black-column count. If it drops to zero, the fix is those two lines incaptureConfiguration(plus an opaque fill beforecontext.drawfor the video path). Ruling that in also answers the report's open question about whether it hits every window — it would hit only windows with transparent margins.🤖 hourly desktop bug watchdog — analysis only, no code change.
fix(desktop): prevent black bands in Rewind window captures (BasedHar…