### Start Local Development Server Source: https://github.com/imgproxy/imgproxy-docs/blob/master/README.md Starts a local development server for the imgproxy documentation. Changes are reflected live without server restarts. ```bash pnpm run start ``` -------------------------------- ### Install Dependencies and Build imgproxy on macOS Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/installation.mdx Install libvips and Go using Homebrew, then build imgproxy from source on macOS. This command installs the binary to /usr/local/bin/imgproxy. ```bash brew install vips go PKG_CONFIG_PATH="$(brew --prefix libffi)/lib/pkgconfig" \ CGO_LDFLAGS_ALLOW="-s|-w" \ CGO_CFLAGS_ALLOW="-Xpreprocessor" \ go build -o /usr/local/bin/imgproxy ./cli ``` -------------------------------- ### Install libvips and Go on Ubuntu Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/installation.mdx Installs the libvips development headers and the Go compiler on Ubuntu systems using apt. This is a prerequisite for building imgproxy from source on Ubuntu. ```bash sudo apt-get update sudo apt-get install libvips-dev ``` -------------------------------- ### Install and Run imgproxy with Docker Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/getting_started.mdx Pull the latest imgproxy Docker image and run it, exposing port 8080. Ensure Docker is installed. ```bash docker pull ghcr.io/imgproxy/imgproxy:latest docker run -p 8080:8080 -it ghcr.io/imgproxy/imgproxy:latest ``` -------------------------------- ### Install DEB Package Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/installation.mdx Installs the imgproxy DEB package on Debian/Ubuntu systems. Use `sudo apt-get install -f` to fix any missing dependencies after the initial installation attempt. ```bash sudo dpkg -i imgproxy-3.25.0.arm64.deb ``` ```bash sudo apt-get install -f ``` -------------------------------- ### Build imgproxy from Source on Ubuntu Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/installation.mdx Builds and installs the imgproxy binary from source on Ubuntu. Ensure Go and libvips are installed first. `CGO_LDFLAGS_ALLOW` is used to allow linker flags for optimization. ```bash CGO_LDFLAGS_ALLOW="-s|-w" \ go build -o /usr/local/bin/imgproxy ``` -------------------------------- ### Install Dependencies and Build imgproxy on macOS Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/installation.mdx Installs vips and Go using Homebrew, then builds imgproxy from source on macOS. `PKG_CONFIG_PATH` and `CGO_CFLAGS_ALLOW` are set to ensure correct compilation with Homebrew-installed libraries. ```bash brew install vips go PKG_CONFIG_PATH="$(brew --prefix libffi)/lib/pkgconfig" \ CGO_LDFLAGS_ALLOW="-s|-w" \ CGO_CFLAGS_ALLOW="-Xpreprocessor" \ go build -o /usr/local/bin/imgproxy ``` -------------------------------- ### Build imgproxy from Source on Ubuntu Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/installation.mdx Compile and install imgproxy from source on Ubuntu after installing dependencies. This command places the binary in /usr/local/bin/imgproxy. ```bash CGO_LDFLAGS_ALLOW="-s|-w" go build -o /usr/local/bin/imgproxy ./cli ``` -------------------------------- ### Start a New Pipeline in URL Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/features/chained_pipelines.mdx Insert a section with a minus sign (-) to the URL path to start a new processing pipeline. ```imgproxy_url .../width:500/crop:1000/-/trim:10/... ``` -------------------------------- ### Install imgproxy via Homebrew Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/installation.mdx Installs imgproxy using the Homebrew package manager on macOS. ```bash brew install imgproxy ``` -------------------------------- ### Install libvips Development Package on Ubuntu Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/installation.mdx Install the libvips development libraries using the apt package manager on Ubuntu. This is a required dependency for imgproxy. ```bash sudo apt-get update sudo apt-get install libvips-dev ``` -------------------------------- ### Install RPM Package Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/installation.mdx Installs the imgproxy RPM package on Fedora/CentOS/RHEL systems. Manual installation of missing dependencies may be required if the initial command fails. ```bash sudo rpm -i imgproxy-3.25.0.arm64.rpm ``` -------------------------------- ### Install DEB Package Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/installation.mdx Install a DEB package on Debian/Ubuntu systems. If dependencies are missing, use 'sudo apt-get install -f' to resolve them. ```bash sudo dpkg -i imgproxy-4.0.0.arm64.deb ``` ```bash sudo apt-get install -f ``` -------------------------------- ### Run imgproxy with Key and Salt Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/signing_url.mdx Start imgproxy with your hex-encoded key and salt defined as environment variables. This enables URL signature checking. ```bash IMGPROXY_KEY=736563726574 IMGPROXY_SALT=68656C6C6F imgproxy ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/imgproxy/imgproxy-docs/blob/master/README.md Installs project dependencies using the pnpm package manager. Ensure pnpm is installed globally. ```bash pnpm i ``` -------------------------------- ### Chained Pipelines with Presets Example Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/features/chained_pipelines.mdx Demonstrates how chained pipelines and presets interact. A preset is applied to its pipeline, and can contain its own chained pipeline, merging with URL-defined chains. ```imgproxy_presets test=width:300/height:300/-/width:200/height:200/-/width:100/height:200 ``` -------------------------------- ### Get Sample Format Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/getting_info.mdx Use the `sample_format` or `sf` option to retrieve the image's sample format. This option requires the image to be fully downloaded. Default is false. ```imgproxy_url_option sample_format:%sample_format ``` ```imgproxy_url_option sf:%sample_format ``` -------------------------------- ### Run imgproxy with Key and Salt Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/signing_url.mdx Start imgproxy with specific environment variables for the key and salt to enable URL signature checking. Note that all previously unsigned URLs will stop working. ```bash IMGPROXY_KEY=736563726574 IMGPROXY_SALT=68656C6C6F imgproxy ``` -------------------------------- ### Hashsums Response Example Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/getting_info.mdx Example of the JSON response when requesting hashsums. ```json { "hashsums": { "md5": "cc507f81206a4c7d0a995a07c3d9f43a", "sha256": "621f6c6d68de754c6cdf3d286b7837634ce9f273f30f377b3e0df0568a23cee0" } } ``` -------------------------------- ### Get Image Sample Format Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/getting_info.mdx Use the `sample_format` or `sf` option to retrieve the image's sample format (e.g., `uchar`, `ushort`, `float`). ```imgproxy_url_option sample_format:%sample_format ``` ```imgproxy_url_option sf:%sample_format ``` -------------------------------- ### Example Signed URL Construction Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/signing_url.mdx Demonstrates the process of creating a signed URL for imgproxy. This involves prepending the salt, calculating an HMAC-SHA256 digest, and Base64 encoding the result. ```text http://imgproxy.example.com/insecure/rs:fill:300:400:0/g:sm/aHR0cDovL2V4YW1w/bGUuY29tL2ltYWdl/cy9jdXJpb3NpdHku/anBn.png ``` ```text hello/rs:fill:300:400:0/g:sm/aHR0cDovL2V4YW1w/bGUuY29tL2ltYWdl/cy9jdXJpb3NpdHku/anBn.png ``` ```text oKfUtW34Dvo2BGQehJFR4Nr0_rIjOtdtzJ3QFsUcXH8 ``` ```text http://imgproxy.example.com/oKfUtW34Dvo2BGQehJFR4Nr0_rIjOtdtzJ3QFsUcXH8/rs:fill:300:400:0/g:sm/aHR0cDovL2V4YW1w/bGUuY29tL2ltYWdl/cy9jdXJpb3NpdHku/anBn.png ``` -------------------------------- ### imgproxy URL Template Examples Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/processing.mdx These templates show the basic structure for constructing imgproxy URLs, including placeholders for signature, processing options, source URL, and extension. ```text http://imgproxy.example.com/%signature/%processing_options/plain/%source_url@%extension ``` ```text http://imgproxy.example.com/%signature/%processing_options/%encoded_source_url.%extension ``` ```text http://imgproxy.example.com/%signature/%processing_options/enc/%encrypted_source_url.%extension ``` -------------------------------- ### URL Replacement Examples Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/configuration/options.mdx Illustrates how to use IMGPROXY_URL_REPLACEMENTS to modify source image URL prefixes. Supports wildcard matching and numbered replacements. ```bash mys3://=s3://my_bucket/images/ ``` ```bash mys3://*/=s3://my_bucket/${1}/images ``` -------------------------------- ### Get Video Metadata and Streams Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/getting_info.mdx Use the `video_meta` or `vm` option to get video metadata and stream information. Default is true. ```imgproxy_url_option video_meta:%video_meta ``` ```imgproxy_url_option vm:%video_meta ``` -------------------------------- ### Response Example: Image Size Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/getting_info.mdx This JSON structure shows the expected response when requesting only the image size. ```json { "size": 123456 } ``` -------------------------------- ### Get Video Metadata and Streams Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/getting_info.mdx Use the `video_meta` or `vm` option to get video metadata and stream information. This includes details like creation time, location, codec, duration, and more. ```imgproxy_url_option video_meta:%video_meta ``` ```imgproxy_url_option vm:%video_meta ``` -------------------------------- ### Enable jemalloc with LD_PRELOAD Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/memory_usage_tweaks.mdx Use jemalloc for memory management by preloading its library using the LD_PRELOAD environment variable. This is a bash command to be run before starting imgproxy. Ensure the library path is correct for your system. ```bash sudo apt-get install libjemalloc2 LD_PRELOAD='/usr/lib/x86_64-linux-gnu/libjemalloc.so.2' imgproxy ``` -------------------------------- ### nginx Basic Cache Key Setup Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/cache/external.mdx Sets a basic nginx cache key when the output depends solely on the URL and path options. ```nginx proxy_cache_key "$scheme$proxy_host$request_uri"; ``` -------------------------------- ### Environment File Syntax: Basic Key-Value Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/configuration/loading_environment_variables.mdx Defines basic key-value pair syntax for environment files. Blank lines and lines starting with '#' are ignored. Values can be unquoted or quoted. ```text VAR=VAL VAR="VAL" VAR='VAL' ``` -------------------------------- ### Class Names File Format Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/features/object_detection.mdx Example of a class names file format for object detection. Each line represents a class name. Weights can be assigned using the '=%weight' suffix. ```text person dog cat ``` ```text person=2 dog cat=3 ``` -------------------------------- ### Custom Argument Separator for imgproxy Options Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/processing.mdx This example demonstrates how to use a custom separator for arguments within imgproxy processing options, as defined by the IMGPROXY_ARGUMENTS_SEPARATOR configuration. ```imgproxy_url_option %option_name,%argument1,%argument2,...,%argumentN ``` -------------------------------- ### Detect Objects in Image Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/getting_info.mdx Use the `detect_objects` or `do` option to get information about detected objects. This option requires the image to be fully downloaded and processed. Default is false. ```imgproxy_url_option detect_objects:%detect_objects ``` ```imgproxy_url_option do:%detect_objects ``` -------------------------------- ### Resize and Convert Image to PNG with Shortcuts Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/processing.mdx This example demonstrates the same image processing as the previous one but utilizes imgproxy's URL shortcuts for brevity. The 'preset', 'resize', and 'gravity' parameters are represented by their shorthand versions. ```imgproxy_url http://imgproxy.example.com/AfrOrF3gWeDA6VOlDG4TzxMv39O7MXnF4CXpKUwGqRM/pr:sharp/rs:fill:300:400:0/g:sm/plain/http://example.com/images/curiosity.jpg@png ``` -------------------------------- ### Export YOLO-NAS Model to ONNX Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/features/object_detection.mdx Export a YOLO-NAS model to ONNX format using the SuperGradients library. This example disables preprocessing and postprocessing within the model export to allow imgproxy to handle these steps. Ensure 'super-gradients' is installed. ```python from super_gradients.training import models from super_gradients.common.object_names import Models from super_gradients.conversion import DetectionOutputFormatMode from super_gradients.conversion.conversion_enums import ExportQuantizationMode # Load the model from the SuperGradients model zoo model = models.get( Models.YOLO_NAS_S, pretrained_weights="coco" ) # Or load the model from a checkpoint model = models.get( Models.YOLO_NAS_S, num_classes=80, checkpoint_path=f"neural-yolo_nas_s.pth" ) model.eval() model.prep_model_for_conversion(input_size=[1, 3, 640, 640]) # Disable preprocessing and postprocessing since imgproxy will handle it model.export( "/content/yolo_nas_s.onnx", preprocessing=False, postprocessing=False, output_predictions_format=DetectionOutputFormatMode.FLAT_FORMAT, input_image_shape=[640, 640], quantization_mode=ExportQuantizationMode.FP16, ) ``` -------------------------------- ### Resize Local Image with Imgproxy URL Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/image_sources/local_files.mdx An example of a complete imgproxy URL that resizes a local image. The URL includes processing options and the `local://` source path. ```imgproxy_url http://imgproxy.example.com/insecure/rs:fit:300:200/plain/local:///logos/imgproxy.png@jpg ``` -------------------------------- ### Construct Local File Source URL Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/image_sources/local_files.mdx Reference local files using the `local://` URI scheme, followed by the path relative to the `IMGPROXY_LOCAL_FILESYSTEM_ROOT` directory. For example, `local:///logos/imgproxy.png`. ```plaintext local:///logos/imgproxy.png ``` -------------------------------- ### Install RPM Package Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/installation.mdx Install an RPM package on RHEL/Fedora/CentOS systems. Manual installation of missing dependencies may be required. ```bash sudo rpm -i imgproxy-4.0.0.arm64.rpm ``` -------------------------------- ### Define Presets in a File Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/configuration/options.mdx Define processing presets in a file for use with imgproxy. Each line represents a preset, and lines starting with '#' are comments. This file can be referenced via environment variables or command-line arguments. ```imgproxy_presets default=resizing_type:fill/enlarge:1 # Sharpen the image to make it look better sharp=sharpen:0.7 # Blur the image to hide details blurry=blur:2 ``` -------------------------------- ### Resize and Convert Image to PNG Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/processing.mdx This example shows a signed imgproxy URL that applies the 'sharp' preset, resizes an image to fill a 300x400 area with smart gravity, and converts the output to PNG format. The source URL is provided in plain text. ```imgproxy_url http://imgproxy.example.com/AfrOrF3gWeDA6VOlDG4TzxMv39O7MXnF4CXpKUwGqRM/preset:sharp/resize:fill:300:400:0/gravity:sm/plain/http://example.com/images/curiosity.jpg@png ``` -------------------------------- ### ThumbHash Response Example Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/getting_info.mdx Example of the JSON response when requesting a ThumbHash. ```json { "thumb_hash": "0BE7810C80365AF29266578A660CB7A6707A80867738A87804" } ``` -------------------------------- ### Perceptual Hash Response Example Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/getting_info.mdx Example of the JSON response when requesting a perceptual hash. ```json { "perceptual_hash": "9797306d694b4e94" } ``` -------------------------------- ### Build and Run Custom Docker Image Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/installation.mdx Build your own imgproxy Docker image from the source and run it. ```bash docker build -f docker/Dockerfile -t imgproxy . docker run -p 8080:8080 -it imgproxy ``` -------------------------------- ### Build Static Website Source: https://github.com/imgproxy/imgproxy-docs/blob/master/README.md Generates static content for the imgproxy documentation website into the 'build' directory. This output can be hosted by any static content service. ```bash pnpm run build ``` -------------------------------- ### Construct imgproxy URL for Local File Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/image_sources/local_files.mdx Use the `local:///` scheme followed by the path relative to the `IMGPROXY_LOCAL_FILESYSTEM_ROOT` directory to specify a local image as the source. This example shows how to resize an image to fit 300x200 pixels. ```imgproxy_url http://imgproxy.example.com/insecure/rs:fit:300:200/plain/local:///logos/imgproxy.png@jpg ``` -------------------------------- ### Get Crop Coordinates Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/getting_info.mdx Use this option to get relative crop coordinates for defined crop parameters. The image must be fully downloaded and processed. ```imgproxy_url_option crop:%width:%height:%gravity c:%width:%height:%gravity ``` -------------------------------- ### Example of Encrypted imgproxy URL Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/encrypting_source_url.mdx This is an example of a final imgproxy URL with an encrypted source URL. The encrypted path is prefixed with '/enc/'. Note that signing is recommended for security. ```imgproxy_url http://imgproxy.example.com/unsafe/rs:fit:300:300/enc/p5VjorNdhs7mRRw8gA9TWoRlGci3l1kuzqN43UQlRaRIQ0qtBKW3qFABIsx-ZRz_cVc8iVTYbhsNsxNBL1BHaQ ``` -------------------------------- ### Deploy imgproxy to Heroku Manually Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/installation.mdx Clone the imgproxy repository, create a Heroku application, set the container stack, and push to Heroku for manual deployment. ```bash git clone https://github.com/imgproxy/imgproxy.git && cd imgproxy heroku create your-application heroku stack:set container git push heroku master ``` -------------------------------- ### Signed imgproxy URL with preset and resize Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/processing.mdx Construct a signed imgproxy URL to apply a preset, resize an image to a specific area, use smart gravity, and convert the format. This example uses the full path for operations. ```imgproxy_url http://imgproxy.example.com/AfrOrF3gWeDA6VOlDG4TzxMv39O7MXnF4CXpKUwGqRM/preset:sharp/resize:fill:300:400:0/gravity:sm/plain/http://example.com/images/curiosity.jpg@png ``` -------------------------------- ### Response Example: Image Dimensions Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/getting_info.mdx This JSON structure shows the expected response when requesting image dimensions and orientation. ```json { "width": 7360, "height": 4912, "orientation": 1 } ``` -------------------------------- ### Get Image Bands Count Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/getting_info.mdx Use the `bands` or `b` option to retrieve the number of bands an image contains. ```imgproxy_url_option bands:%bands ``` ```imgproxy_url_option b:%bands ``` -------------------------------- ### Get XMP Metadata Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/getting_info.mdx Use the `xmp` option to retrieve the image's XMP metadata. Default is true. ```imgproxy_url_option xmp:%xmp ``` -------------------------------- ### Autoquality with ML (Configuration) Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/features/autoquality.mdx Configure imgproxy to use machine learning models for predicting image quality based on a target DSSIM value. This method supports setting quality ranges and format-specific limits, and requires paths to ONNX neural network models. ```bash IMGPROXY_AUTOQUALITY_METHOD="ml" # Change value to the desired DSSIM IMGPROXY_AUTOQUALITY_TARGET=0.02 # We're happy enough if the resulting DSSIM will differ from the desired by 0.001 IMGPROXY_AUTOQUALITY_ALLOWED_ERROR=0.001 IMGPROXY_AUTOQUALITY_MIN=70 IMGPROXY_AUTOQUALITY_MAX=80 # Quality 63 for AVIF is pretty the same as 80 for JPEG IMGPROXY_AUTOQUALITY_FORMAT_MIN="avif=60" IMGPROXY_AUTOQUALITY_FORMAT_MAX="avif=65" # Neural network models paths for JPEG, WebP, AVIF, and JPEG XL IMGPROXY_AUTOQUALITY_JPEG_NET="/networks/autoquality-jpeg.onnx" IMGPROXY_AUTOQUALITY_WEBP_NET="/networks/autoquality-webp.onnx" IMGPROXY_AUTOQUALITY_AVIF_NET="/networks/autoquality-avif.onnx" IMGPROXY_AUTOQUALITY_JXL_NET="/networks/autoquality-jxl.onnx" ``` -------------------------------- ### Base64 URL with Filename Example Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/configuration/options.mdx Demonstrates how IMGPROXY_BASE64_URL_INCLUDES_FILENAME allows appending an SEO-friendly filename to Base64-encoded or encrypted source URLs. ```url https://my-imgproxy.dev/.../aHR0cDovL2V4YW1wbGUuY29tL3B1cHB5LmpwZw/puppy.jpg ``` -------------------------------- ### Response Example: IPTC and Photoshop Metadata Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/getting_info.mdx This JSON structure shows the expected response when requesting IPTC and Photoshop metadata. ```json { "iptc": { "Name": "Spider-Man", "Caption": "Spider-Man swings on the web", "Copyright Notice": "Daily Bugle", "Keywords": ["spider-man", "menance", "offender"] }, "photoshop": { "resolution": { "XResolution": 240, "XResolutionUnit": "inches", "WidthUnit": "inches", "YResolution": 240, "YResolutionUnit": "inches", "HeightUnit": "inches" } } } ``` -------------------------------- ### Run imgproxy with Encryption Key Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/encrypting_source_url.mdx Starts the imgproxy server with a specified hex-encoded encryption key for source URL encryption. Ensure the key is 16, 24, or 32 bytes long for AES-128, AES-192, or AES-256 respectively. ```bash IMGPROXY_SOURCE_URL_ENCRYPTION_KEY="1eb5b0e971ad7f45324c1bb15c947cb207c43152fa5c6c7f35c4f36e0c18e0f1" imgproxy ``` -------------------------------- ### Autoquality with ML Configuration Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/features/autoquality.mdx Configure imgproxy to use machine learning models for predicting optimal image quality based on DSSIM targets. This requires specifying neural network paths for different image formats. If a network is unavailable, it falls back to the DSSIM method. ```bash IMGPROXY_AUTOQUALITY_METHOD="ml" # Change value to the desired DSSIM IMGPROXY_AUTOQUALITY_TARGET=0.02 # We're happy enough if the resulting DSSIM will differ from the desired by 0.001 IMGPROXY_AUTOQUALITY_ALLOWED_ERROR=0.001 IMGPROXY_AUTOQUALITY_MIN=70 IMGPROXY_AUTOQUALITY_MAX=80 # Quality 63 for AVIF is pretty the same as 80 for JPEG IMGPROXY_AUTOQUALITY_FORMAT_MIN="avif=60" IMGPROXY_AUTOQUALITY_FORMAT_MAX="avif=65" # Neural networks paths for JPEG, WebP, AVIF, and JPEG XL IMGPROXY_AUTOQUALITY_JPEG_NET="/networks/autoquality-jpeg.pb" IMGPROXY_AUTOQUALITY_WEBP_NET="/networks/autoquality-webp.pb" IMGPROXY_AUTOQUALITY_AVIF_NET="/networks/autoquality-avif.pb" IMGPROXY_AUTOQUALITY_JXL_NET="/networks/autoquality-jxl.pb" ``` -------------------------------- ### Response Example: EXIF Metadata Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/getting_info.mdx This JSON structure shows the expected response when requesting EXIF metadata with canonical names. ```json { "exif": { "Aperture": "8.00 EV (f/16.0)", "Contrast": "Normal", "Date and Time": "2016:09:11 22:15:03", "Model": "NIKON D810", "Software": "Adobe Photoshop Lightroom 6.1 (Windows)" } } ``` -------------------------------- ### Fast Trim with Chained Pipelines Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/features/chained_pipelines.mdx Optimize trimming performance by placing it in a separate pipeline after resizing. This is faster as the image is already in memory and resized. ```imgproxy_url .../rs:fit:500:500/-/trim:10/... ``` -------------------------------- ### Response Example: Image Format Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/getting_info.mdx This JSON structure shows the expected response when requesting the image format and MIME type. ```json { "format": "jpeg", "mime_type": "image/jpeg" } ``` -------------------------------- ### Get Image Colorspace Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/getting_info.mdx Use the `colorspace` or `cs` option to retrieve the image's colorspace (e.g., `srgb`, `cmyk`). ```imgproxy_url_option colorspace:%colorspace ``` ```imgproxy_url_option cs:%colorspace ``` -------------------------------- ### Add Helm Repository and Deploy Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/installation.mdx Add the official imgproxy Helm repository and deploy imgproxy to your Kubernetes cluster using Helm. ```bash helm repo add imgproxy https://helm.imgproxy.net/ # With Helm 3 helm upgrade -i imgproxy imgproxy/imgproxy # With Helm 2 helm upgrade -i --name imgproxy imgproxy/imgproxy ``` -------------------------------- ### Load Presets from Command Line Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/configuration/options.mdx Load processing and info presets from specified files using command-line arguments. Note: These arguments are deprecated in favor of environment variables. ```bash imgproxy -presets /path/to/file/with/presets -info-presets /path/to/file/with/info-presets ``` -------------------------------- ### Basic Gravity Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/processing.mdx The `gravity` option guides imgproxy on which parts of the image to keep when cropping. It accepts a `type` and optional `x_offset` and `y_offset`. ```imgproxy_url_option gravity:%type:%x_offset:%y_offset g:%type:%x_offset:%y_offset ``` -------------------------------- ### Define Info Presets in a File Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/configuration/options.mdx Define info presets in a file for use with imgproxy's info endpoint. Each line represents an info preset, and lines starting with '#' are comments. This file can be referenced via environment variables or command-line arguments. ```imgproxy_presets default=xmp:0/blurhash:4:3 # Detect objects on the image with_objects=detect_objects:1 ``` -------------------------------- ### Export YOLOv4 to ONNX Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/features/object_detection.mdx Export a YOLOv4 model to ONNX format. This requires installing `onnxruntime` and running the `demo_pytorch2onnx.py` script with appropriate parameters. ```bash pip install onnxruntime python demo_pytorch2onnx.py # Example python demo_pytorch2onnx.py yolov4.pth dog.jpg 1 80 416 416 ``` -------------------------------- ### Adjust Brightness, Contrast, and Saturation Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/processing.mdx The 'adjust' or 'a' meta-option allows simultaneous adjustment of brightness, contrast, and saturation. Arguments are optional and will use default values if omitted. ```imgproxy_url_option adjust:%brightness:%contrast:%saturation a:%brightness:%contrast:%saturation ``` -------------------------------- ### Resize and Convert Image to PNG with Base64 Encoded URL Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/processing.mdx This example shows how to process an image and convert it to PNG format using a Base64-encoded source URL. This is useful for handling URLs that contain special characters or are very long. ```imgproxy_url http://imgproxy.example.com/AfrOrF3gWeDA6VOlDG4TzxMv39O7MXnF4CXpKUwGqRM/pr:sharp/rs:fill:300:400:0/g:sm/aHR0cDovL2V4YW1w/bGUuY29tL2ltYWdl/cy9jdXJpb3NpdHku/anBn.png ``` -------------------------------- ### Build Linux Package using Docker Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/installation.mdx Use this command to build a DEB, RPM, or TAR package of imgproxy from a Docker image. Adjust the image tag for your CPU architecture if necessary. ```bash docker run -u0 --rm -it -v $(pwd):/dist ghcr.io/imgproxy/imgproxy:latest-amd64 imgproxy-build-package deb /dist ``` -------------------------------- ### Set Gravity for Cropping Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/processing.mdx Guides imgproxy on which parts of the image to cut when resizing. Supports various types and optional X/Y offsets (absolute or relative). ```imgproxy_url_option gravity:%type:%x_offset:%y_offset g:%type:%x_offset:%y_offset ``` -------------------------------- ### Enable Local Filesystem Cache Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/cache/internal/local_filesystem.mdx Use this command to enable the local filesystem cache and specify the root directory for cached images. Ensure the directory exists and imgproxy has write permissions. ```bash IMGPROXY_CACHE_USE=fs IMGPROXY_CACHE_FS_ROOT=/var/cache/imgproxy imgproxy ``` -------------------------------- ### Export YOLOv8 to ONNX (FP32) Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/features/object_detection.mdx Export a YOLOv8 model to ONNX format with FP32 precision using the 'yolo export' command. Ensure 'ultralytics' is installed. ```bash pip install ultralytics # Export with FP32 precision yolo export \ model=yolov8n.pt \ format=onnx \ simplify=True ``` -------------------------------- ### Define an Imgproxy Preset Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/presets.mdx Define a preset named 'awesome' that sets resizing type to 'fill' and format to 'jpg'. Presets are defined using a '%preset_name=%options' syntax. ```imgproxy_presets awesome=resizing_type:fill/format:jpg ``` -------------------------------- ### Set Image Size Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/processing.mdx Use the 'size' meta-option to define width, height, enlarge, and extend parameters. All arguments are optional. ```imgproxy_url_option size:%width:%height:%enlarge:%extend s:%width:%height:%enlarge:%extend ``` -------------------------------- ### Imgproxy Presets-Only Mode URL Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-3.31.x/usage/presets.mdx When `IMGPROXY_ONLY_PRESETS` is true, imgproxy accepts a list of presets directly in the URL. This example shows a URL with multiple presets applied. ```imgproxy_url_only_presets http://imgproxy.example.com/unsafe/thumbnail:blurry:watermarked/plain/http://example.com/images/curiosity.jpg@png ``` -------------------------------- ### Detect Objects in Image Source: https://github.com/imgproxy/imgproxy-docs/blob/master/versioned_docs/version-4.0.x/usage/getting_info.mdx Use the `detect_objects` or `do` option to get information about objects found in the image. This returns relative coordinates and confidence scores for detected objects. ```imgproxy_url_option detect_objects:%detect_objects ``` ```imgproxy_url_option do:%detect_objects ```