Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Android-Webp profile

Purpose

The profile is designed to import WEBP resources as an android drawable resources. Different densities (ldpi, mdpi, hdpi, xhdpi, etc) and light/dark options (night) are supported.

Default loading process

The asset import process consists of the following stages:

  1. Fetch Figma remote: REST API reference
  2. Locate the node ID by the specified name
  3. Request SVG export from Figma using the node ID: REST API reference
    • Includes dark theme variants when configured (night)
  4. Download SVG assets
  5. Render SVG images into PNG for all requested densities
  6. Convert rendered PNGs to WEBP format (using libwebp)
  7. Organize outputs in standard Android resource structure:
    • drawable-{density}/
    • drawable-night-{density}

Legacy loading process (legacy_loader = true)

The asset import process consists of the following stages:

  1. Fetch Figma remote: REST API reference
  2. Locate the node ID by the specified name
  3. Request PNG export from Figma using the node ID: REST API reference
    • Batch request PNG exports for all densities
    • Includes dark theme variants when configured (night)
  4. Download all PNG assets
  5. Convert to WEBP format (using libwebp)
  6. Organize outputs in standard Android resource structure:
    • drawable-{density}/
    • drawable-night-{density}

Complete Configuration in .figtree.toml

[profiles.android-webp]
# ID from the [remotes] section. 
# Uses the default remote if unspecified, but can reference any configured remote
remote = "some_remote_id"
# Root Android resources directory
# (parent of drawable-* folders)
android_res_dir = "src/main/res"
# Output quality for WEBP conversion (0-100)
# Defaults to 100 (lossless) - recommended value
quality = 100
# Density configurations
scales = ["mdpi", "hdpi", "xhdpi", "xxhdpi", "xxxhdpi"]
# Dark theme configuration 
# Naming pattern for dark theme variants
# {base} is replaced with base asset name
# Leave unspecified to disable dark theme support
night = "{base} / Dark"
# If true, the legacy resource loading method will be used.
# The new approach downloads the SVG source and renders the raster image locally.
# In most cases, this significantly speeds up the import process.
# This may not suit all use cases, so the feature can be disabled.
legacy_loader = false