mirror of
https://github.com/Comfy-Org/ComfyUI-embedded-workflow-editor.git
synced 2026-11-04 23:47:24 +00:00
[PR #2] [MERGED] Fixed exif saving in webp. #5
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/ComfyUI-embedded-workflow-editor#5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/ComfyUI-embedded-workflow-editor/pull/2
Author: @robinjhuang
Created: 3/5/2025
Status: ✅ Merged
Merged: 3/6/2025
Merged by: @snomiao
Base:
main← Head:rh-exif-fix📝 Commits (1)
5b309e3Fixed exif saving in webp.📊 Changes
1 file changed (+118 additions, -72 deletions)
View changed files
📝
app/utils/exif.ts(+118 -72)📄 Description
Fix WebP EXIF Metadata Corruption
This PR addresses issues with saving EXIF metadata in WebP files that were causing file corruption. The key fixes include:
Technical Changes
Fixed DataView Buffer Access: Corrected how DataViews were created and accessed when writing integers to binary data. The previous implementation was creating views with incorrect offsets, leading to buffer access errors.
Added WebP Chunk Padding: WebP specification requires chunks to have even lengths. Added proper handling of padding bytes to ensure compliance with the format.
Updated RIFF Size Field: Properly recalculated and updated the total file size in the RIFF header after modifications, which is critical for file integrity.
Improved String Handling: Ensured proper null termination of string values in EXIF data and handled string encoding/decoding more carefully.
Enhanced EXIF Header Preservation: Correctly preserved the "Exif\0\0" header when present in the original file.
Technical Background
WebP files follow the RIFF container format, which requires careful handling of chunk sizes and padding. EXIF data in WebP is stored in a specific chunk type ("EXIF") and follows the TIFF format internally. When modifying this data, we need to:
The previous implementation had issues with these requirements, particularly with how it handled buffer modifications and size calculations, which led to corrupted files.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.