Compress Image

VerifiedSafe

Compress image files to reduce size by adjusting quality parameter.

Sby Skills Guide Bot
ContentBeginner
7/22/2026
Claude CodeCodex
#image-compression#image-processing#file-size#quality-tuning#python

Recommended for

Automated summary

Compresses an image file by tuning a quality parameter (0 to 95) to shrink its size, through a Python call to office.skills.image.compress_image.

Strengths

  • Single explicit call with input_file, output_file and quality, no extra configuration
  • The quality parameter gives direct, predictable control over the size/quality trade-off
  • Output format is picked simply by the output file extension (e.g. .jpg)
  • Drops easily into an existing Python script or image-processing pipeline

Limitations

  • No target-file-size mode: quality must be tuned by trial and error
  • No batch handling is described; one file per call
  • The function returns None, so no resulting size or size reduction is reported
  • Results depend on the chosen output format, which can lose transparency (PNG to JPG)
When to use it

Use it when an image must be made lighter for email, a website or a repository, with a manually chosen quality/size trade-off.

When not to use it

Avoid it when you need to hit an exact target size, process a batch of images, or preserve transparency and original metadata.

Security analysis

Safe
Quality score72/100

The skill is purely documentation for a Python image-compression function; it contains no shell commands, network calls, obfuscated payloads, secret handling, or destructive operations. The only action is calling a documented local API function with user-supplied paths.

No concerns found

How this analysis is made

Examples

Compresser une photo
压缩这张图片 ./photo.jpg,输出到 ./photo_small.jpg,质量设为 30
Réduire le poids d'un PNG
帮我把 ./test.png 压缩一下,另存为 ./test_compressed.jpg,用 quality=50
Essayage de qualité
用 quality=80 和 quality=40 各压缩一次 ./banner.jpg,我想比较文件体积差别

name: compress_image description: 压缩图片文件大小,通过调整质量参数控制输出体积。当用户提到压缩图片、图片减肥、缩小图片体积、降低图片质量时使用。

compress_image Skill

压缩图像文件,以减小其文件大小,同时尽量保持视觉质量

功能描述

将图像文件压缩为更小的体积,通过调整压缩质量参数控制输出文件大小。

所属分类

office/skills/image/compress_image/

调用方式

from office.skills.image import compress_image

compress_image(
    input_file='./test.png',
    output_file='./test_compressed.jpg',
    quality=50
)

参数说明

| 参数 | 类型 | 必填 | 默认值 | 说明 | |------|------|------|--------|------| | input_file | str | 是 | - | 需要压缩的输入图像文件的路径 | | output_file | str | 是 | - | 压缩后的图像文件保存路径 | | quality | int | 是 | - | 压缩质量等级,取值范围 0 到 95。值越高,质量越好,文件越大 |

返回值

None

使用示例

from office.skills.image import compress_image
compress_image(input_file='./photo.jpg', output_file='./photo_small.jpg', quality=30)

原始函数

office.api.image.compress_image

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/compress-image-mrwakfjj/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/compress-image-mrwakfjj' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/compress-image-mrwakfjj/download' --output '.skill-downloads/compress-image-mrwakfjj/SKILL.md.part' && mv '.skill-downloads/compress-image-mrwakfjj/SKILL.md.part' '.skill-downloads/compress-image-mrwakfjj/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/compress-image-mrwakfjj/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills