Export tool allows downloading and exporting image or current editor data in various formats.

Default Parameters

Export tool defaults can be specified via defaultFormat, defaultQuality and defaultName parameters. These will affect "save" button as well.

<script>
   var pixie = new Pixie({
      tools: {
         export: {
            defaultFormat: 'png', //png, jpeg or json
            defaultName: 'image', //default name for downloaded photo file
            defaultQuality: 0.8, //works with jpeg only, 0 to 1
         }
      }
   });
</script>

Export tool methods

export

  • export(name?: string, format?: "png" | "jpeg" | "json", quality?: number): void
  • Main export function. By default this is called when user clicks save button in pixie interface. It will apply watermark (if specified) and execute one of the actions below in this order of priority:

    1. Send image data to url, if specified via saveUrl option in pixie configuration.
    2. Execute callback function, if provided via onSave option in pixie configuration.
    3. Download photo to user device with specified name, format and quality.

    Parameters

    • Default value name: string = "image"
    • Default value format: "png" | "jpeg" | "json" = "png"
    • Default value quality: number = 0.8

    Returns void

getDataUrl

  • getDataUrl(format?: "png" | "jpeg" | "json", quality?: number): string
  • This will return current photo as base64 encoded data.

    Parameters

    • Default value format: "png" | "jpeg" | "json" = "png"
    • Default value quality: number = 0.8

    Returns string

Export tool parameters

Name Type Description
name string name of photo. Should not include extension.
form string format of export data. png, jpeg or json. Specifying json as format will export current editor state in json, instead of a photo.
quality number Quality of exported photo. Between 0 and 1. Only works with jpeg format. Defaults to: 0.8