Skip to content

Preserve HEIC/HEIF transparency by converting to PNG - #836

Draft
qayshp wants to merge 3 commits into
BlueBubblesApp:developmentfrom
qayshp:agent/convert-heic-to-png
Draft

Preserve HEIC/HEIF transparency by converting to PNG#836
qayshp wants to merge 3 commits into
BlueBubblesApp:developmentfrom
qayshp:agent/convert-heic-to-png

Conversation

@qayshp

@qayshp qayshp commented Jul 23, 2026

Copy link
Copy Markdown

Summary

  • convert HEIC and HEIF attachments to PNG instead of JPEG while keeping TIFF on its existing JPEG path
  • update converted paths, transfer names, MIME types, and logs to match the selected format
  • route PNG conversion through a testable sips helper shared with the production file-system path
  • add a repository-owned transparent HEIC fixture, a macOS-only alpha-preservation integration test, and a focused macOS CI workflow

Why

The attachment converter recognized HEIC, HEIF, and TIFF separately but sent every recognized image through a hard-coded JPEG path. That could discard alpha data in HEIC/HEIF images and made the resulting attachment metadata report JPEG unconditionally.

Behavior

HEIC and HEIF inputs now select PNG and image/png; TIFF continues to select JPEG and image/jpeg. Converted transfer names replace a matching source extension instead of accumulating extensions.

Validation

Validated on current head dc44e165 on SIP-enabled arm64 macOS:

  • npm run test:image-conversion --workspace @bluebubbles/server — 5/5 tests passed
  • the committed integration test converted the repository's transparent HEIC fixture through the production sips helper and verified PNG format with hasAlpha: yes
  • targeted ESLint, Prettier, and git diff --check passed
  • the workflow now targets the supported macos-15 image and current Node 24-based actions/checkout@v6 and actions/setup-node@v6, while installing the repository's required Node 20.11 runtime for the test

GitHub created an Image Conversion run for the current head, but it is action_required pending approval from an upstream maintainer because this is a fork pull request. No CI job has executed yet, so this is not presented as an observed CI pass.

The broader server type-check still reaches the pre-existing unrelated ScheduledService.ts:39 NodeJS.Timer/clearInterval error.

Fixes #787

@qayshp qayshp left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review: the behavior and metadata paths are covered, with one integration-level follow-up noted inline.

Comment thread packages/server/src/server/databases/imessage/helpers/utils.ts
@qayshp

qayshp commented Jul 23, 2026

Copy link
Copy Markdown
Author

Validation update

Validated on SIP-enabled arm64 macOS 26.5.2 with Node 20.11.1 and npm 10.2.4.

  • npm run test:image-conversion --workspace=@bluebubbles/server — 4/4 committed tests passed with the repository dependency tree available.
  • A separate no-file-change smoke harness exercised the PR's actual convertImage() path with a repository-owned transparent image encoded as HEIC.
  • The result existed as .png, reported image/png, used the expected .png transfer name, retained its 36×36 dimensions, and reported hasAlpha: yes before and after conversion.

The smoke harness was not added to the committed test suite. The review follow-up for a repository fixture and macOS CI integration test therefore remains open.

No messages were sent or received during validation. No screenshot is needed; format and alpha metadata provide stronger evidence for this change.

@qayshp qayshp changed the title Convert HEIC attachments to PNG Preserve HEIC/HEIF transparency by converting to PNG Jul 27, 2026
@qayshp

qayshp commented Jul 27, 2026

Copy link
Copy Markdown
Author

Superseding the earlier workflow-status note: current head dc44e165 includes the repository-owned transparent HEIC fixture, the production-sips alpha-preservation test, and a focused workflow updated to the supported macos-15 runner with actions/checkout@v6 and actions/setup-node@v6. The focused suite re-passed 5/5 locally, including PNG output with hasAlpha: yes.

GitHub created the current-head workflow run, but it is action_required pending upstream maintainer approval for this fork PR. No CI job has executed, so an automated pass is not claimed.

@qayshp
qayshp marked this pull request as ready for review July 28, 2026 07:02
@qayshp
qayshp marked this pull request as draft July 28, 2026 07:30
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