# ImageConvertAPI

## Image Conversion API リファレンス

### サービス名

**Image Conversion API**

### 利用用途

`Image Conversion API`は、指定された画像ファイルを別の形式に変換するAPIです。さまざまな画像フォーマット（JPEG、PNG、GIFなど）を互いに変換できるため、異なる用途に応じて画像の形式を変更する際に利用されます。

***

### API エンドポイント

```
https://events-front.mixeder.net/v1/image
```

***

### パラメータ

| パラメータ  | 必須 | 説明                     |
| ------ | -- | ---------------------- |
| `key`  | 必須 | 利用者のAPIキー              |
| `from` | 必須 | 変換元の画像ファイルのURLまたはパス    |
| `to`   | 任意 | 変換先の画像形式（デフォルトは`webp`） |

***

### 利用方法

1. 有効なAPIキーを用意します。
2. 変換したい画像のURLまたはパスを`from`パラメータに指定します。
3. オプションで、変換先の形式を`to`パラメータに指定します（指定がない場合は`webp`形式に変換）。
4. APIリクエストを送信すると、指定した形式に変換された画像が返されます。

***

### サンプルコード

#### cURL

```bash
curl "https://events-front.mixeder.net/v1/image?key=YOUR_API_KEY&from=https://example.com/sample.jpg&to=png"
```

#### Node.js

```javascript
const https = require('https');

const url = 'https://events-front.mixeder.net/v1/image/?key=YOUR_API_KEY&from=https://example.com/sample.jpg&to=png';

https.get(url, (res) => {
    let data = '';
    res.on('data', (chunk) => {
        data += chunk;
    });
    res.on('end', () => {
        console.log(data);
    });
}).on('error', (err) => {
    console.error('Error: ' + err.message);
});
```

#### Python

```python
import requests

url = "https://events-front.mixeder.net/v1/image/"
params = {
    "key": "YOUR_API_KEY",
    "from": "https://example.com/sample.jpg",
    "to": "png"
}

response = requests.get(url, params=params)
if response.status_code == 200:
    print(response.text)
else:
    print(f"Error: {response.status_code}")
```

***

### エラーメッセージ

* **API Key not provided.**: APIキーが指定されていません。
* **API key is wrong**: APIキーが無効です。
* **Query\[From] not provided.**: 変換元の画像ファイルが指定されていません。
* **ERROR**: 画像の変換に失敗しました。無効な画像形式の場合や処理中にエラーが発生した場合に表示されます。

***

### 注意事項

* 有効なAPIキーが必要です。指定がない場合や無効な場合はリクエストは拒否されます。
* `from`パラメータには、変換したい画像のURLまたはパスを正確に指定してください。
* サポートされている画像形式は、BMP、JPEG、PNG、GIF、WEBPです。これ以外の形式は変換できません。


---

# 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/mixederpublicapis/apirifarensu/imageconvertapi.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.
