Resize compress image
  • 18 May 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

Resize compress image

  • Dark
    Light
  • PDF

Resizes and/or compresses an image. Larger images will be scaled down to fit the maximum height/width value. Aspect ratio is preserved.

The resultant image will be stored in the device's temporary files folder, with an autogenerated unique ID for its filename. You can use the Move/rename file/directory flow function to move it to a permanent location.

Input arguments

Label Key Type Required? Default Description
Source image path source String(local-filesystem-reference) Yes Absolute local filesystem path to the source image, including filename and extension.
Image quality imageQuality Number Yes 100 Quality of the compressed image. Smaller quality results in smaller file size. Must be an integer between 0100.
Image maximum height maxHeight Number(integer) No Maximum height of the resized image, in pixels.
Image maximum width maxWidth Number(integer) No Maximum width of the resized image, in pixels.

Output arguments

Number of outputs: 2

Label Key Type Description
Resized/compressed image file imageFile Object Object describing the resized/compressed image in the local filesystem.
  • Local path
imageFile.path String Absolute local filesystem path representing the file location on the device, including the filename and extension. On web, this is created via the [`createObjectURL`](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL) method.
  • MIME type
imageFile.mimeType String MIME type of the file, if it could be determined.
  • Name
imageFile.name String Name of the file in the local filesystem, if applicable. Note that the filename and extension are included in the **Local path** property already.
  • Size
imageFile.size Number Size of the file, in bytes.
  • Created at
imageFile.createdAt String Creation datetime of the file, if it can be determined.
  • Modified at
imageFile.modifiedAt String Datetime when the file was last modified, if it can be determined.

Events

No events.

Errors

Label Code Description
Unknown error unknown Thrown if an unknown error occurred resizing/compressing the image

Was this article helpful?

What's Next