save

save-frameclj

save

Arguments
[filename]
Docstring

Saves an image from the display window. Images are saved in TIFF, TARGA, JPEG, and PNG format depending on the extension within the filename parameter. For example, image.tif will have a TIFF image and image.png will save a PNG image. If no extension is included in the filename, the image will save in TIFF format and .tif will be added to the name. All images saved from the main drawing window will be opaque. To save images without a background, use create-graphics.

Works only inside sketch functions?
Yes
Original Processing method
save()
Original p5js method
save()
Example
(q/camera 150 150 150 0 0 0 0 0 1)
(q/box 100)
(q/save "generated/box.png")
; stop sketch after saving image
; otherwise it will show save dialog
; on every iteration
(q/exit)
try example

save-frameclj

Arguments
[name]
Docstring

Saves an image identical to the current display window as a file. May be called multiple times - each file saved will have a unique name. Name and image format may be modified by passing a string parameter of the form "foo-####.ext" where foo- can be any arbitrary string, #### will be replaced with the current frame id and .ext is one of .tiff, .targa, .png, .jpeg or .jpg

Examples: (save-frame "pretty-pic-####.jpg")

Works only inside sketch functions?
Yes
Original Processing method
saveFrame()
Original p5js method
None.
Example
clojure specific
  • (q/camera 150 150 150 0 0 0 0 0 1)
    (q/background 127)
    (q/with-rotation [(/ (q/frame-count) 10)]
      (q/box 100))
    (q/save-frame "generated/rotating-box-####.png")