# SVG Via PNG API

#### **PNGtoSVG API ドキュメント**

PNGtoSVG API は、PNG形式の画像をSVG形式に変換するための便利なツールです。このAPIは、ウェブやアプリケーションでSVG画像を必要とするデザイナー、開発者、マーケティングチーム向けに設計されています。

***

SVG形式はスケーラブルで、解像度に依存しないため、ウェブサイト、グラフィックツール、モバイルアプリで広く利用されています。本APIを使用することで、以下のようなメリットを得られます。

* **画像最適化**: PNGをベクター形式に変換することで、画像の解像度を問わず高品質な表示を実現。
* **開発効率化**: 手動での変換作業を自動化し、開発効率を向上。
* **デザイン管理**: SVGは編集が容易で、アイコンやロゴの管理に適しています。

***

#### **料金体系**

* **1000アクセスごとに 100円**\
  大量の画像変換が必要なプロジェクトに最適な価格設定です。
* 一度に複数の画像を選択しても料金は変わりませんが、処理に時間がかかったり失敗する場合があります。また、一度にアップロードできるファイルサイズは100MBまでです。

***

#### **エンドポイント**

```
https://events-front.mixeder.net/v2/convertion/pngtosvg/
```

***

#### **利用方法**

**HTTPメソッド**

`POST`

**リクエストヘッダー**

| ヘッダー名     | 説明         | 必須 |
| --------- | ---------- | -- |
| `api-key` | ユーザーのAPIキー | はい |

**リクエストボディ**

以下の形式でPNG画像ファイルを送信してください。

| パラメーター名 | タイプ      | 説明                | 必須 |
| ------- | -------- | ----------------- | -- |
| `files` | `file[]` | PNG形式の画像ファイル（複数可） | はい |

**レスポンス例**

**成功時**

```json
[
  {
    "success": true,
    "fileName": "example.png",
    "svg": "<svg>...</svg>"
  }
]
```

| フィールド名     | タイプ       | 説明                  |
| ---------- | --------- | ------------------- |
| `success`  | `boolean` | 変換成功のステータス          |
| `fileName` | `string`  | アップロードされたファイル名      |
| `svg`      | `string`  | SVG形式に変換されたデータ（文字列） |

**失敗時**

```json
[
  {
    "error": "PNGからSVGへの変換に失敗しました。"
  }
]
```

| フィールド名  | タイプ      | 説明       |
| ------- | -------- | -------- |
| `error` | `string` | エラーメッセージ |

***

#### **活用事例**

1. **ウェブアイコンの自動生成**\
   PNG形式で提供されたアイコンをSVG形式に変換し、ウェブサイトやアプリでの軽量化を実現。
2. **ロゴの再利用**\
   解像度に依存しないSVG形式で企業ロゴを保存し、様々なデバイスや解像度で利用可能に。
3. **デザインツールの統合**\
   グラフィックツールで利用するために、PNG画像をベクター形式に変換。

***

#### **サンプルコード**

以下は、さまざまなプログラミング言語での利用例です。

**Python**

```python
import requests

url = "https://events-front.mixeder.net/v2/convertion/pngtosvg/"
headers = {
    "api-key": "your_api_key"
}
files = {
    "files": open("example.png", "rb")
}

response = requests.post(url, headers=headers, files=files)
print(response.json())
```

**PHP**

```php
$apiUrl = "https://events-front.mixeder.net/v2/convertion/pngtosvg/";
$apiKey = "your_api_key";

$file = new CURLFile('example.png', 'image/png', 'example.png');
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "api-key: $apiKey"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
    'files' => $file
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
```

**Node.js**

```javascript
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');

const url = "https://events-front.mixeder.net/v2/convertion/pngtosvg/";
const apiKey = "your_api_key";

const formData = new FormData();
formData.append("files", fs.createReadStream("example.png"));

axios.post(url, formData, {
    headers: {
        ...formData.getHeaders(),
        "api-key": apiKey
    }
}).then(response => {
    console.log(response.data);
}).catch(error => {
    console.error(error);
});
```

**cURL**

```bash
curl -X POST \
  -H "api-key: your_api_key" \
  -F "files=@example.png" \
  https://events-front.mixeder.net/v2/convertion/pngtosvg/
```

***

#### **注意事項**

1. **APIキーの管理**: APIキーは他人と共有せず、安全に管理してください。
2. **ファイルサイズ制限**: アップロードするPNGファイルのサイズが制限を超えないよう注意してください。
3. **サポートされる形式**: 現在、PNG形式のみサポートしています。

***


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.mixeder.net/conversion-api/docs/svg-via-png-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
