Alpha Scanline Runs
Find contiguous visible spans in an eight-bit alpha row. The spans are useful when building masks, visualizing disconnected parts of a cutout, or skipping transparent spans during image processing.
Usage
Add {:alpha_scanline_runs, "~> 0.1.0"} to your Mix dependencies.
AlphaScanlineRuns.visible(<<0, 32, 255, 0, 250>>, 32)
# [{1, 3}, {4, 5}]
Each pair is a zero-based start and exclusive end. The threshold defaults to one and is inclusive. Supply one row of decoded alpha bytes at a time. File decoding and rendering are handled by the caller. Elixir 1.12 or newer. MIT license.
See the transparent PNG workflow guide for the related image-creation workflow.