PicList-Core CLI Image Compression Options: Complete Configuration Guide
The PicList-Core CLI provides 12+ configurable image compression parameters—including quality control, format conversion, pixel-based resizing, rotation, and EXIF metadata removal—all managed through the buildIn.compress configuration namespace.
PicList-Core is an open-source image upload toolchain that includes a built-in compression module to optimize images before transmission. According to the kuingsmile/piclist-core source code, all compression behavior is defined in the buildIn.compress configuration object and exposed via the interactive picgo config compress command.
Quality and Format Conversion Settings
Configure lossy compression intensity and output formats to balance file size against visual fidelity.
Target Quality Control
The quality parameter accepts a number between 0 and 100 to set the target quality for lossy formats like JPEG and WebP. Higher values preserve more image detail but increase file size. This option is defined in src/plugins/beforetransformer/compress.ts at line 7.
picgo set buildIn.compress.quality 85
Format Conversion
Enable cross-format conversion using two paired settings:
- isConvert (
boolean): Toggles whether to convert the image to a different format. - convertFormat (
string): Specifies the target format from a supported list of 20+ options includingavif,webp,png,jpeg,jxl,heif,tiff,gif, andraw.
These fields are defined at lines 8-33 in compress.ts. When isConvert is true, the input image is transcoded to the specified format before upload.
picgo set buildIn.compress.isConvert true
picgo set buildIn.compress.convertFormat webp
Image Resizing and Geometry Transformations
Adjust dimensions and orientation through pixel-specific or percentage-based scaling, plus flip and rotate operations.
Pixel-Based Resizing
Control absolute dimensions using three parameters defined at lines 34-45 in src/plugins/beforetransformer/compress.ts:
- isReSize (
boolean): Master toggle for pixel-based resizing. - reSizeWidth (
number): Target width in pixels. - reSizeHeight (
number): Target height in pixels. - skipReSizeOfSmallImg (
boolean): Skips resizing if the source image is already smaller than the target dimensions.
picgo set buildIn.compress.isReSize true
picgo set buildIn.compress.reSizeWidth 1024
picgo set buildIn.compress.reSizeHeight 768
picgo set buildIn.compress.skipReSizeOfSmallImg true
Percentage-Based Scaling
Use relative scaling instead of absolute pixels:
- isReSizeByPercent (
boolean): Enables percentage-based resizing. - reSizePercent (
number0-100): Scale factor applied uniformly to both width and height.
These options appear at lines 46-55 in compress.ts.
picgo set buildIn.compress.isReSizeByPercent true
picgo set buildIn.compress.reSizePercent 50
Flip and Rotate Operations
Perform geometric transformations using boolean toggles and degree inputs:
- isFlip (
boolean): Flips the image horizontally (line 56). - isFlop (
boolean): Flips the image vertically (line 57). - isRotate (
boolean): Enables custom rotation (line 58). - rotateDegree (
number): Rotation angle in degrees, defaulting to 90 (line 59).
picgo set buildIn.compress.isRotate true
picgo set buildIn.compress.rotateDegree 45
Metadata and Privacy Controls
Remove identifying information embedded in image files to reduce size and protect privacy.
EXIF Stripping
The isRemoveExif boolean (defined at line 60 in compress.ts) strips all EXIF metadata—including camera models, GPS coordinates, and timestamps—from the image buffer before upload.
picgo set buildIn.compress.isRemoveExif true
Configuration Interface and Type Definitions
All compression options are strictly typed in the IBuildInCompressOptions interface located in src/types/index.ts (lines 14-44). This interface also includes "Map" variants (e.g., qualityMap) that support per-uploader overrides, though the CLI primarily exposes the base fields listed above.
How Compression Is Applied Internally
The compression workflow follows a conditional execution pattern across two core files:
- Decision Logic: The
isNeedCompressfunction insrc/utils/common.ts(lines 896-904) evaluates whether any compression options are active. - Processing Pipeline: When compression is required,
imageCompressis invoked within theLifecycle.tsworkflow (lines 347-415) to handle format conversion, resizing, flipping, rotating, and EXIF removal sequentially.
Complete Configuration Example
Configure multiple compression parameters simultaneously using the interactive command or direct assignment:
# Interactive configuration wizard
picgo config compress
# Direct CLI assignment for automation
picgo set buildIn.compress.quality 85
picgo set buildIn.compress.isConvert true
picgo set buildIn.compress.convertFormat webp
picgo set buildIn.compress.isReSize true
picgo set buildIn.compress.reSizeWidth 1920
picgo set buildIn.compress.reSizeHeight 1080
picgo set buildIn.compress.isRemoveExif true
picgo set buildIn.compress.skipReSizeOfSmallImg true
Summary
- PicList-Core exposes compression settings through the
buildIn.compressconfiguration namespace. - Quality control: Use
quality(0-100) for lossy formats like JPEG and WebP. - Format conversion: Combine
isConvertwithconvertFormatto transcode to AVIF, WebP, PNG, or 17 other supported formats. - Resizing options: Choose between absolute pixels (
isReSize,reSizeWidth,reSizeHeight) or percentage scaling (isReSizeByPercent,reSizePercent). - Geometry transforms: Apply horizontal flip (
isFlip), vertical flip (isFlop), or custom rotation (isRotate,rotateDegree). - Privacy protection: Enable
isRemoveExifto strip metadata before upload. - Source locations: Options defined in
src/plugins/beforetransformer/compress.ts, types insrc/types/index.ts, and execution logic insrc/core/Lifecycle.tsandsrc/utils/common.ts.
Frequently Asked Questions
How do I access the interactive compression configuration menu?
Run picgo config compress in your terminal. This launches an interactive wizard based on the configuration fields defined in src/plugins/beforetransformer/compress.ts, allowing you to toggle options like isConvert and isReSize without memorizing exact parameter names.
What image formats can I convert to using the PicList-Core CLI?
The convertFormat parameter supports 20+ output formats including avif, webp, png, jpeg, jxl, heif, tiff, gif, raw, pdf, and svg. The complete list is enumerated at lines 9-33 in src/plugins/beforetransformer/compress.ts.
Does resizing occur before or after format conversion?
According to the Lifecycle.ts implementation (lines 347-415), format conversion, resizing, and geometric transformations are processed sequentially within the imageCompress workflow. The exact order depends on which options are enabled, but all transformations occur before the final upload step.
Can I set different compression qualities for different upload destinations?
Yes. While the CLI exposes base fields like quality, the IBuildInCompressOptions interface in src/types/index.ts includes "Map" variants (e.g., qualityMap) that allow per-uploader overrides. You can configure distinct compression profiles for different target destinations by setting these map-based properties directly in your configuration file.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →