Skip to content

fix: display TIFF images via client-side conversion (fixes #146)#177

Open
jedrazb wants to merge 3 commits intomainfrom
fix/tiff-image-support
Open

fix: display TIFF images via client-side conversion (fixes #146)#177
jedrazb wants to merge 3 commits intomainfrom
fix/tiff-image-support

Conversation

@jedrazb
Copy link
Copy Markdown
Contributor

@jedrazb jedrazb commented Mar 13, 2026

Summary

  • TIFF images in DOCX files are now displayed correctly in the browser
  • Uses utif2 library to decode TIFF to RGBA pixels, then Canvas API to encode as PNG
  • Conversion happens during DOCX parsing in buildMediaMap() — transparent to the rest of the pipeline
  • Falls back gracefully in environments without Canvas (Node.js headless)

Test plan

  • Typecheck passes
  • Visual verification: TIFF image renders as red square in test DOCX
  • Non-TIFF images unaffected (standard PNG/JPEG pipeline unchanged)
  • Graceful fallback when Canvas unavailable

🤖 Generated with Claude Code

Browsers don't support TIFF in <img> tags. During DOCX parsing, TIFF
images are now decoded with utif2 and re-encoded as PNG via Canvas API.
Falls back gracefully to the raw TIFF data URL in Node.js environments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docx-editor Ready Ready Preview, Comment Mar 13, 2026 8:01pm

Request Review

The measurement-time floating image support was already implemented.
Replaced the misleading TODO with an accurate description of the flow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ehavior

DRY: extract base64 encoding into reusable arrayBufferToDataUrl().
Document that TIFF images are saved as PNG on re-export.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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