Tools: images

Tools for adding images, placeholder images and the site icon. Each returns a ready-made HTML fragment that the assistant pastes into the page.

How Sajto processes images

  • Name
    Format
    Description

    The image type is recognised from its content, and the storage format follows the path extension. .webp is recommended: it is much smaller than JPEG or PNG and supports transparency. .svg files are stored unchanged, and animated GIFs must stay .gif.

  • Name
    Size
    Description

    Raster images are scaled down to maxWidth (never up). An image can be up to 5 MB after processing.

  • Name
    Privacy
    Description

    Images are rotated according to the camera orientation and stripped of metadata such as GPS location.

  • Name
    Accessibility
    Description

    Every image needs alternative text (alt). An empty alt is allowed only for a purely decorative image.

asset_upload

Stores in the working copy an image sent as base64 bytes. When the image has a URL, asset_fetch is better, because the base64 of a real photo is very large. Good for small images and logos. It returns the path, the size in pixels and bytes, and a ready-to-use <img> element with width, height, alt and lazy loading.

Parameters

  • slugtextrequired

    The site slug.

  • pathtextrequired

    Where to store the image, relative to the site root, for example img/team.webp. An existing file at this path is replaced.

  • base64textrequired

    The bytes of the image file as base64 (a data: address is accepted too). At most 10 MB before processing.

  • alttextrequired

    Alternative text for the <img>: a short description of what is shown, for screen readers and search engines. Empty only for a purely decorative image.

  • maxWidthnumberoptional

    The largest width in pixels to keep (16–4000). Defaults to 1600. Larger images are scaled down.

  • responsiveyes/nooptional

    true: also stores smaller copies (e.g. 480 and 960 px) and returns an <img> with srcset, so phones download less. Defaults to false. Worth it for large photos, not for icons.

  • aboveTheFoldyes/nooptional

    true for an image visible without scrolling (e.g. a large picture at the top, a logo in the header): the snippet then has no loading="lazy". Defaults to false.

  • The image type is recognised from its content, and the storage format depends on the path extension: .webp (recommended), .jpg, .png, .gif or .svg (stored unchanged). Animated GIFs must stay .gif.
  • Raster images are scaled down (never up), rotated according to the camera orientation and stripped of metadata such as GPS location.
  • An image of up to 5 MB after processing.

Example request to the assistant

Upload my logo as img/logo.webp.

asset_fetch

Downloads an image from a URL into the site and optimises it. Use it for an image the user pointed to (their logo or photo on another site, a direct link to a file they have rights to). The address must lead to the image file itself, not to a page that displays it. Only public sites can be fetched.

Parameters

  • slugtextrequired

    The site slug.

  • urltextrequired

    The full http(s) address of the image file, for example https://example.com/logo.png.

  • pathtextrequired

    Where to store the image, relative to the site root, for example img/logo.webp. An existing file at this path is replaced.

  • alttextrequired

    Alternative text for the <img>. Empty only for a purely decorative image.

  • maxWidthnumberoptional

    The largest width in pixels to keep (16–4000). Defaults to 1600.

  • responsiveyes/nooptional

    true: also stores smaller copies and returns an <img> with srcset. Defaults to false.

  • aboveTheFoldyes/nooptional

    true for an image visible without scrolling: the snippet has no loading="lazy". Defaults to false.

  • Private and internal addresses are refused (SSRF protection).
  • Only use images that belong to the user or are licensed for reuse. Do not take images from sites you only analysed for inspiration.

Example request to the assistant

Fetch my logo from https://example.com/logo.png as img/logo.webp.

asset_placeholder

Creates a placeholder image as a small SVG file: a neutral box of the given size with a label, so you can build and view the page layout before real images exist. It returns a ready-to-use <img> element with width and height.

Parameters

  • slugtextrequired

    The site slug.

  • pathtextrequired

    Where to store the file; it must end in .svg, for example img/hero-placeholder.svg.

  • widthnumberrequired

    The width in pixels (16–4000). Use the size the image will have in the layout.

  • heightnumberrequired

    The height in pixels (16–4000).

  • labeltextoptional

    Text in the box, for example “Photo of the bakery” (up to 60 characters). Defaults to the size.

  • backgroundtextoptional

    The background as a hex colour, for example #e5e7eb (default light grey). The text colour adapts by itself.

  • alttextoptional

    Alternative text for the <img>. Defaults to the label.

  • Placeholders are for the time you work. Before the site is finished they must be replaced with real ones (asset_upload or asset_fetch to the same path).

Example request to the assistant

Put a 1200×600 placeholder image labelled “Photo of the bakery” in the hero section.

asset_favicon

Creates the site icon (favicon, shown on the browser tab): either from a letter or short mark on a coloured rounded square (favicon.svg, favicon.ico and apple-touch-icon.png in the root), or from an existing raster logo (favicon.ico, favicon-32.png and apple-touch-icon.png). It returns <link> lines to put in the <head> of every page.

Parameters

  • slugtextrequired

    The site slug.

  • lettertextoptional

    1–2 characters to draw, usually the first letter of the site name. Required unless logoPath is given.

  • backgroundtextoptional

    The icon background colour as hex, for example #2563eb (default). Pick the main brand colour.

  • colortextoptional

    The letter colour as hex. Defaults to white or near-black, whichever is readable on the background.

  • logoPathtextoptional

    The path of a PNG, JPEG, WebP or GIF logo already in the site (e.g. img/logo.png), used instead of a letter. SVG logos are not supported here: link them directly in <link rel="icon">.

Example request to the assistant

Make a favicon with the letter P on a brown background.

Was this page helpful?