Index of every page on this site: llms.txt
All skills
steelan9199 avatar

/webp-to-jpg

@9e01957
Run it yourself

将WebP格式的图片转换为JPG格式。当用户需要将WebP图片转换为JPG格式时使用此技能,因为某些平台不支持WebP格式。

Use this Skill: https://skilld.dev/gh/steelan9199/wechat-publisher/webp-to-jpg

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

examples.md

≈490 tokens on demand. Your agent reads this file only when SKILL.md points to it.

WebP到JPG转换技能示例

实际转换案例

以下是我们之前成功执行的转换示例:

源文件

  • WebP图片:D:/temp/即梦AI_-_一站式AI创作平台/DM_20260215210813_001.webp

转换过程

python -c "from PIL import Image; img = Image.open('D:/temp/即梦AI_-_一站式AI创作平台/DM_20260215210813_001.webp'); rgb_img = img.convert('RGB'); rgb_img.save('D:/temp/即梦AI_-_一站式AI创作平台/DM_20260215210813_001.jpg', 'JPEG'); print('图片转换成功')"

结果

  • 输出文件:D:/temp/即梦AI_-_一站式AI创作平台/DM_20260215210813_001.jpg
  • 状态:转换成功

更多转换示例

批量转换

如果您需要转换多个WebP图片,可以使用以下Python脚本:

import os
from PIL import Image

def convert_webp_to_jpg(webp_path, jpg_path=None):
    """将单个WebP文件转换为JPG"""
    if jpg_path is None:
        jpg_path = webp_path.rsplit('.', 1)[0] + '.jpg'
    
    img = Image.open(webp_path)
    rgb_img = img.convert('RGB')
    rgb_img.save(jpg_path, 'JPEG')
    print(f'已转换: {webp_path} -> {jpg_path}')

def batch_convert_webp_to_jpg(directory):
    """批量转换指定目录下的所有WebP文件"""
    for filename in os.listdir(directory):
        if filename.lower().endswith('.webp'):
            webp_path = os.path.join(directory, filename)
            jpg_path = os.path.join(directory, filename.rsplit('.', 1)[0] + '.jpg')
            convert_webp_to_jpg(webp_path, jpg_path)

# 使用方法:
# convert_webp_to_jpg('path/to/image.webp')  # 转换单个文件
# batch_convert_webp_to_jpg('path/to/directory')  # 批量转换目录中的所有WebP文件

故障排除

如果出现 "No module named 'PIL'" 错误

pip install Pillow

如果转换后图片质量不佳

可以在保存时调整质量参数:

rgb_img.save('<jpg_image_path>', 'JPEG', quality=95)  # 质量范围1-100

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 alert8mo4 checks · Risk HIGH
  • Gen Agent Trust Hub9mo

    The skill provides a utility for converting images but introduces a high-risk security flaw by instructing the AI agent to perform unsanitized string interpolation into executable Python commands. A user could exploit this by providing a malicious filename that executes arbitrary code on the host system.

  • Socket8mo

    No alerts

  • Snyk9mo

    Risk: LOW · No issues

  • Runlayer9mo

    4/4 files flagged

Signed by skilld at 9e01957. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 9 months ago

README badge

README badge for steelan9199/wechat-publisher/webp-to-jpg