Skip to main content
100%

Create layers for each pixel with opacities

✓ Published0🌍 Public
KKevinGutowski
Last edited Oct 1, 2021
Created on Oct 1, 2021

This example shows a raster image decomposed into one layer per pixel, with each layer’s position and fill color corresponding to the original bitmap’s coordinates and sampled color values. It uses the Sketch JavaScript API, iterating over the image’s width and height via `NSBitmapImageRep` to retrieve each pixel’s color with `colorAtX_y`. The code creates a `ShapePath` for every pixel, assigning the color via an `MSColor` fill, and groups all resulting rectangles under a new `Group` named “pixel layers.”

AI-generated description

Similar vizzes