- Print
- PDF
Query string creation guide
- Print
- PDF
Available in Classic and VPC
Method of creating a thumbnail call URL
- When integrating with Object Storage: create in a combination of a CDN URL, a file path in Object Storage, and a thumbnail creation option
- Format:
https://{CDN-DOMAIN}/{FILE-PATH-IN-OBJSTORAGE}?{QUERYSTRINGS}
- Example:
https://abc123xyz.cdn.ntruss.com/a/b.jpg?type=h_wm&h=780&quality=90&autorotate=true
- Format:
HTTP URL integration is available only in the JP region. In the KR region, it is available from April 2023.
- When integrating with HTTP URL: creates in a combination of a CDN URL, an external URL, and a thumbnail creation option
- Format:
https://{CDN-DOMAIN}?src="{외부이미지URL}"&{QUERYSTRINGS}
- Example:
https://abc123xyz.cdn.ntruss.com?src="{외부 이미지 URL}"&type=h_wm&h=780&quality=90&autorotate=true
- Format:
Thumbnail creation options supported by Image Optimizer are created using Query String.
Thumbnail creation results are not affected by the order of parameters (options) of Query String.
However, in case of Query String that creates the same thumbnail as an execution result, note that conversion counts may be added because a new conversion request is recognized based on settings of default values of parameters. For example, /a.jpg?type=f&w=40&h=40
and /a.jpg?type=f&w=40&h=40&quality=90
create completely identical thumbnails but may be charged individually.
Description of Query String
Options constituting Query String can be divided into type parameter dependent options and global options universally applicable to all types.
Global options
- quality: applied to when a source image is in the JPEG format and set to an integer between 1 and 100 (default: 90)
- autorotate: set by string true/false and automatically rotates a result thumbnail based on EXIF rotation information (default: true)
- anilimit: when multiple frames exist in the GIF format, remove frames after a specific frame the number of frames to be exposed from the front 1 to 100 (default: 1)
- ttype: set the format type of a thumbnail (jpg, gif, and png), when it is not set, set the format type of a thumbnail to be the same as the source format
- src
- Enter external image URL information that becomes a source for creating a thumbnail
- When a separator, such as ? and &, exists in URL, enter the URL by enclosing the URL with %22 (") and percent-encoding the URL
- The URL enclosed by "is not be decoded without " become the first decode.
- The image file size is limited to 30 MB and HTTP Redirect is allowed up to one time.
type parameters and global options
Size
Resize and crop (type=f): while maintaining the original ratio, after decreasing or increasing the image size, crop the remaining regions
- w: width, integer greater than or equal to 1, required input
- h: height, integer greater than or equal to 1, required input
- align: position to be remained after cropping, position of 9 compartments in the image, 0 to 8, default 4 (center) - faceopt: whether to apply face recognition, true/false string, default "false"
resize(type=m): change the image size to fit within the set width and height
- w: width, integer greater than or equal to 1, required input
- h: height, integer greater than or equal to 1, required input
- bgcolor: color to be applied to upper and lower, or both sides of the image. The width or height value is ignored if this value does not exist. (hexadecimal RGB color code, a string of 6 letters)
- extopt: whether to zoom in if the thumbnail is smaller than the source, zoom in if the value is Integer 3, default 0 (maintain the original size)
Width conversion (type=w): resize the image based on the width while maintaining the original ratio
- w: width, integer greater than or equal to 1, required input
- extopt: whether to zoom in if the thumbnail is smaller than the source, zoom in if the value is Integer 3, default 0 (maintain the original size)
Height conversion (type=h): resize the image based on the height while maintaining the original ratio
- h: height, integer greater than or equal to 1, required input
Force conversion (type=u): Ignore the original ratio and forcibly resize the image to a desired size
- w: width, integer greater than or equal to 1, required input
- h: height, integer greater than or equal to 1, required input
Watermark
- Watermark(type=wm)
- wm_path: an URL of an image to be stamped as a watermark (required to include HTTP) The watermark image needs to be smaller than the default image.
- wm_align: a reference point for specifying the watermark position The top left point in each of 9 compartmentalized regions. 0 to 8, default 4.
- wm_offx: a distance from the reference point to the right An integer greater than or equal to 0, default 0.
- wm_offy: a downward distance from the reference point An integer greater than or equal to 0, default 0.
Filter
Sharpen(type=sh): an effect of clearly showing an image
- sharp_amt: the degree of contrast in the brightness of outlines, required input
Blur(type=bl): an effect of blurring an image
- blur_rad: a mask size for applying the effect (pixel radius)
- blur_sig: the degree of dispersion to be applied within the blur mask, required input
Black & white (type=bw): convert an image to black and white
Multiple type parameters
Size, Watermark, and Filter are sequentially applied from the first based on a separator, _
.
Example: f_wm
(resize and crop, and then apply watermark), bw_wm
(after converting into black and white, apply watermark)
Example
Resize and crop
- After reducing to width of 100 and height of 100, crop the overflowing portion
/Filename.jpg?type=f&w=100&h=100
Resize
- When rotation information exist, rotate and reduce while maintaining the ratio to fit within a "width of 320 and height of 320" frame, fill the margin with color FFFFFA and compress by JPEG quality 95
/Filename.jpg?type=m&w=320&h=320&autorotate=true&bgcolor=FFFFFA&quality=95
After resizing, watermark
- When a source is smaller than a thumbnail, enlarge it, contract or enlarge to 512x1024, and then fill the margin with color 000011
- Thereafter, using a specific image URL, stamp a watermark by moving by horizontally 11 pixels and vertically 10 pixels based on the top right corner.
- In case of a GIF animation, perform the same tasks on up to 100
/Filename.jpg?type=m_wm&w=512&h=1024&bgcolor=000011&wm_path=http://watermark_URL&wm_offx=11&wm_offy=10&wm_align=2&anilimit=100&extopt=3
After resizing, apply the sharpen filter, change the image format to png
/Filename.jpg?m_sh&w=512&h=256&ttype=png