Nodes/comfyui_image2oss/image2oss-tag-sts-service
ComfyUI Node

image2oss-tag-sts-service

The upload node that stamps a mandatory 'Ai生成' label — China-law edition

By nxt5656·Created about a year ago·Updated 8 days ago· 0
image2oss-tag-sts-service
  • image
    filename["tmp/002/001.jpeg"]
    sts_service_urlhttps://demo.cn/sts_service
    bucket_namebucket_name
    endpointoss-cn-hangzhou.aliyuncs.com

    Somewhere between "annoying compliance" and "legitimate distribution question" sits the fact that China requires AI-generated content to carry an AI label - the README points at the national standard 网络安全技术 人工智能生成合成内容标识方法 (AI-generated/synthetic content identification). This node is the pack's attempt to make that painless: it uploads your image to Alibaba OSS and stamps a semi-transparent "Ai生成" watermark on it first, so the labeled image is what lands in the bucket.

    This is the STS-service flavor, meaning credentials come from a URL you host rather than widgets - the same security win as the pack's other STS nodes. If your workflow never leaves your machine and you don't want to stand up a token service, the sibling OSSUploadNodeForCNLaw does the identical watermarking with direct AK/SK.

    How it works

    Run the node and it fetches temporary credentials from sts_service_url (expecting {"success": true, "data": {"accessKeyId", "accessKeySecret", "securityToken"}}), then for each image: watermark it, encode as PNG, upload. The watermark is drawn in the bottom-right corner, white and mostly transparent, with its text height sized to at least 5% of the image's shorter edge (floored at 10px) - big enough to actually read, small enough not to wreck the picture. It renders with the Noto Sans CJK SC font the pack ships, because Pillow's default font can't draw the Chinese character.

    The inputs

    • image - the IMAGE from your sampler/VAE decode.
    • filename - this one is parsed as a list, unlike the sibling uploader. It must be a string that evaluates to a list of object keys, one per image in the batch, and the counts have to match or the node refuses to run:
    ["tmp/002/001.jpeg", "tmp/002/002.jpeg"]
    
    • sts_service_url, bucket_name, endpoint - the usual trio; endpoint is the 44-region dropdown.

    No outputs - it's a terminal output node.

    Install

    ComfyUI Manager (search "image2oss"), comfy node registry-install image2oss, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/nxt5656/image2oss
    

    Restart after. oss2 comes via the pack's requirements. The 16MB NotoSansCJKsc-Regular.otf font ships inside the repo, so nothing extra to hunt down.

    Where people get burned

    • The font path is hardcoded. The code looks for the font at ComfyUI/custom_nodes/image2oss/NotoSansCJKsc-Regular.otf. If your install folder isn't named image2oss - say you cloned into a differently-named directory - the font won't be found, it falls back to Pillow's default font, and the 生成 character renders as a tofu box. The console prints a warning when it happens. Rename the folder.
    • Filename count must equal image count. Batch of 3, list of 2 filenames? Hard ValueError, no upload.
    • Don't treat the label as legal advice. The watermark exists because the author of this pack decided it should. Whether it satisfies the standard for your use case is a question for someone who reads Chinese regulation for a living - this node just makes the labeled version the one that gets uploaded.
    CategoryAPI/oss

    Inputs (5)

    NameTypeDefaultDescription
    imageIMAGE
    filenameSTRING["tmp/002/001.jpeg"]
    sts_service_urlSTRINGhttps://demo.cn/sts_service
    bucket_nameSTRINGbucket_name
    endpointCOMBOoss-cn-hangzhou.aliyuncs.com44 options: oss-cn-hangzhou.aliyuncs.com, oss-cn-shanghai.aliyuncs.com, oss-cn-qingdao.aliyuncs.com, oss-cn-beijing.aliyuncs.com, oss-cn-shenzhen.aliyuncs.com, oss-cn-heyuan.aliyuncs.com, +38

    Outputs (0)

    No outputs