Data sources

fileUpload

marcelle.fileUpload(): fileUpload;

A file upload component, that creates a stream of files.

Streams

NameTypeDescriptionHold
$filesStream<never()>Stream of files

Example

const myFileUpload = marcelle.fileUpload();
myFileUpload.$files.subscribe((x) => console.log('fileUpload $files:', x));

imageUpload

marcelle.imageUpload({ width?: number, height?: number }): ImageUpload;

An Image upload component, that creates a stream of images and thumbnails. Images are cropped and rescaled to match the target dimensions, if these are non-zero, otherwise the dimensions are unchanged.

Parameters

OptionTypeDescriptionRequiredDefault
widthnumberTarget image width0
heightnumberTarget image height0

Streams

NameTypeDescriptionHold
$imagesStream<ImageData>Stream of images in the ImageDataopen in new window format.
$thumbnailsStream<string>Stream of thumbnail images in base64 dataURIopen in new window format.

Screenshot

Screenshot of the imageUpload component

Example

const imgUpload = marcelle.imageUpload();
imgUpload.$images.subscribe((x) => console.log('imageUpload $images:', x));

sketchPad

marcelle.sketchpad(): Sketchpad;

An input sketching component allowing the user to draw. The generate generates a stream of images of the sketches, as well as stream for various user actions.

Streams

NameTypeDescriptionHold
$imagesStream<ImageData>Stream of images in the ImageDataopen in new window format.
$thumbnailsStream<string>Stream of thumbnail images in base64 dataURIopen in new window format.
$strokeStartStream<undefined>Stream of empty (undefined) events occurring every time the user starts drawing
$strokeEndStream<undefined>Stream of empty (undefined) events occurring every time the user stops drawing

Screenshot

Screenshot of the sketchpad component

Example

const sketch = marcelle.sketchpad();
sketch.$strokeStart.subscribe(() => console.log('sketchpad $strokeStart'));
sketch.$strokeEnd.subscribe(() => console.log('sketchpad $strokeEnd'));

webcam

marcelle.webcam({ width?: number, height?: number, period?: number }): Webcam;

A webcam source component, producing a periodic stream of images.

Parameters

OptionTypeDescriptionRequiredDefault
widthnumberThe target image width224
heightnumberThe target image height224
periodnumberThe period in ms at which images are sampled50

Streams

NameTypeDescriptionHold
$imagesStream<ImageData>Stream of images in the ImageDataopen in new window format.
$thumbnailsStream<string>Stream of thumbnail images in base64 dataURIopen in new window format.
$activeStream<boolean>Boolean stream specifying if the webcam is active (streaming)
$readyStream<boolean>Boolean stream specifying if the webcam is ready
$mediastreamStream<MediaStream>Stream of MediaStream corresponding to the selected webcam. Events are emitted whenever a webcam is selected.

Screenshot

Screenshot of the webcam component

Example

const webcam = marcelle.webcam();
webcam.$images.subscribe((x) => console.log('webcam $images:', x));