Skip to content

Pattern Editor · Image tab: zoom-out fill level + alpha/gamma contrast controls #125

Description

@mbreiser

Two enhancements to the Pattern Editor Image tab (pattern_editor.html #imagePane, backed by js/pattern-editor/tools/image-converter.js).

1. Zoom out beyond the image, with a specified fill level

Today #imageScale (10–500%; ImageConverterState.scale clamped 0.1–5.0) maps the arena region onto the source image. When the arena region extends past the image bounds, the out-of-image area isn't well defined.

Request

  • Allow scaling out further so the arena samples a region larger than the source image (the image occupies only part of the arena).
  • Fill everything beyond the image edges at a user-specified level — 0–15 (GS16) / 0–1 (GS2). Add a "Fill level" control next to Scale; default 0 (dark).
  • Likely: extend the Scale range and relax the 0.1 lower clamp; sample-out-of-bounds returns the fill level (respected by both GS2 and GS16 quantization).

Acceptance: load a small image, zoom out so it covers ~50% of the arena → surrounding pixels render at the chosen fill level; live preview + generated .pat match; GS2 and GS16 both honor it.

2. Contrast correction: alpha (gain) + gamma

Add simple pre-quantization tone controls in createGrayscaleSource / generatePattern:

  • Alpha (contrast/gain), Gamma correction applied to the 0–255 grayscale before quantization to GS2/GS16.
  • Two sliders with identity defaults (alpha 1.0, gamma 1.0 = no-op), live preview on #imagePreviewCanvas.

Acceptance: adjusting alpha/gamma updates the preview and the generated pattern; identity values reproduce current output.

Notes

  • Consider MATLAB-host parity if there's an equivalent image path there.
  • Reuse the existing #imagePreviewCanvas render for live feedback.

Related: Pattern Editor tracking #6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions