Docs

CogniBlock docs

Build an image pipeline out of blocks, wire them together, and watch every step update live. Everything runs in your browser.

Overview

A pipeline is a set of blocks connected by wires. Each block does one job: it takes an image in, changes it, and passes an image out. Put an Image block at the start, a few filters in the middle, and an Output block at the end, and you have a pipeline.

The playground shows a small preview inside every block, so you can see exactly what each step does to the picture and change a setting to see it update straight away.

Runs on your device. Images are processed in your browser. They are never uploaded to a server, and sharing a pipeline saves only the blocks and their settings.

Quick start

  1. Open the playground. It starts with a working example: an image goes through Canny Edge and Blur, then blends back over the original.
  2. Move a slider on any block, for example Weak edges on Canny Edge. Every block after it updates.
  3. Add a block by clicking it in the library on the left. It appears in the middle of your view.
  4. Drag from the dot on the right edge of one block to the dot on the left edge of another to connect them.
  5. Press Download PNG on an Output block to save the result, or Share link to send the pipeline to someone.

Using the playground

Connecting blocks

  • Drag from an output dot (right edge) to an input dot (left edge). The target dot lights up when you are over it.
  • An output can feed any number of blocks. An input accepts exactly one wire; connecting a new one replaces the old one.
  • To disconnect, grab a connected input dot and drop the wire on empty space. To re-route, drop it on a different input.
  • Loops are not allowed. If a connection would make a block depend on itself, it is refused with a message.
  • A block with a missing input shows Connect an input instead of a preview.

Moving around

ActionHow
Move a blockDrag its title bar
Pan the workspaceDrag empty space
ZoomScroll wheel, or the + and − buttons
See everythingFit button
Remove a blockClick its ×, or select it and press Delete
Use your own imageUpload your own image on an Image block, or drop an image file onto the workspace

Examples

The Examples menu loads a ready-made pipeline: Glowing edges, Edge sketch, Blueprint and Brand pixels. Reset returns to the starter pipeline. Your work is saved in your browser automatically and comes back next time you visit.

Blocks

Every block takes images in on the left and passes one image out on the right, except Image (no inputs) and Output (no output).

BlockInputsWhat it does
ImagenoneStarts a pipeline with a sample or your own picture
Grayscale1Removes all colour
Blur1Softens fine detail
Light1Changes brightness and contrast
Invert1Flips every colour
Threshold1Turns the picture into pure black and white
Canny Edge1Draws the edges of shapes as white lines on black
Pixelate1Makes a chunky mosaic
Duotone1Maps dark and light to two colours you choose
Resize1Scales the picture up or down
Blend2 (A, B)Mixes two pictures together
Output1Shows the final result and downloads it

Image

image.source

The start of a pipeline. Pick a built-in picture or use your own.

SettingValuesNotes
PictureShapes, Blocks, Gradient, Your uploadThe samples are 420 × 300 px. Your upload is available once you have loaded a file.

Uploaded images are scaled so the longest side is at most 420 px. This keeps every block fast. Uploads are not part of a shared pipeline (see Sharing).

Filter settings

BlockSettingRangeNotes
Blurradius0 to 12 px0 passes the picture through unchanged. Uses a Gaussian blur.
Lightbrightness−100 to 100Adds or removes light
contrast−100 to 1000 is unchanged
Thresholdlevel0 to 255Pixels at or above the level become white, the rest black
Pixelatesize2 to 40 pxEach square takes the average colour of its pixels
Duotonedark, lighttwo coloursDarkest pixels become dark, brightest become light, everything else blends between
Resizescale10 to 200 %Result is kept between 16 and 900 px on each side
Grayscale, InvertNo settings.

Canny Edge

image.canny

A classic edge detector. It smooths the picture, finds where brightness changes fastest, thins those changes to single-pixel lines, then keeps strong edges and any weak edges that touch them. The result is white lines on a black background.

SettingRangeWhat it does
Smoothing sigma0.5 to 4Higher values ignore small details and noise
Weak edges low0 to 100 %The minimum strength for a line that is connected to a strong one
Strong edges high0 to 100 %The strength a line needs to start on its own

Both thresholds are a percentage of the strongest edge in the picture. If you get too many lines, raise Strong edges or Smoothing. If lines are broken, lower Weak edges.

Blend

image.blend

Mixes input A with input B. If B is a different size, it is stretched to match A. With only A connected, Blend passes A through unchanged.

ModeResult
normalShows B
multiplyDarkens: dark areas of either picture win
screenLightens: bright areas of either picture win. Good for glowing edges.
differenceShows how different the two pictures are. Identical pictures give black.
addAdds the brightness of both, capped at white

