Fragments/Utilities

  • 04boilerplateFree
  • 02color
  • 06patterns
  • 02sdf
  • 06function
  • 03systemNewFree
  • 04interactivity
  • 01noise
  • 13postprocessingNew
  • 03distortion

Join waitlist ↵

Generate Canvas Image

Browser helper that captures a canvas frame and downloads it as a PNG, with optional timestamped filenames.

Loading...
Export JSON→
←→
Works171
Writing34

Fragments

Learn creative coding with shaders. For design engineers, creative coders and shader artists: techniques, tools, deep dives. Powered by ThreeJS and TSL.

Loading...

2025 Phobon

phobon.ioShadercraft

Pages

HomeTechniquesUtilitiesBreakdownsWorksWriting

Contact

X @thenoumenonhey@fragments.supplyOKAY DEV @phobon
All rights reserved.

What it does

generateCanvasImage captures the current canvas frame and saves it as a PNG. Use it in export triggers for both React Three Fiber (state.gl.domElement) and vanilla (renderer.domElement) workflows.

Usage

import { generateCanvasImage } from '@/utils/generate_canvas_image'
 
const handleExport = (canvas: HTMLCanvasElement) => {
  generateCanvasImage(canvas, 'bands')
}

Set includeTimestamp to false if you want deterministic filenames.

API reference

Be the first to know what's next