Skip to content

[p5.js 2.0+ Bug Report]:save() not working on graphics #8881

@aleksandrajovanic

Description

@aleksandrajovanic

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • WebGPU
  • p5.strands
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

2.0 and above

Web browser and version

all

Operating system

win

Steps to reproduce this

Save isn't working on graphic, in this example on event mouseRelease (or any other), throws error "TypeError: pg.save is not a function".

let pg;

function setup() {
	createCanvas(windowWidth, windowHeight);
	pg = createGraphics(width, height);

   for (let i=0; i<100; i++){
	  pg.circle(random(0,width),random(0,height), 20);
	}
	
	background(100);
}

function draw() {
	image(pg, 0, 0);
}

function mouseReleased() {
	pg.save("test.png");
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions