Fix clock photo black screen on oversized re-encode and preserve pixel resolution #4

Merged
xrisk merged 2 commits from implement_tea_issues_three into main 2026-10-14 10:41:07 +00:00
Owner

Resolves #3.

  • Configure NSBitmapImageRep in ClockPhotoLibrary.jpegDataURL with samplesPerPixel: 4, hasAlpha: true (RGBA) so macOS 27 NSGraphicsContext creates a valid CGContext instead of silently failing into a solid black JPEG for photos > 350 KB.
  • Add NSImage.pixelDimensions extension to compute scaling from true pixel dimensions rather than DPI-scaled point dimensions, preventing high-DPI photos from being squashed to 24% resolution.
  • Guard NSGraphicsContext creation with diagnostic logging and fail-soft nil returns.
  • Apply matching pixelDimensions and guarded context fixes to ScriptingMusicSource.pngDataURL and AlbumArtPalette.downsampledRGBA.
  • Update scripts/fetch-clock-photos.sh to normalize downloads and cached photos to sRGB.
  • Add SelfTest assertions verifying non-black luminance decoding and dimension preservation.
Resolves #3. - Configure NSBitmapImageRep in ClockPhotoLibrary.jpegDataURL with samplesPerPixel: 4, hasAlpha: true (RGBA) so macOS 27 NSGraphicsContext creates a valid CGContext instead of silently failing into a solid black JPEG for photos > 350 KB. - Add NSImage.pixelDimensions extension to compute scaling from true pixel dimensions rather than DPI-scaled point dimensions, preventing high-DPI photos from being squashed to 24% resolution. - Guard NSGraphicsContext creation with diagnostic logging and fail-soft nil returns. - Apply matching pixelDimensions and guarded context fixes to ScriptingMusicSource.pngDataURL and AlbumArtPalette.downsampledRGBA. - Update scripts/fetch-clock-photos.sh to normalize downloads and cached photos to sRGB. - Add SelfTest assertions verifying non-black luminance decoding and dimension preservation.
- Fix ClockPhotoLibrary.jpegDataURL to use samplesPerPixel: 4, hasAlpha: true (RGBA)
  so macOS 27 NSGraphicsContext creates a valid CGContext instead of silently failing
  into a solid black JPEG for photos > 350 KB.
- Add NSImage.pixelDimensions extension to compute scaling from true pixel dimensions
  rather than DPI-scaled point dimensions, preventing high-DPI photos from being
  squashed to 24% resolution.
- Guard NSGraphicsContext creation with diagnostic logging and fail-soft nil returns.
- Apply matching pixelDimensions and guarded context fixes to ScriptingMusicSource.pngDataURL
  and AlbumArtPalette.downsampledRGBA.
- Update scripts/fetch-clock-photos.sh to normalize downloads and cached photos to sRGB.
- Add SelfTest assertions verifying non-black luminance decoding and dimension preservation.
xrisk merged commit de05d55f31 into main 2026-10-14 10:41:07 +00:00
xrisk deleted branch implement_tea_issues_three 2026-10-14 10:41:07 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
xrisk/tvd!4
No description provided.