Best practices for improving Picsart API performance

 

  1. Be mindful of the original size of the image. If the original file is large, you can expect to see a corresponding increase in upload, processing and download times.
  2. Use a preview size in your user interface. By doing this, you will be reducing the size of the file and correspondingly faster response times in your UI. For example, if your screen width is 1024px, downscale the photo to 1024px which reduces the size of the file and therefore an improvement in the upload time and processing time of any further API calls on this file. When the end-user wants to finalize or persist the changes, apply the effects on the original size.
  3. If you plan to call multiple effects on an image, use the /upload API to generate a reference image id which can then be used to generate preview images and or get the filter result on the original file. This will reduce the need to upload the same file for every effect.
  4. When possible, use more optimal and compressed formats such as WEBP and JPG, instead of PNGs which are bigger in size and therefore have a relatively slower processing time.
  5. When showing the photo in your editor experience, you can download the preview size by specifying the needed size in the URL. The needed parameter to manipulate is "r". See in these examples:
    1. https://cdn.picsart.io/6e24029e-7a55-44dd-88b3-7e995c377d72?type=JPG&to=max&r=0 (r=0 will bring out the whole original result file)
    2. https://cdn.picsart.io/6e24029e-7a55-44dd-88b3-7e995c377d72?type=JPG&to=max&r=256 (r=256 will bring out the 256px preview version of the result file, and this will reduce the download time drastically, e.g. the file size difference can be several megabytes)
    3. The same photo URL can be used multiple times to retrieve the same photo in different sizes and formats. The photo will retain for 24 hours and can be used as many times as needed. 
  6. Communicate spike hours with your account success manager. When Picsart is aware of possible spikes, the infrastructure can be prepared to handle big loads of requests with no additional ramp-up time required.

 

Was this article helpful?