### Imageflow API URL for Image Resizing and Manipulation Source: https://docs.imageflow.io/querystring/introduction This example demonstrates how to use the Imageflow API via a URL to resize and manipulate an image. The query parameters control the width, height, scaling mode, and other transformations. ```http http://localhost:39876/demo_images/tulip-leaf.jpg?w=300&h=300&mode=max ``` -------------------------------- ### Imageflow Constrain Configuration Example Source: https://docs.imageflow.io/json/constrain This JSON object demonstrates how to configure the 'constrain' operation in Imageflow. It specifies the target dimensions (width and height), resampling hints, gravity for cropping/padding, and the canvas color for padding. The 'mode' is set to 'within', ensuring the image fits without upscaling. ```json { "constrain": { "mode": "within", "w": 800, "h": 600, "hints": { "sharpen_percent": 7 }, "gravity": { "percentage": { "x": 50, "y": 50}}, "canvas_color": "transparent" } } ``` -------------------------------- ### Execute Command String for Image Processing Source: https://docs.imageflow.io/print Executes a querystring command directly within a JSON file, often used by bindings like libimageflow. It can specify decode and encode IO IDs to optimize processing. This example sets width, height, and mode. ```json { "command_string": { "kind": "ir4", "value": "width=100&height=100&mode=max", "decode": 0, "encode": 1 } } ``` -------------------------------- ### Imageflow JSON Job Configuration Example Source: https://docs.imageflow.io/json/introduction This JSON configuration defines an Imageflow job. It specifies input and output streams, security settings for image decoding and encoding, and a sequence of framewise operations. The operations include decoding an image from input 'io_id': 0, constraining its width to a maximum of 1400 pixels while maintaining aspect ratio, and then encoding it to output 'io_id': 1 as an 8-bit PNG with a quality preset. ```json { "io": [ { "io_id": 0, "direction": "in", "io": "placeholder" }, { "io_id": 1, "direction": "out", "io": "placeholder" } ], "security": { "max_decode_size": { "w": 10000, "h": 10000, "megapixels": 100 }, "max_frame_size": null, "max_encode_size": null }, "framewise": { "steps": [ { "decode": { "io_id": 0 } }, { "constrain": { "mode": "within", "w": 1400 } }, { "encode": { "io_id": 1, "preset": { "pngquant": { "quality": 80 } } } } ] } } ``` -------------------------------- ### Imageflow Resampling Hints Configuration (JSON) Source: https://docs.imageflow.io/json/resampling_hints This JSON object demonstrates the configuration of resampling hints in Imageflow. It specifies parameters such as sharpening percentage, downsampling and upsampling filters, scaling colorspace, background color, and conditions for resampling and sharpening. ```json { "sharpen_percent": 15, "down_filter": "robidoux", "up_filter": "ginseng", "scaling_colorspace": "linear", "background_color": "transparent", "resample_when": "size_differs_or_sharpening_requested", "sharpen_when": "downscaling" } ``` -------------------------------- ### Resampling Hints Source: https://docs.imageflow.io/print This section describes how to control image resampling behavior, including sharpness, color space, background color, and when resampling should occur. ```APIDOC ## Resampling Hints ### Description Control image resampling behavior with various parameters. This includes sharpness, scaling color space, background color, and conditions for resampling and sharpening. ### Method POST ### Endpoint /websites/imageflow_io ### Parameters #### Request Body - **sharpen_percent** (number) - Optional - The amount of sharpening to apply during resampling (0-100). - **up_filter** (string) - Optional - The resampling filter to use for upscaling. Available filters include `ginseng`, `lanczos`, `cubic`, etc. - **down_filter** (string) - Optional - The resampling filter to use for downscaling. Available filters include `robidoux`, `lanczos`, `cubic`, etc. - **scaling_colorspace** (string) - Optional - The color space for scaling. Use `linear` for best results or `srgb` to mimic other software. - **background_color** (string or object) - Optional - The background color to apply. Can be a named color like `transparent` or a hex color object. - **resample_when** (string) - Optional - When resampling should occur. Options: `size_differs`, `size_differs_or_sharpening_requested`, `always`. - **sharpen_when** (string) - Optional - When sharpening should occur. Options: `downscaling`, `upscaling`, `size_differs`, `always`. ### Request Example ```json { "sharpen_percent": 15, "down_filter": "robidoux", "up_filter": "ginseng", "scaling_colorspace": "linear", "background_color": "transparent", "resample_when": "size_differs_or_sharpening_requested", "sharpen_when": "downscaling" } ``` ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating the operation was successful. #### Response Example ```json { "message": "Resampling hints applied successfully." } ``` ### Available Filters - **Downsampling:** `robidoux` (default), `robidoux_sharp`, `robidoux_fast`, `lanczos`, `lanczos_sharp`, `lanczos_2`, `lanczos_2_sharp`, `cubic`, `cubic_sharp`, `catmull_rom`, `mitchell`, `cubic_b_spline`, `hermite`, `jinc`, `triangle`, `linear`, `box`, `fastest`, `n_cubic`, `n_cubic_sharp`. - **Upsampling:** `ginseng` (default), `ginseng_sharp`, `lanczos`, `lanczos_sharp`, `lanczos_2`, `lanczos_2_sharp`, `cubic`, `cubic_sharp`, `catmull_rom`, `mitchell`, `cubic_b_spline`, `hermite`, `jinc`, `triangle`, `linear`, `box`, `fastest`, `n_cubic`, `n_cubic_sharp`. ### Available Background Colors - `transparent` - `black` - `{ "srgb": { "hex" : "ffffff" } }` (Example for white using sRGB hex) ``` -------------------------------- ### Image Resizing and Transformation Parameters Source: https://docs.imageflow.io/querystring/transforms This section details the parameters available for manipulating images, including resizing, aspect ratio control, scaling, cropping, rotation, and color. ```APIDOC ## Imageflow API Parameters ### Description This API provides a comprehensive set of parameters to control image manipulation, including resizing, aspect ratio handling, scaling behavior, cropping, rotation, flipping, and color adjustments. ### Method GET ### Endpoint `/websites/imageflow_io` (This is a conceptual endpoint representing the API's functionality) ### Parameters #### Query Parameters - **width** (integer) - Optional - Constrains the image width. `w` is an alias. - **height** (integer) - Optional - Constrains the image height. `h` is an alias. - **dpr** (float) - Optional - A multiplier for `width`/`height` for responsive image usage. - **mode** (string) - Optional - Determines how to handle aspect ratio differences. Accepted values: `stretch`, `pad`, `crop`, `max`. - `stretch`: Distorts the image to exact dimensions (if `scale=both`). If `scale=down`, scales only if dimensions are smaller than the image. - `pad`: Scales image to fit within dimensions, then pads edges with `bgcolor`. - `crop`: Scales image to fit above dimensions, then minimally crops to meet aspect ratio. - `max`: Scales image to fit within dimensions. - **scale** (string) - Optional - Controls whether images are upsampled or not. Accepted values: `down`, `both`, `canvas`, `up`. - `down`: Never upscale; return at original size. - `both`: Downscale or upscale to meet size requirements. - `canvas`: Add padding instead of upscaling. - `up`: Never downscale, only upscale. - **anchor** (string) - Optional - Determines image alignment for `mode=crop`, `mode=pad`, or `scale=canvas`. Default: `middlecenter`. Accepted values: `topleft`, `topcenter`, `topright`, `middleleft`, `middlecenter`, `middleright`, `bottomleft`, `bottomcenter`, `bottomright`. - **sflip** (string) - Optional - Flips the source image in `x`, `y`, or `xy` dimensions. - **flip** (string) - Optional - Flips the result image in `x`, `y`, or `xy` dimensions. - **srotate** (integer) - Optional - Rotates the source image by 90, 180, or 270 degrees. - **rotate** (integer) - Optional - Rotates the result image by 90, 180, or 270 degrees. - **crop** (string) - Optional - Crops the source image to the given coordinates (e.g., `x1,y1,x2,y2`). Negative coordinates are relative to the bottom-right corner. - **cropxunits** (integer) - Optional - Makes `crop` coordinates percentages of the image width. - **cropyunits** (integer) - Optional - Makes `crop` coordinates percentages of the image height. - **trim.threshold** (integer) - Optional - Specifies a threshold for trimming whitespace. - **trim.percentpadding** (float) - Optional - Specifies percentage of padding to restore after trimming. - **bgcolor** (string) - Optional - Background color for padding. Accepts RGB, RGBA, RRGGBBAA, RRGGBB, or named colors. - **ignoreicc** (boolean) - Optional - Ignores the source image's color profile, treating it as sRGB. - **ignore_icc_errors** (boolean) - Optional - Ignores color profile errors instead of failing the operation. ### Request Example ``` /websites/imageflow_io?width=300&height=200&mode=crop&anchor=topleft&rotate=90&bgcolor=rgba(0,0,0,0.5) ``` ### Response #### Success Response (200) - **image_data** (binary) - The processed image data. #### Response Example (Binary image data would be returned here, not representable as JSON) ``` -------------------------------- ### Grayscale Conversion Methods Source: https://docs.imageflow.io/print Demonstrates different methods for converting an image to grayscale. ```APIDOC ## Grayscale Conversion Methods ### Description Demonstrates different methods for converting an image to grayscale. ### Method GET ### Endpoint /websites/imageflow_io ### Parameters #### Query Parameters - **s.grayscale** (string) - Required - Specifies the grayscale conversion method. Options: `true`, `y`, `ry`, `ntsc`, `bt709`, `flat`. - `true`, `ntsc`, `y` produce identical results. ### Request Example ``` GET /websites/imageflow_io?s.grayscale=ntsc GET /websites/imageflow_io?s.grayscale=ry GET /websites/imageflow_io?s.grayscale=bt709 GET /websites/imageflow_io?s.grayscale=flat ``` ### Response #### Success Response (200) - **image_data** (binary) - The grayscale image data. #### Response Example (Binary image data) ``` -------------------------------- ### WebP Decoding with Size Hints Source: https://docs.imageflow.io/json/decode This snippet illustrates decoding WebP images using Imageflow with specified width and height. It provides hints to the WebP decoder for faster processing, without linear light scaling support. ```json { "decode": { "io_id": 0, "commands": [ { "webp_decoder_hints": { "width": 1600, "height": 1600 } } ] } } ``` -------------------------------- ### Configure LibPNG Encoding (JSON) Source: https://docs.imageflow.io/json/encode Configuration for LibPNG encoding. Options include `depth` (e.g., 'png_24'), `matte` (with color details like sRGB hex), and `zlib_compression` (level 7). ```json { "libpng": { "depth": "png_24", "matte": { "srgb": { "hex": "9922FF" } }, "zlib_compression": 7 } } ``` -------------------------------- ### Configure Watermark with Percentage Fit and Opacity Source: https://docs.imageflow.io/json/watermark This configuration applies a watermark using percentage-based fitting and specifies opacity. It uses `io_id` to select the watermark image, `gravity` for placement, `fit_mode` to control scaling, and `fit_box` with `image_percentage` to define the watermark's bounding box relative to the target image. Minimum canvas dimensions and sharpening hints are also included. ```json { "watermark": { "io_id": 1, "gravity": { "percentage" : { "x": 100, "y": 100 } }, "fit_mode": "within", "fit_box": { "image_percentage": { "x1": 10, "y1": 10, "x2": 90, "y2": 90 } }, "min_canvas_width": 50, "min_canvas_height": 50, "opacity": 0.8, "hints": { "sharpen_percent": 15 } } } ``` -------------------------------- ### Configure PNGQuant Encoding (JSON) Source: https://docs.imageflow.io/json/encode Configuration for PNGQuant encoding. Options include `quality` (target quality), `minimum_quality` (threshold for switching to lossless PNG), `speed` (1-10 for tradeoff), and `maximum_deflate` (boolean for file size optimization). ```json { "pngquant": { "quality": 90, "minimum_quality": 20, "speed": null, "maximum_deflate": null } } ``` -------------------------------- ### Specify WebPLossless Preset (String) Source: https://docs.imageflow.io/json/encode This snippet simply specifies the 'webplossless' preset for encoding. No additional configuration is provided. ```string "webplossless" ``` -------------------------------- ### Encode with IO ID and Preset (JSON) Source: https://docs.imageflow.io/json/encode This snippet shows the basic structure for initiating an encoding process. It requires the `io_id` of the file and the desired encoding `preset` (e.g., 'gif'). ```json { "encode": { "io_id": 1, "preset": "gif" } } ``` -------------------------------- ### Execute Querystring Command in JSON for Imageflow Source: https://docs.imageflow.io/json/command_string This JSON structure demonstrates how to define a querystring command for Imageflow. It specifies the command kind, the actual command string, and flags for decode and encode operations. This is useful for libimageflow bindings to execute image processing commands. ```json { "command_string": { "kind": "ir4", "value": "width=100&height=100&mode=max", "decode": 0, "encode": 1 } } ``` -------------------------------- ### Configure Whitespace Cropping in Imageflow Source: https://docs.imageflow.io/json/crop_whitespace This configuration object defines parameters for cropping whitespace from images using Imageflow. The `threshold` parameter controls noise tolerance, while `percent_padding` adjusts the restored padding percentage. These settings are crucial for optimizing image cropping results. ```json { "crop_whitespace": { "threshold": 80, "percent_padding" : 2 } } ``` -------------------------------- ### Execute Querystring Command Source: https://docs.imageflow.io/json/command_string This endpoint allows you to execute a querystring command within a JSON file. It's particularly useful for libimageflow bindings and supports optimized decoding and encoding when both `decode` and `encode` io_ids are specified. ```APIDOC ## POST /websites/imageflow_io ### Description Executes a querystring command within a JSON structure. This is commonly used by `libimageflow` bindings to execute querystring commands. When specifying a `decode` `io_id`, no `decode` node is needed. When specifying an `encode` `io_id`, no `encode` node is needed. When specifying both, no other nodes are needed in the job. This is the preferred method of use, as decode hints will be optimized and encoder commands will be honored. ### Method POST ### Endpoint /websites/imageflow_io ### Parameters #### Request Body - **command_string** (object) - Required - An object containing the command string and related parameters. - **kind** (string) - Required - The type of command string (e.g., "ir4"). - **value** (string) - Required - The querystring command (e.g., "width=100&height=100&mode=max"). - **decode** (integer) - Optional - The io_id for decoding. - **encode** (integer) - Optional - The io_id for encoding. ### Request Example ```json { "command_string": { "kind": "ir4", "value": "width=100&height=100&mode=max", "decode": 0, "encode": 1 } } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. - **message** (string) - A message providing details about the operation outcome. #### Response Example ```json { "status": "success", "message": "Command executed successfully." } ``` ``` -------------------------------- ### Image Manipulation Parameters Source: https://docs.imageflow.io/querystring/filters This section details the parameters used to manipulate images via the Imageflow API, covering sharpening, filtering, color space, and color adjustments. ```APIDOC ## Imageflow API Parameters ### Description This API allows for extensive image manipulation through a variety of parameters that control sharpening, filtering, color space, and color adjustments. ### Method GET (Implied, as parameters are typically appended to a URL) ### Endpoint `/websites/imageflow_io` (Base endpoint, parameters are query parameters) ### Parameters #### Query Parameters - **f.sharpen** (integer, 0-99) - Optional - Determines the amount of sharpening applied during scaling. - **f.sharpenwhen** (enum: `always`, `downscaling`, `sizediffers`) - Optional - Determines when sharpening is applied. - **down.filter** (enum) - Optional - Specifies the down-sampling filter. Possible values include: `robidoux`, `robidoux_sharp`, `robidoux_fast`, `ginseng`, `ginseng_sharp`, `lanczos`, `lanczos_sharp`, `lanczos_2`, `lanczos_2_sharp`, `cubic`, `cubic_sharp`, `catmull_rom`, `mitchell`, `cubic_b_spline`, `hermite`, `jinc`, `triangle`, `linear`, `box`, `fastest`, `n_cubic`, `n_cubic_sharp`. - **up.filter** (enum) - Optional - Specifies the up-sampling filter. Accepts the same values as `down.filter`. - **down.colorspace** (string, `srgb`) - Optional - If set to `srgb`, downscaling occurs in the sRGB color space instead of linear RGB, potentially affecting image highlights. - **up.colorspace** (string, `srgb`) - Optional - If set to `srgb`, up-scaling occurs in the sRGB color space instead of linear RGB. - **s.grayscale** (string: `true`, `y`, `ry`, `ntsc`, `bt709`, `flat`) - Optional - Transforms the image into grayscale using the specified method. - **s.sepia** (boolean, `true`) - Optional - Applies a sepia tone to the image. - **s.invert** (boolean, `true`) - Optional - Inverts the image colors in the sRGB space. - **s.alpha** (float, 0-1) - Optional - Adjusts the transparency of the image. - **s.contrast** (float, -1 to 1) - Optional - Adjusts the image contrast in the sRGB space. - **s.brightness** (float, -1 to 1) - Optional - Adjusts the image brightness in the sRGB space. - **s.saturation** (float, -1 to 1) - Optional - Adjusts the image saturation in the sRGB space. ### Request Example ``` /websites/imageflow_io?f.sharpen=50&down.filter=lanczos_sharp&s.brightness=0.2&s.saturation=-0.5 ``` ### Response #### Success Response (200) - **image** (binary) - The processed image data. #### Response Example (Binary image data would be returned here, not representable as JSON) ``` -------------------------------- ### Image Resizing and Manipulation Source: https://docs.imageflow.io/print This endpoint allows for resizing images using various constraints and modes. It also supports aspect ratio handling, scaling options, and image alignment. ```APIDOC ## Image Resizing and Manipulation ### Description This endpoint allows for resizing images using various constraints and modes. It also supports aspect ratio handling, scaling options, and image alignment. ### Method GET ### Endpoint /websites/imageflow_io ### Parameters #### Query Parameters - **width** (integer) - Optional - Constrains the image width. `w` is an alias. - **height** (integer) - Optional - Constrains the image height. `h` is an alias. - **dpr** (float) - Optional - A multiplier for width/height for responsive image usage. - **mode** (string) - Optional - Determines how to handle aspect ratio differences. Options: `stretch`, `pad`, `crop`, `max`. Default: `max`. - `stretch`: Distorts the image to exact dimensions. - `pad`: Scales to fit and pads edges with `bgcolor`. - `crop`: Scales to fit above dimensions and crops to meet aspect ratio. - `max`: Scales to fit within dimensions. - **scale** (string) - Optional - Controls whether images are upsampled. Options: `down`, `both`, `canvas`, `up`. Default: `down`. - `down`: Never upscale. - `both`: Downscale or upscale. - `canvas`: Pad instead of upscaling. - `up`: Only upscale. - **anchor** (string) - Optional - Determines image alignment for `mode=crop`, `mode=pad`, or `scale=canvas`. Default: `middlecenter`. - Values: `topleft`, `topcenter`, `topright`, `middleleft`, `middlecenter`, `middleright`, `bottomleft`, `bottomcenter`, `bottomright`. - **sflip** (string) - Optional - Flips the source image in `x`, `y`, or `xy` dimensions. - **flip** (string) - Optional - Flips the result image in `x`, `y`, or `xy` dimensions. - **srotate** (integer) - Optional - Rotates the source image by 90, 180, or 270 degrees. - **rotate** (integer) - Optional - Rotates the result image by 90, 180, or 270 degrees. - **crop** (string) - Optional - Crops the source image to the given coordinates (x1,y1,x2,y2). Negative values are relative to the bottom-right corner. - **cropxunits** (integer) - Optional - Makes `crop` coordinates percentages of the image width. - **cropyunits** (integer) - Optional - Makes `crop` coordinates percentages of the image height. - **trim.threshold** (integer) - Optional - Threshold for trimming whitespace. - **trim.percentpadding** (float) - Optional - Percentage of padding to restore after trimming. - **bgcolor** (string) - Optional - Background color for padding. Format: RGB, RGBA, RRGGBBAA, RRGGBB, or named color. - **ignoreicc** (boolean) - Optional - Ignores the source image's color profile, treating it as sRGB. - **ignore_icc_errors** (boolean) - Optional - Ignores color profile errors. ### Request Example ``` GET /websites/imageflow_io?width=300&height=200&mode=crop&anchor=topleft ``` ### Response #### Success Response (200) - **image_data** (binary) - The processed image data. #### Response Example (Binary image data) ``` -------------------------------- ### Configure LibJPEG Turbo Encoding (JSON) Source: https://docs.imageflow.io/json/encode Configuration for LibJPEG Turbo encoding. Options include `quality` (90), `progressive` (boolean), and `optimize_huffman_coding` (boolean). ```json { "libjpegturbo": { "quality": 90, "progressive": false, "optimize_huffman_coding": true } } ``` -------------------------------- ### JPEG Decoding with Spatial Downscaling Hints Source: https://docs.imageflow.io/json/decode This snippet demonstrates how to use Imageflow to decode JPEG images with spatial downscaling hints. It allows for faster decoding by downscaling the image in linear light, though the exact size may vary. ```json { "decode": { "io_id": 0, "commands": [ { "jpeg_downscale_hints": { "width": 1600, "height": 1600, "scale_luma_spatially": true, "gamma_correct_for_srgb_during_spatial_luma_scaling": true } } ] } } ``` -------------------------------- ### Basic Image Decoding with io_id Source: https://docs.imageflow.io/json/decode This snippet shows the basic usage of Imageflow for decoding an image by specifying the `io_id`. This is the simplest way to initiate image decoding. ```json { "decode": { "io_id": 0 } } ``` -------------------------------- ### Command String Execution API Source: https://docs.imageflow.io/print Executes a querystring command within a JSON job, useful for integrating with external libraries. ```APIDOC ## POST /websites/imageflow_io ### Description Allows executing a querystring command directly within a JSON job configuration. This is particularly useful for `libimageflow` bindings and optimizes decode/encode operations when both `decode` and `encode` `io_id`s are specified. ### Method POST ### Endpoint /websites/imageflow_io ### Parameters #### Request Body - **command_string** (object) - Required - Configuration for executing a command string. - **kind** (string) - Required - The type of command string (e.g., "ir4"). - **value** (string) - Required - The querystring command itself (e.g., "width=100&height=100&mode=max"). - **decode** (integer) - Optional - The `io_id` for decoding. If specified, no separate `decode` node is needed. - **encode** (integer) - Optional - The `io_id` for encoding. If specified, no separate `encode` node is needed. ### Request Example ```json { "command_string": { "kind": "ir4", "value": "width=100&height=100&mode=max", "decode": 0, "encode": 1 } } ``` ### Response #### Success Response (200) - **result** (object) - Details of the processed image. #### Response Example ```json { "result": "success" } ``` ``` -------------------------------- ### Imageflow Transformation Commands (String List) Source: https://docs.imageflow.io/json/rotate_flip This snippet shows a list of string commands used in Imageflow for basic image transformations. These commands do not require complex objects and are directly interpretable by the Imageflow library for operations like horizontal/vertical flipping, transposing, and rotating images by 90, 180, or 270 degrees. ```text [ "flip_h", "flip_v", "transpose", "rotate_90", "rotate_180", "rotate_270" ] ``` -------------------------------- ### Configure LodePNG Encoding (JSON) Source: https://docs.imageflow.io/json/encode Configuration for LodePNG encoding. The `maximum_deflate` option (boolean) can reduce file size at the cost of increased CPU time. ```json { "lodepng": { "maximum_deflate": false } } ``` -------------------------------- ### Configure WebPLossy Encoding (JSON) Source: https://docs.imageflow.io/json/encode Configuration for WebPLossy encoding. The `quality` parameter (0-100, default 80) determines the encoding quality. ```json { "webplossy": { "quality": 80 } } ``` -------------------------------- ### Imageflow Adjustments API Source: https://docs.imageflow.io/querystring/examples This section details various image adjustment parameters available in the Imageflow API. ```APIDOC ## Imageflow Adjustments API ### Description This API allows for various image adjustments including grayscale, alpha transparency, contrast, brightness, and saturation. ### Method GET (Implied for image manipulation URLs) ### Endpoint /websites/imageflow_io ### Parameters #### Query Parameters - **s.grayscale** (string) - Optional - Sets the grayscale effect. Accepted values: `true`, `y`, `ry`, `ntsc`, `bt709`, `flat`. (`true`, `ntsc`, and `y` produce identical results). - **s.alpha** (number) - Optional - Sets the alpha transparency level from `0` to `1`. For true transparency, combine with `format=png`. Otherwise, the image will be blended against `bgcolor`. - **s.contrast** (number) - Optional - Adjusts the image contrast. Accepted values range from `-1` to `1`. - **s.brightness** (number) - Optional - Adjusts the image brightness. Accepted values range from `-1` to `1`. - **s.saturation** (number) - Optional - Adjusts the image saturation. Accepted values range from `-1` to `1`. ### Request Example ``` /websites/imageflow_io?s.grayscale=ntsc&s.alpha=0.5&s.contrast=0.2&s.brightness=-0.1&s.saturation=0.3&format=png ``` ### Response #### Success Response (200) Returns the manipulated image in the specified format. #### Response Example (Binary image data) ``` -------------------------------- ### Specify GIF Preset (String) Source: https://docs.imageflow.io/json/encode This snippet simply specifies the 'gif' preset for encoding. No additional configuration is provided. ```string "gif" ``` -------------------------------- ### Image Encoding and Format Options Source: https://docs.imageflow.io/print Specify the output image format and encoding quality settings for various image types like JPEG, WebP, and PNG. ```APIDOC ## Image Encoding and Format Options ### Description Specify the output image format and encoding quality settings for various image types like JPEG, WebP, and PNG. ### Method GET ### Endpoint /websites/imageflow_io ### Parameters #### Query Parameters - **format** (string) - Optional - Determines the output image format. Options: `png`, `gif`, `jpeg`, `webp`. Defaults to the original format. - **jpeg.quality** (integer) - Optional - JPEG encoding quality (0-100). Default: `90`. - **jpeg.progressive** (boolean) - Optional - Enables progressive JPEG encoding. - **jpeg.turbo** (boolean) - Optional - Enables faster JPEG encoding at the expense of file size. - **webp.quality** (integer) - Optional - WebP encoding quality (0-100). - **webp.lossless** (boolean) - Optional - Enables lossless WebP encoding. Default: `false`. - **png.lossless** (boolean) - Optional - Disables lossless PNG encoding. Default: `true` unless `png.quality` is specified. - **png.quality** (integer) - Optional - Lossy PNG quality (0-100). Default: `100`. - **png.min_quality** (integer) - Optional - Minimum PNG quality before lossless is used (0-100). Default: `0`. ### Request Example ``` GET /websites/imageflow_io?format=webp&webp.quality=80&png.lossless=false ``` ### Response #### Success Response (200) - **image_data** (binary) - The processed image data. #### Response Example (Binary image data) ``` -------------------------------- ### Image Transformation API Source: https://docs.imageflow.io/querystring/introduction This API allows you to transform images by specifying commands in the query string. The commands are executed in a fixed order: trim whitespace, srotate, sflip, crop, scale, filter, pad, rotate, flip. ```APIDOC ## GET /websites/imageflow_io ### Description This endpoint allows for image manipulation through query parameters. The API processes commands in a specific order to achieve the desired image transformation. ### Method GET ### Endpoint /websites/imageflow_io ### Query Parameters - **w** (integer) - Optional - The desired width of the output image. - **h** (integer) - Optional - The desired height of the output image. - **mode** (string) - Optional - The scaling mode. Possible values: 'max', 'pad', 'crop'. - **scale** (string) - Optional - The scaling behavior. Possible values: 'down', 'both'. - **in** (string) - Optional - Input image file path. - **out** (string) - Optional - Output image file path. - **command** (string) - Optional - A string containing image manipulation commands. - **quiet** (boolean) - Optional - If true, suppresses output. ### Request Example ``` http://localhost:39876/demo_images/tulip-leaf.jpg?w=300&h=300&mode=max ``` ### Response #### Success Response (200) - **image_data** (binary) - The transformed image data. #### Response Example (Binary image data would be returned here) ``` -------------------------------- ### Image Encoding Parameters Source: https://docs.imageflow.io/querystring/encoding This section details the various parameters available for controlling image encoding formats and quality settings within the Imageflow API. ```APIDOC ## Image Encoding Parameters ### Description This section details the various parameters available for controlling image encoding formats and quality settings within the Imageflow API. ### Method GET (or POST, depending on usage context) ### Endpoint /websites/imageflow_io ### Query Parameters - **format** (string) - Optional - Determines the format to encode the image as. Allowed values: `png`, `gif`, `jpeg`, `webp`. Defaults to the original format. - **jpeg.quality** (integer) - Optional - Determines the JPEG encoding quality. Range: `0` to `100`. Default is `90`. - **jpeg.progressive** (boolean) - Optional - Enables progressive JPEG encoding. Default `false`. - **jpeg.turbo** (boolean) - Optional - Encodes files faster at the expense of file size. Default `false`. - **webp.quality** (integer) - Optional - Determines the WebP encoding quality. Range: `0` to `100`. - **webp.lossless** (boolean) - Optional - Enables lossless WebP encoding. Default `false`. - **png.lossless** (boolean) - Optional - Disables lossless PNG encoding. Default `true` unless `png.quality` is specified. - **png.quality** (integer) - Optional - Determines the lossy PNG quality. Range: `0` to `100`. Default `100`. - **png.min_quality** (integer) - Optional - Determines the minimum PNG quality that must be realized before lossless is used. Range: `0` to `100`. Default `0`. ### Request Example ``` /websites/imageflow_io?format=webp&webp.quality=80&jpeg.progressive=true ``` ### Response #### Success Response (200) - **image_data** (binary) - The processed image data in the specified format. #### Response Example (Binary image data would be returned here, not representable as JSON) ``` -------------------------------- ### Configure Imageflow Security Settings (JSON) Source: https://docs.imageflow.io/json/security This JSON configuration demonstrates how to set security limits for image processing in Imageflow. It includes maximum decode, frame, and encode sizes, specified in pixels (width and height) and megapixels. These settings are crucial for preventing denial-of-service attacks when handling untrusted image sources. ```json { "security": { "max_decode_size": { "w": 10000, "h": 10000, "megapixels": 50 }, "max_frame_size": { "w": 10000, "h": 10000, "megapixels": 100 }, "max_encode_size": { "w": 8000, "h": 8000, "megapixels": 20 } } } ``` -------------------------------- ### Expand Canvas with Border - JSON Configuration Source: https://docs.imageflow.io/json/expand_canvas This JSON configuration snippet demonstrates how to expand the canvas of an image by 10 pixels on all sides and apply a pink border. The color is specified using an sRGB hex value. ```json { "expand_canvas": { "left": 10, "top": 10, "right": 10, "bottom": 10, "color": { "srgb": { "hex": "FFEECCFF" } } } } ``` -------------------------------- ### Configure MozJPEG Encoding (JSON) Source: https://docs.imageflow.io/json/encode Configuration for MozJPEG encoding. Key options include `quality` (0-100, default 80) and `progressive` (boolean) to enable progressive JPEG encoding. ```json { "mozjpeg": { "quality": 90, "progressive": false } } ```