ImageTransformation class
Image Delivery APIs retrieve, manipulate and/or convert the retrieved image file, and deliver it to your web or mobile properties. Learn more about ImageTransformation
Constructors
- ImageTransformation(String _imageUrl, HttpClient client)
Properties
- client → HttpClient
-
final
- hashCode → int
-
The hash code for this object.
read-only, inherited
- query → URLQueryParams
-
final
-
queryParameter
→ Map<
String, String> -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
auto(
{String auto, String format}) → void - The auto function lets you enable the functionality that automates certain image optimization features. As of now, there is only one possible value for this field, i.e., webp. When the auto parameter is set to webp, it enables WebP image support. WebP images have higher compression rate with minimum loss of quality.
-
bgColor(
String bgColor) → void - The bg-color function lets you set a backgroud color for the given image. This is useful when applying padding or for replacing the transparent pixels of an image. There are three possible types of values for this bgColor is string . It can accept hexadecimal, combination of (Red, Blue, Green) and (Red, Blue, Green, Alpha).
-
blur(
int blur) → void - The blur parameter allows you to decrease the focus and clarity of a given image. To specify the extent to which you need to increase the blurriness of an image, use any decimal number (float) between 1 and 1000.
-
brightness(
int brightness) → void - The brightness parameter allows you to increase or decrease the intensity with which an image reflects or radiates perceived light. To specify brightness for an image, use a whole number (integer) between -100 and 100. You can also define brightness using any decimal number between -100.00 and 100.00 To increase the value of the brightness parameter of an image, pass a positive value or negative value For more details, Read documentation: https://www.contentstack.com/docs/developers/apis/image-delivery-api/#brightness
-
canvas(
String canvasValue) → void - The canvas parameter allows you to increase the size of the canvas that surrounds an image. You can specify the height and width of the canvas area in pixels or percentage or define the height and width of the aspect ratio of the canvas. You can also define the starting point for the canvas area or offset the canvas on its X and Y axis.
-
contrast(
int contrast) → void - The contrast parameter allows you to increase or decrease the difference between the darkest and lightest tones in a given image. To specify contrast for an image, use a whole number (integer) between -100 and 100. You can also define contrast using any decimal number between -100.00 and 100.00.
-
convert(
Format format) → void - The format function lets you converts a given image from one format to another. The formats that the source image can be converted to are gif, png, jpg (for JPEG), pjpg (for Progressive JPEG), webp, webpll (Lossless), and webply (Lossy).
-
crop(
String cropValue) → void -
cropBy(
int width, int height, {String region, String offset}) → void - The crop function allows you to remove pixels from an image. You can crop an image by specifying the height and width in pixels or percentage value, or defining height and width in aspect ratio. You can also define a sub region (i.e., define the starting point for crop) before cropping the image, or you can offset the image on its X and Y axis (i.e., define the centre point of the crop) before cropping the image. You can set the X-axis and Y-axis position of the top left corner of the crop by using the query ?crop={width_value},{height_value},x{value},y{value}. This lets you define the starting point of the crop region. The x-axis value and y-axis value can be defined in pixels or percentage.
-
dpr(
int dpr) → void - To implement the device pixel ratio functionality of the Image Delivery API, you require two parameters "dpr" and "height or width". For more details read the documentation: https://www.contentstack.com/docs/developers/apis/image-delivery-api/#set-device-pixel-ratio
-
fetch<
T, K> () → Future< T> - Makes API Request of respective function.
-
fit(
double width, double height, Fit fit) → void -
This parameter enables you to fit the given image
properly within the specified height and width.
You need to provide values for the height, width and fit parameters.
The two available values for the fit parameter are bounds and crop.
fit accepts optional parameters
width
,height
of type int and fir of typeFit
-
frame(
int frame) → void - The frame parameter fetches the first frame from an animated GIF (Graphics Interchange Format) file that comprises a sequence of moving images. For more details, Read documentation: https://www.contentstack.com/docs/developers/apis/image-delivery-api/#frame
-
getUrl(
) → String -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
orientation(
Orientation orient) → void - The orient parameter lets you control the cardinal orientation of the given image. Using this parameter, you can orient the image right or left, flip horizontally or vertically or both, and do a lot more. It can automatically correct the orientation of the image if the source image contains orientation details within its EXIF data (Exchangeable Image File Format).
-
overlay(
String overlayUrl, {String overlayAlign, String overlayRepeat, int overlayWidth, int overlayHeight}) → void -
The overlay parameter allows you to put one image on top of another.
You need to specify the relative URL of the image as
value for this parameter.
By default, the cropping alignment will be middle,
center. See overlay-align for more details.
It accepts
overlayUrl
as a parameter to put oneoverlayUrl
on top of_imageUrl
There are optional params also likeoverlayAlign
,overlayRepeat
,overlayWidth
,overlayHeight
Fr more details read the documentation: https://www.contentstack.com/docs/developers/apis/image-delivery-api/#overlay -
overlayPadding(
String overlayPadding) → void - You can either specify all the four padding values (top, right, bottom, and left) or combine two or more values
-
padding(
String padding) → void - This function lets you add extra pixels to the edges of an image. This is useful if you want to add whitespace or border to an image. The value for this parameter can be given in pixels or percentage.
-
quality(
int quality) → void - The quality function lets you control the compression level of images that have Lossy file format. The value for this parameters can be entered in any whole number (taken as a percentage) between 1 and 100. The lower the number, the smaller will be file size and lower quality, and vice versa. If the source image file is not of Lossy file format, this parameter will be ignored.
-
resize(
{int width, int height, bool disable}) → void - this function lets you dynamically resize the width of the output image by specifying pixels or percentage values for more details read documentation: The disable function disables the functionality that is enabled by default. For instance, upscale is always enabled, in which the image is upscaled if the output image (by specifying the width or height) is bigger than the source image. To disable this feature, you can use the query ?disable=upscale. This ensures that even if the specified height or width is much bigger than the actual image, it will not be rendered disproportionately.
-
resizeFilter(
{int width, int height, Filter filter}) → void - The resize-filter parameter allows you to use the resizing filter to increase or decrease the number of pixels in a given image. This parameter resizes the given image without adding or removing any data from it.
-
saturation(
int saturation) → void - The saturation parameter allows you to increase or decrease the intensity of the colors in a given image. To specify the saturation for an image, use a whole number (integer) between -100 and 100. You can also define saturation using any decimal number between -100.00 and 100.00 For more details, Read documentation: https://www.contentstack.com/docs/developers/apis/image-delivery-api/#saturation
- The frame parameter fetches the first frame from an animated GIF (Graphics Interchange Format) file that comprises a sequence of moving images. increase the sharpness of a given image by amount, radius and threshold For more details, Read documentation: https://www.contentstack.com/docs/developers/apis/image-delivery-api/#sharpen
-
toString(
) → String -
A string representation of this object.
inherited
-
trim(
[int top, int right, int bottom, int left]) → void -
The trim parameter lets you trim an image from the edges.
This is especially useful for removing border or white spaces
that the downloaded images usually come with.
The value for this parameter can be given in pixels or percentage.
You can specify values for
top
,right
,bottom
, andleft
edges of an image. For example, to trim the top edge by 25px, right edge by 50px, bottom edge by 75px and left edge by 100 provide trim as comma separated value like, 25,50,75,100
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited