> For the complete documentation index, see [llms.txt](https://help.craftsmanplus.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.craftsmanplus.com/asset-library/uploading-assets/sanitization-and-optimization.md).

# Sanitization & Optimization

When assets are uploaded into the Asset Library, they automatically undergo two sequential processing steps:

1. **Sanitization** - ensures assets meet standard formatting, sizing, and metadata requirements while maintaining quality.
2. **Optimization** - generates a secondary, lower-weight version of the asset for mobile + web performance efficiency.

After these processes:

* The **sanitized** version replaces the original upload (the original file is not retained).
* An **optimized** version may be created if further reduction in file size can be achieved without unacceptable quality loss. (The user can then select this version by choosing **Optimized** while [adding an asset to a project in PLAY](/play/layers/adding-a-layer.md))

***

### **1. Sanitization** <a href="#id-1.-sanitization" id="id-1.-sanitization"></a>

#### **Purpose** <a href="#purpose" id="purpose"></a>

The sanitization process standardizes and re-encodes all uploaded assets. *Sanitization should **never reduce asset quality**.*

* Removes unnecessary metadata.
* Re-encodes files to ensure compatibility.
* Applies **lossless** compression and scaling.
* Enforces a uniform format, resolution, and sample rate baseline.

The sanitized version becomes the canonical “original” within the asset library.

If sanitization fails (due to file corruption or unsupported format), **the asset is not imported.**

{% hint style="info" %}
*Sanitization will soon support **auto-format conversion**. Unsupported formats (like MOV or TIFF) will automatically be converted to the correct format (e.g., MP4, PNG).*
{% endhint %}

***

#### **Sanitization Key Rules** <a href="#sanitization-key-rules" id="sanitization-key-rules"></a>

*Sanitization adjusts your files to the below* *values, unless they already meet the thresholds:*

**Images**

* **Max Size:** 2048 × 2048 px
* **Format:** Preserve original (e.g., PNG remains PNG)
* **Quality:** Lossless re-encode (no perceptible degradation)

**Videos**

* **Max Size:** 2048 × 2048 px
* **Format:** Preserve original (e.g., MP4)
* **Max FPS:** 30 fps
* **Quality:** Maintain original bitrate and fidelity

**Audio**

* **Format:** MP3
* **Max Channels:** 2 (Stereo)
* **Max Sample Rate:** 44.1 kHz
* **Max Bitrate:** 128 kbps

**Fonts**

* **Format:** WOFF2

***

### **2. Optimization** <a href="#id-2.-optimization" id="id-2.-optimization"></a>

Optimization creates a secondary version of the sanitized asset tuned for minimal file size with acceptable visual or audio quality.

This process is more aggressive than sanitization and may result in minor quality reduction.

#### **Behavior** <a href="#behavior" id="behavior"></a>

* The optimizer evaluates the file size of the sanitized version.
* If the optimized result does **not** yield a meaningful size reduction, the optimized version will **not** be stored.
* Every asset may have up to two versions in the system:
  * **Sanitized**
  * **Optimized**

***

#### **Optimization Key Rules** <a href="#optimization-key-rules" id="optimization-key-rules"></a>

*Optimization adjusts your files to the below values, unless they already meet the thresholds:*

**Images**

* **Max Size:** 1024 × 1024 px
* **Format:** WEBP
* **Quality:** Smart optimization (algorithmically determines best compression without visible degradation)

**Videos**

* **Max Size:** 1024 × 1024 px
* **Format:** MP4 (future: WEBM)
* **Frame Rate:**
  * \>2s duration → 20 fps
  * ≤2s duration → 30 fps
* **Quality:** Medium

**Audio**

* **Format:** MP3
* **Max Channels:** 1 (Mono)
* **Max Sample Rate:** 32 kHz
* **Max Bitrate:** 32 kbps

{% hint style="info" %}
Video Optimization is skipped if the original file is under **0.1 MB**
{% endhint %}

***

### **3. Editing & Version Handling** <a href="#id-3.-editing-and-version-handling" id="id-3.-editing-and-version-handling"></a>

* When an asset is edited, the **sanitized version** is always used as the base.
* The **optimized version** is derived from that sanitized base, not from prior optimized iterations.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.craftsmanplus.com/asset-library/uploading-assets/sanitization-and-optimization.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
