Skip to content

Add WebP/BMP RGBA parsing and APNG format support#20

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/add-webp-bmp-rgba-parsing
Draft

Add WebP/BMP RGBA parsing and APNG format support#20
Copilot wants to merge 2 commits into
mainfrom
copilot/add-webp-bmp-rgba-parsing

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 31, 2026

Extends format coverage for pixel-level RGBA extraction and adds APNG as a distinct detected format.

Changes

WebP & BMP RGBA extraction

  • Added golang.org/x/image (v0.23.0) as the sole new dependency for WebP and BMP decoding
  • processor/rgba.go: extended single-frame handler to cover webp and bmp via side-effect imports (_ "golang.org/x/image/webp" / bmp), hooking into image.Decode automatically

APNG format support

  • Type detection (processor/type.go): PNG files are now scanned for an acTL chunk; if present, type resolves to "apng" rather than "png" — existing PNG detection is unaffected
  • Width/height (processor/wh.go): "apng" added to the image.DecodeConfig branch alongside PNG/JPG/GIF
  • Frame parsing (processor/apng.go): new helpers parseAPNGFrames / buildAPNGFramePNG / buildPNGChunk reconstruct a minimal self-contained PNG per frame from fcTL+IDAT/fdAT chunks, then decode each with the standard image/png decoder
  • Multi-frame RGBA (processor/rgba.go): APNG handled analogously to GIF — each frame decoded independently and placed at its xOffset/yOffset within the canvas

Test assets

  • test/imgs/cool.apng: 4×4 3-frame APNG (red / green / blue frames)
  • test/imgs/go_24.bmp: 24-bit BMP derived from go.png (existing go.bmp is 4-bit, unsupported by the decoder)

Copilot AI linked an issue Mar 31, 2026 that may be closed by this pull request
Agent-Logs-Url: https://github.com/echosoar/imgpro/sessions/f6157263-e53e-4b06-8672-a9aa14b34f47

Co-authored-by: echosoar <14832743+echosoar@users.noreply.github.com>
Copilot AI changed the title [WIP] Add RGBA data parsing for webp and bmp formats Add WebP/BMP RGBA parsing and APNG format support Mar 31, 2026
Copilot AI requested a review from echosoar March 31, 2026 16:19
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.

优化

2 participants