Skip to content

arboard::set_image does not preserve DPI (Word interprets pixels as 96 DPI) #211

@Mq-b

Description

@Mq-b

Description

  • Writing a raw pixel buffer with arboard::set_image does not include DPI/pHYs metadata.
  • Result: a 591 px grayscale image (generated at 300 DPI for a 5 cm width) is interpreted by Word as 96 DPI and pastes at the wrong physical size (~15.6 cm).
  • If a PNG containing pHYs/DPI is written to the clipboard, Word respects the metadata and the size is correct.

Steps to reproduce

  1. Create a 591 px wide image intended to be 5 cm at 300 DPI.
  2. Copy it to the clipboard with arboard::set_image(ImageData { ... }).
  3. Paste into Microsoft Word — Word treats it as 96 PPI, so it appears ~15.6 cm.
  4. If you instead write a PNG with pHYs/DPI metadata to the clipboard, Word reads it as 300 PPI and the image is correctly 5 cm.

Expected

  • Ability to preserve/declare DPI when writing images to the clipboard, or ability to write image/png or image/tiff bytes (with pHYs/DPI) to the clipboard so receivers restore physical size correctly.

Simple suggestion

  • Add set_bytes_with_format(format: &str, bytes: &[u8]) to allow writing PNG/TIFF with pHYs;
  • Or add an optional dpi field to set_image so backends write clipboard representations that include DPI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions