home/ atoms/ brightness-to-tile-rasterize

Mapping source brightness to tile size rasterizes an image into a halftone-like grid where dark areas make smaller tiles

A rasterization effect replaces a continuous image with a grid of tiles whose sizes vary with local brightness. Choose a tile count (e.g. 100×150), compute tileW = pgWidth/tilesX and tileH = pgHeight/tilesY, and step the nested loop by whole tiles. At each tile sample the source (or blended) color, take brightness(color) in [0,255], then map that to a tile dimension: float size = map(bright, 0, 255, 0, tileW). Draw a rect of that size at the tile position. Dark areas yield small or vanishing tiles, bright areas yield large tiles that fill their cell, giving a halftone/printed-surface look. Raising tilesX/tilesY makes a finer grid.

Examples

float bright = brightness(c3); float size = map(bright, 0, 255, 0, tileW); buffer.rect(x, y, size, size); // 200×300 tiles reads as a printed raster

Assessment

In the brightness-to-size mapping, does black or white produce the largest tile, and how would you invert the effect so dark areas produce the largest tiles?

“float size equals to map right.0.255”
corpus · programming-posters-processing-tutorial-tim-rodenbroker-free · chunk 4