Introduction¶
When creating e-commerce main images, changing backgrounds for ID photos, or designing short video covers, it is often necessary to cut out people from the background. Running segmentation models locally requires configuring environments and computing resources; assembling HTTP requests yourself involves writing signatures and parameters against Tencent Cloud BDA documentation. If you want Agents like Cursor or Claude Code to process user-provided images directly in conversation, a set of executable Skill specifications is required, rather than having the model “visually estimate” contours.
Below is an introduction to TencentCloud YT Segment Portrait on SkillHub (@tencent-adm/tencentcloud-yt-segment-portrait): It encapsulates the Tencent Cloud Portrait Segmentation API into an Agent-readable SKILL.md and scripts, using a binary classification model to identify complete human body contours and return cutout results.
What is this¶
TencentCloud YT Segment Portrait is an Agent Skill targeting design-media scenarios. The current version is 1.0.2, sourced from an enterprise, and published by the Tencent Cloud Intelligent Creation Team. The Skill coordinates are @tencent-adm/tencentcloud-yt-segment-portrait. The SkillHub page marks requires_api_key=true, meaning Tencent Cloud API credentials must be configured and the Portrait Segmentation service enabled before use.
In one sentence: It is a binary classification-based portrait segmentation tool used for complete human body contour recognition and image cutouts. It corresponds to the underlying Tencent Cloud SegmentPortraitPic interface (domain bda.tencentcloudapi.com, version 2020-03-24), called synchronously via scripts/main.py, with a single image size limit of ≤5MB.
Core Features¶
Based on the Skill package description and API references, the verified capabilities are as follows:
- Portrait Segmentation & Cutout: Identifies the complete human body contour in the input image and returns a transparent background cutout and mask-related results.
- Multiple Input Methods: The script supports image URL, local file path, or a long Base64 string (corresponding to the official API’s
Url/Imageparameters). - URL-based Results: The script defaults
RspImgTypetourl. The standard output JSON containsResultImageUrl(transparent background image) andResultMaskUrl(mask). The validity period of returned URLs is 30 minutes (subject to Tencent Cloud API documentation). - Scene Modes (API Layer): Optional
Scenesettings areGEN(General) orGS(Green Screen, performs better for green screen portrait segmentation), defaulting toGEN. - Agent Execution Constraints: The Skill requires the Agent to execute the script directly when the user provides an image and the intent is portrait segmentation. It must not use the model to “fabricate” segmentation results if the API fails.
Image side limitations (API docs): Resolution must be less than 2000×2000; PNG, JPG, JPEG, and BMP are supported, GIF is not; at least one of Url or Image must be provided, and if both are provided, Url takes precedence.
Installation & Activation¶
Install SkillHub CLI¶
If skillhub is not installed on your machine, check the version first; if not installed, follow the official SkillHub installation instructions (full install or CLI only):
command -v skillhub && skillhub --version
curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash
Install this Skill¶
During installation, you must use --dir to point to the current Agent’s skills directory; otherwise, it defaults to ./skills/, and the Agent may fail to load it:
skillhub install @tencent-adm/tencentcloud-yt-segment-portrait --dir <your skills directory>
Common client skills paths (consistent with SkillHub installation documentation):
- Cursor:
~/.cursor/skills/ - Claude Code:
~/.claude/skills/ - Codex:
~/.codex/skills/or.agents/skills/under the project
Alternatively, you can have the Agent follow the prompts on the SkillHub page and refer to https://skillhub.cn/install/skillhub.md to complete installation.
Enable Service & Configure Credentials¶
- Enable the Portrait Segmentation capability at the Tencent Cloud Portrait Segmentation Console.
- Obtain
SecretIdandSecretKeyat API Credential Management. - Set environment variables (do not write keys into the code repository):
export TENCENTCLOUD_SECRET_ID="yourSecretId"
export TENCENTCLOUD_SECRET_KEY="yourSecretKey"
For Windows PowerShell:
$env:TENCENTCLOUD_SECRET_ID = "yourSecretId"
$env:TENCENTCLOUD_SECRET_KEY = "yourSecretKey"
The script depends on Python 3.7+ and tencentcloud-sdk-python; main.py attempts to auto pip install if the SDK is missing, or you can install it manually:
pip install tencentcloud-sdk-python requests
Typical Usage¶
Once credentials are configured, Agents or developers can use the script in the Skill directory to process images. Replace <SKILL_DIR> with the installed Skill root directory (containing scripts/main.py):
python3 <SKILL_DIR>/scripts/main.py "https://example.com/human.png"
Local file example:
python3 <SKILL_DIR>/scripts/main.py /path/to/portrait.jpg
On success, stdout returns JSON, with fields including temporary URLs for the cutout and mask, for example:
{
"ResultImageUrl": "https://...",
"ResultMaskUrl": "https://..."
}
In an Agent session, when a user uploads or provides an image address and specifies the need for portrait segmentation, the Skill requires the model to call the script as described above, read the JSON, and return the links or results to the user, rather than just printing the script path or repeatedly asking for confirmation to execute.
For more complete parameter, error code, and output field descriptions, see references/SegmentPortraitPicApi.md inside the Skill, corresponding to the Tencent Cloud documentation Portrait Segmentation API.
Scenarios & Caveats¶
Who it is for
- Teams that need to perform cutouts, background changes, or portrait asset preprocessing within IDE Agent workflows and prefer to use Tencent Cloud online capabilities.
- Developers who already have a Tencent Cloud account and are willing to pay-as-you-go and manage API credentials.
Limitations & Notes
TENCENTCLOUD_SECRET_ID/TENCENTCLOUD_SECRET_KEYmust be configured; arrears, unenabled services, or insufficient balance will cause API errors (such asResourceUnavailable.InArrears,FailedOperation.BalanceInsufficient, etc., subject to the official error code table).- Image URLs not hosted on Tencent Cloud Object Storage may download slowly or be unstable; documentation suggests prioritizing URLs stored on Tencent Cloud.
- Returned
ResultImageUrl/ResultMaskUrlare time-sensitive; downstream processes should fetch or transfer them within the validity period. - SkillHub statistics (based on page scraping): Rating 100000, Downloads 1216, Installs 19; actual experience depends on network, image specifications, and account billing status.
Conclusion¶
TencentCloud YT Segment Portrait consolidates the Tencent Cloud Portrait Segmentation API into an Agent-executable Skill: once keys and environment variables are ready, a single main.py call yields transparent cutouts and mask URLs, and constrains the Agent to report errors truthfully upon failure. Official Skill entry points:
- API / Installation Source:
https://api.skillhub.cn/tencent-adm/tencentcloud-yt-segment-portrait - SkillHub Display Page:
https://www.skillhub.cn/skills/tencent-adm/tencentcloud-yt-segment-portrait