Skip to content

image: add Go-inspired core image module - #27647

Merged
medvednikov merged 2 commits into
masterfrom
codex/port-go-image-module
Jul 4, 2026
Merged

medvednikov merged 2 commits into
masterfrom
codex/port-go-image-module

Conversation

@medvednikov

@medvednikov medvednikov commented Jul 3, 2026 •

Copy link
Copy Markdown
Member

Summary

  • add a new image vlib module with Go-style Point, Rectangle, uniform images, packed pixel buffers, paletted images, and Y'CbCr buffers
  • add image.color with standard color structs, model conversion, palette lookup, Y'CbCr conversion, and CMYK conversion
  • port Go's image format registration/sniff/decode hooks to V io.Reader via register_format, decode, and decode_config
  • translate the core Go image/color tests for geometry invariants, color conversion arithmetic, buffer layout, sub-images, RGBA64 equivalence, and format registration
  • document current scope and add Go BSD attribution for derived code

Scope

This ports the core Go image/image.color behavior into V-style APIs. Format-specific codec packages such as PNG, JPEG, and GIF are intentionally left out for follow-up PRs, but the registration hooks needed by such packages are included.

Tests

  • ./vnew -silent test vlib/image/
  • ./vnew check-md vlib/image/README.md

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: abe0db278e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vlib/image/image.v
return false
}
}
return true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Return false for empty palettes in opaque

When a non-empty Paletted image has an empty palette, at() reports every in-bounds pixel as color.transparent, but opaque() skips the palette loop and reaches this true, so callers can treat a fully transparent image as fully opaque. Add an empty-palette check (or otherwise align opaque() with at()'s empty-palette behavior) before this return.

Useful? React with πŸ‘Β / πŸ‘Ž.

@medvednikov
medvednikov merged commit c8543b4 into master Jul 4, 2026
65 of 83 checks passed
@JalonSolov
JalonSolov deleted the codex/port-go-image-module branch July 28, 2026 01:16
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