> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-matt-router-pricing-pika-and-guard.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Recraft Remove Background - ComfyUI ネイティブノードドキュメント

> 画像の背景を自動的に除去し、透過可能なアルファチャンネルを生成する Recraft パートナーノード

<img src="https://mintcdn.com/dripart-matt-router-pricing-pika-and-guard/NWMOReWEwYO_6Uwl/images/built-in-nodes/api_nodes/recraft/recraft-remove-background.jpg?fit=max&auto=format&n=NWMOReWEwYO_6Uwl&q=85&s=847a34919c4421e436d5f8110d3caf06" alt="ComfyUI ネイティブ Recraft Remove Background ノード" width="1506" height="576" data-path="images/built-in-nodes/api_nodes/recraft/recraft-remove-background.jpg" />

Recraft Remove Background ノードは Recraft の API を利用して、画像の背景を知能的に検出し、自動的に除去します。これにより、透過背景を持つ画像および対応するアルファマスクが生成されます。

## パラメータ

### 基本パラメータ

| パラメータ | 型 | デフォルト | 説明 |
| - | - | - | - |
| image | 画像 | - | 背景を除去する入力画像 |

### 出力

| 出力 | 型 | 説明 |
| - | - | - |
| IMAGE | 画像 | 背景が除去された画像（アルファチャンネル付き） |
| MASK | マスク | 主要被写体のマスク（白色領域が保持される） |

## ソースコード

\[ノードのソースコード（2025-05-03 更新）]

```python theme={null}
class RecraftRemoveBackgroundNode:
    """
    Remove background from image, and return processed image and mask.
    """

    RETURN_TYPES = (IO.IMAGE, IO.MASK)
    DESCRIPTION = cleandoc(__doc__ or "")  # Handle potential None value
    FUNCTION = "api_call"
    API_NODE = True
    CATEGORY = "api node/image/Recraft"

    @classmethod
    def INPUT_TYPES(s):
        return {
            "required": {
                "image": (IO.IMAGE, ),
            },
            "optional": {
            },
            "hidden": {
                "auth_token": "AUTH_TOKEN_COMFY_ORG",
            },
        }

    def api_call(
        self,
        image: torch.Tensor,
        auth_token=None,
        **kwargs,
    ):
        images = []
        total = image.shape[0]
        pbar = ProgressBar(total)
        for i in range(total):
            sub_bytes = handle_recraft_file_request(
                image=image[i],
                path="/proxy/recraft/images/removeBackground",
                auth_token=auth_token,
            )
            images.append(torch.cat([bytesio_to_image_tensor(x) for x in sub_bytes], dim=0))
            pbar.update(1)

        images_tensor = torch.cat(images, dim=0)
        # use alpha channel as masks, in B,H,W format
        masks_tensor = images_tensor[:,:,:,-1:].squeeze(-1)
        return (images_tensor, masks_tensor)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.