Mix (0 to 100 %) controls how much of the blended result replaces A. At 0 you see A, at 100 you see the full effect.

Output

image.output

Shows whatever is connected to it and lets you download it as a PNG at the size shown under the preview. You can add more than one Output block to compare branches of the same pipeline.

Sharing and files

Share link

Press Share link to get a short URL such as pipelines.html?p=04d66a5ae8. Anyone who opens it gets your pipeline with the same blocks, wires and settings. Saving the same pipeline twice gives the same link.

Uploaded images are not shared. A shared pipeline stores only blocks and settings. If your Image block used an upload, the link uses the Shapes sample in its place.

Export and import

Export downloads your pipeline as a .json file you can keep, edit or send. Import loads one back. Unknown blocks are ignored and out-of-range settings are brought back into range, so an imported file can never break the page.

Pipeline format

A pipeline is a small JSON document. This one is the Edge sketch example reduced to three blocks:

{
  "v": 1,
  "nodes": [
    { "id": "n1", "type": "image",  "x": 0,   "y": 20, "params": { "sample": "shapes" } },
    { "id": "n2", "type": "canny",  "x": 250, "y": 20, "params": { "sigma": 1.4, "low": 6, "high": 18 } },
    { "id": "n3", "type": "output", "x": 500, "y": 20, "params": {} }
  ],
  "links": [
    { "from": "n1", "to": "n2", "port": 0 },
    { "from": "n2", "to": "n3", "port": 0 }
  ]
}
FieldMeaning
vFormat version. Always 1 for now.
nodes[].idA unique id like n1, n2, …
nodes[].typeimage, grayscale, blur, brightness, invert, threshold, canny, pixelate, duotone, resize, blend or output
nodes[].x, yWhere the block sits on the workspace
nodes[].paramsThe block's settings, using the setting names in the tables above. The Light block's type is brightness.
links[].fromThe id of the block whose output the wire starts at
links[].to, portThe block the wire ends at, and which input: 0 for the first (or only) input, 1 for Blend's B

Sharing API

The share button talks to a small HTTP API at /api/pipelines. You can use it from your own tools. It is the same format described above.

Save a pipeline

POST /api/pipelines
Content-Type: application/json

{ "graph": { "v": 1, "nodes": [ ... ], "links": [ ... ] } }

201 { "id": "04d66a5ae8" }     // saved
200 { "id": "04d66a5ae8" }     // this exact pipeline was already saved

Load a pipeline

GET /api/pipelines?id=04d66a5ae8

200 { "graph": { ... } }

Errors

StatusWhenBody
400Not valid JSON, not a valid pipeline, or a bad id{ "error": "…" } says what was wrong
404No pipeline has that id{ "error": "Pipeline not found" }
405Any method other than GET and POST{ "error": "Method not allowed" }
413The request is larger than 20 KB{ "error": "Pipeline is too large" }
429More than 30 new saves in an hour from one address{ "error": "Too many saves, try again in an hour" }

Every save is checked against the list of blocks and settings. Unknown blocks and settings are rejected, numbers outside a block's range are clamped, and colours must be #rrggbb.

Limits and privacy

LimitValue
Blocks per pipeline40 when saving a share link (the playground itself does not stop you earlier)
Wires per pipeline80 when saving a share link
Size of a saved pipeline20 KB
New share links per hour30 per address
Uploaded image sizeLongest side scaled to 420 px
Resize block output16 to 900 px per side
Imported file sizeUp to 200 KB

What leaves your device

  • Images you upload or generate stay in your browser. They are never sent anywhere.
  • Pressing Share link sends the pipeline's blocks and settings to the sharing API. Nothing else.
  • Your work is autosaved in your own browser's local storage so it is there when you come back. Clearing site data removes it.

FAQ

Are the blocks AI models?

Not yet. The current blocks use classic image-processing algorithms, such as Gaussian blur and Canny edge detection, running directly in your browser. They are real, fast and free to run. Blocks backed by machine-learning models are not available yet.

Why does my shared pipeline use a different picture?

Share links never include uploaded images. The link falls back to the Shapes sample. Send the image separately, and the other person can load it into the Image block.

My image looks small or soft.

Uploads are scaled to 420 px on the longest side so every block stays fast. Use Resize to scale a result up for preview, but note it cannot add detail that is not there.

A block shows “Connect an input”.

Its input has no wire, or the block before it has no input of its own. Follow the chain back to an Image block and make sure each step is connected.

The share button says links only work on the live site.

The sharing API is part of the deployed site. When you open pipelines.html straight from your computer, or from a basic local server, the API does not exist. Export and Import work everywhere.

Does it work on a phone?

Yes, the editor is usable with touch, but a larger screen makes wiring much easier.