Update readme and examples for SVG

This commit is contained in:
doctorpangloss 2024-08-28 15:12:17 -07:00
parent 2075f0f0d8
commit fd00368437
3 changed files with 277 additions and 28 deletions

View File

@ -308,6 +308,16 @@ In this example, LLAVA-NEXT (LLAVA 1.6) is prompted to describe an image.
You can try the [LLAVA-NEXT](tests/inference/workflows/llava-0.json), [Phi-3](tests/inference/workflows/phi-3-0.json), and two [translation](tests/inference/workflows/translation-0.json) [workflows](tests/inference/workflows/translation-1.json). You can try the [LLAVA-NEXT](tests/inference/workflows/llava-0.json), [Phi-3](tests/inference/workflows/phi-3-0.json), and two [translation](tests/inference/workflows/translation-0.json) [workflows](tests/inference/workflows/translation-1.json).
# SVG Conversion and String Saving
ComfyUI LTS supports powerful SVG conversion capabilities using vtracer and Skia, along with enhanced string saving functionality. This allows for seamless conversion between raster images and SVG format, as well as flexible string saving options.
![SVG Conversion Example](docs/assets/svg_01.png)
In this example, a raster image is converted to SVG, potentially modified, and then converted back to a raster image. The resulting image and SVG code can be saved.
You can try the [SVG Conversion Workflow](tests/inference/workflows/svg-0.json) to explore these features.
# Video Workflows # Video Workflows
ComfyUI LTS supports video workflows with AnimateDiff Evolved. ComfyUI LTS supports video workflows with AnimateDiff Evolved.
@ -855,6 +865,7 @@ curl -X POST "http://localhost:8188/api/v1/prompts" \
``` ```
**Python**: **Python**:
```python ```python
import requests import requests
@ -882,32 +893,32 @@ response = requests.post(url, json=payload, headers=headers)
```javascript ```javascript
async function generateImage() { async function generateImage() {
const prompt = "a man walking on the beach"; const prompt = "a man walking on the beach";
const workflow = { const workflow = {
"4": { "4": {
"inputs": { "inputs": {
"ckpt_name": "sd_xl_base_1.0.safetensors" "ckpt_name": "sd_xl_base_1.0.safetensors"
}, },
"class_type": "CheckpointLoaderSimple" "class_type": "CheckpointLoaderSimple"
}, },
// ... (include the rest of the workflow) // ... (include the rest of the workflow)
}; };
const response = await fetch('http://localhost:8188/api/v1/prompts', { const response = await fetch('http://localhost:8188/api/v1/prompts', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Accept': 'image/png' 'Accept': 'image/png'
}, },
body: JSON.stringify({ prompt: workflow }) body: JSON.stringify({prompt: workflow})
}); });
const blob = await response.blob(); const blob = await response.blob();
const imageUrl = URL.createObjectURL(blob); const imageUrl = URL.createObjectURL(blob);
const img = document.createElement('img'); const img = document.createElement('img');
// load image into the DOM // load image into the DOM
img.src = imageUrl; img.src = imageUrl;
document.body.appendChild(img); document.body.appendChild(img);
} }
generateImage().catch(console.error); generateImage().catch(console.error);

BIN
docs/assets/svg_01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 KiB

File diff suppressed because one or more lines are too long