Skip to content

feat: show image pixel dimensions in preview panel#1389

Open
Project-A-E-G-I-S wants to merge 3 commits into
p0deje:masterfrom
Project-A-E-G-I-S:feat/image-dimensions
Open

feat: show image pixel dimensions in preview panel#1389
Project-A-E-G-I-S wants to merge 3 commits into
p0deje:masterfrom
Project-A-E-G-I-S:feat/image-dimensions

Conversation

@Project-A-E-G-I-S
Copy link
Copy Markdown

Summary

Adds pixel dimensions (e.g., "1920×1080") to image previews in the slideout panel. Displayed both as an overlay on the image and as a metadata row.

Implementation

HistoryItemDecorator.imageDimensions (Maccy/Observables/HistoryItemDecorator.swift:44-51)

  • Reads pixel dimensions from NSBitmapImageRep.pixelsWide/pixelsHigh
  • Falls back to NSImage.size when no bitmap representation is available

PreviewItemView.swift

  • Image overlay (bottom-right, semi-transparent black background): lines 24-34
  • Metadata row alongside Application, FirstCopyTime, LastCopyTime, NumberOfCopies: lines 103-108

Localization

  • Added "ImageDimensions" = "Dimensions:" key to en.lproj/PreviewItemView.strings

Closes #1139

Project AEGIS added 3 commits April 28, 2026 22:50
Adds pixel dimensions (e.g., "1920×1080") when viewing an image in
the preview slideout panel.

- HistoryItemDecorator.imageDimensions: computed property that reads
  pixel dimensions from NSBitmapImageRep, falling back to NSImage.size
- Overlay on the bottom-right of the preview image with a semi-transparent
  black background
- Metadata row displayed alongside Application, FirstCopyTime,
  LastCopyTime, and NumberOfCopies

Closes p0deje#1139
The original implementation relied on NSImage.size, which returned nil
for items stored as file URLs (e.g., Finder copies). Now reads dimensions
directly from the stored image data using NSBitmapImageRep, with a
fallback that reads from the file URL when the raw pasteboard data
doesn'\''t contain the expected image types (.tiff, .png, .jpeg, .heic).

Verified working:
- Direct image copies (pasteboard has image types)
- File URL copies (Finder, stored as public.file-url)
- Changed recognition level from .fast to .accurate for better text extraction
- Added OCR title display as a metadata row in the preview panel
  (previously the OCR text was set as the item title but never visible
  in the UI since image items display a thumbnail instead of text)
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.

Show dimensions of image

1 participant