Skip to content

Conversation

@linyows
Copy link
Owner

@linyows linyows commented Dec 26, 2025

Summary

  • Convert HEIC/HEIF images to WebP format for compatibility with browsers other than Safari
  • Add heic-convert dependency to handle HEIC format reliably
  • Fix file write stream completion handling to prevent race conditions
  • Expand WebP conversion support to all image formats (except GIF for animation preservation)

Changes

  1. HEIC Support: Use heic-convert to convert HEIC/HEIF images to PNG, then to WebP
  2. File I/O Fix: Properly wait for write stream completion before processing
  3. Format Support: Enable WebP conversion for all raster formats (PNG, JPEG, HEIC, HEIF, TIFF, AVIF, etc.)
  4. Error Handling: Add warning messages for unsupported HEIC compression formats
  5. Testing: Add comprehensive test for HEIC to WebP conversion

Test Plan

  • All existing tests pass (107/107)
  • HEIC to WebP conversion test added and passing
  • PNG/JPEG to WebP conversion still works
  • File write completion properly handled

Fixes #111

🤖 Generated with Claude Code

linyows and others added 4 commits December 26, 2025 20:30
Changed the saveImage function to convert all raster image formats
(including HEIC, HEIF, TIFF, AVIF) to WebP, not just PNG and JPEG.
This ensures images are viewable in browsers other than Safari.
GIF is excluded to preserve animations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
- Convert HEIC/HEIF images to PNG using heic-convert, then to WebP
- Fix file write stream completion wait to prevent race conditions
- Add warning message for unsupported HEIC compression formats
- Expand WebP conversion to support all image formats except GIF
- Add heic-convert dependency for reliable HEIC support
- Add test for HEIC to WebP conversion using testdata

This ensures HEIC images from iOS devices are converted to WebP
format for broader browser compatibility beyond Safari.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
- Add @types/heic-convert to devDependencies for TypeScript support
- Fix Buffer/ArrayBuffer type conversions for heic-convert
- Convert Buffer to ArrayBuffer when passing to heic-convert
- Convert heic-convert output back to Buffer for file writing
@linyows linyows merged commit 965ad21 into main Dec 26, 2025
7 of 15 checks passed
@linyows linyows deleted the fix/convert-heic-to-webp branch December 26, 2025 14:01
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.

Support HEIC format

2 participants