public final class ThumborUrlBuilder
extends java.lang.Object
Thumbor.buildImage(String)| Modifier and Type | Class and Description |
|---|---|
static class |
ThumborUrlBuilder.FitInStyle
Style of resizing for 'fit-in'.
|
static class |
ThumborUrlBuilder.HorizontalAlign
Horizontal alignment for crop positioning.
|
static class |
ThumborUrlBuilder.ImageFormat
Image formats supported by Thumbor.
|
static class |
ThumborUrlBuilder.TrimPixelColor
Orientation from where to get the pixel color for trim.
|
static class |
ThumborUrlBuilder.VerticalAlign
Vertical alignment for crop positioning.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
ORIGINAL_SIZE
Original size for image width or height.
|
| Modifier and Type | Method and Description |
|---|---|
ThumborUrlBuilder |
align(ThumborUrlBuilder.HorizontalAlign align)
Set the horizontal alignment for the image when image gets cropped by resizing.
|
ThumborUrlBuilder |
align(ThumborUrlBuilder.VerticalAlign align)
Set the vertical alignment for the image when image gets cropped by resizing.
|
ThumborUrlBuilder |
align(ThumborUrlBuilder.VerticalAlign valign,
ThumborUrlBuilder.HorizontalAlign halign)
Set the horizontal and vertical alignment for the image when image gets cropped by resizing.
|
static java.lang.String |
blur(int radius)
This filter adds a blur effect to the image using the specified radius and a default
sigma (equal to the radius).
|
static java.lang.String |
blur(int radius,
int sigma)
This filter adds a blur effect to the image using the specified radius and sigma.
|
static java.lang.String |
brightness(int amount)
This filter increases or decreases the image brightness.
|
static java.lang.String |
contrast(int amount)
The filter increases or decreases the image contrast.
|
ThumborUrlBuilder |
crop(int top,
int left,
int bottom,
int right)
Crop the image between two points.
|
static java.lang.String |
equalize()
This filter equalizes the color distribution in the image.
|
static java.lang.String |
fill(int color)
This filter permit to return an image sized exactly as requested wherever is its ratio by
filling with chosen color the missing parts.
|
ThumborUrlBuilder |
filter(java.lang.String... filters)
Add one or more filters to the image.
|
ThumborUrlBuilder |
fitIn()
Constrain the image size inside the resized box, scaling as needed.
|
ThumborUrlBuilder |
fitIn(ThumborUrlBuilder.FitInStyle fitInStyle)
Constrain the image size inside the resized box, scaling as needed.
|
ThumborUrlBuilder |
flipHorizontally()
Flip the image horizontally.
|
ThumborUrlBuilder |
flipVertically()
Flip the image vertically.
|
static java.lang.String |
format(ThumborUrlBuilder.ImageFormat format)
Specify the output format of the image.
|
static java.lang.String |
frame(java.lang.String imageUrl)
This filter uses a 9-patch to overlay the image.
|
static java.lang.String |
grayscale()
This filter changes the image to grayscale.
|
static java.lang.String |
noise(int amount)
This filter adds noise to the image.
|
static java.lang.String |
noUpscale()
This filter tells thumbor not to upscale your images.
|
static java.lang.String |
quality(int amount)
This filter changes the overall quality of the JPEG image (does nothing for PNGs or GIFs).
|
ThumborUrlBuilder |
resize(int width,
int height)
Resize picture to desired size.
|
static java.lang.String |
rgb(int r,
int g,
int b)
This filter changes the amount of color in each of the three channels.
|
static java.lang.String |
rotate(int angle)
This filter rotates the given image according to the angle passed.
|
static java.lang.String |
roundCorner(int radius)
This filter adds rounded corners to the image using the white as the background.
|
static java.lang.String |
roundCorner(int radius,
int color)
This filter adds rounded corners to the image using the specified color as the background.
|
static java.lang.String |
roundCorner(int radiusInner,
int radiusOuter,
int color)
This filter adds rounded corners to the image using the specified color as the background.
|
static java.lang.String |
sharpen(float amount,
float radius,
boolean luminanceOnly)
This filter enhances apparent sharpness of the image.
|
ThumborUrlBuilder |
smart()
Use smart cropping for determining the important portion of an image.
|
static java.lang.String |
stripicc()
This filter strips the ICC profile from the image.
|
java.lang.String |
toMeta()
Build the metadata URL.
|
java.lang.String |
toMetaSafe()
Build a safe version of the metadata URL.
|
java.lang.String |
toMetaUnsafe()
Build an unsafe version of the metadata URL.
|
java.lang.String |
toString() |
java.lang.String |
toUrl()
Build the URL.
|
java.lang.String |
toUrlSafe()
Build a safe version of the URL.
|
java.lang.String |
toUrlUnsafe()
Build an unsafe version of the URL.
|
ThumborUrlBuilder |
trim()
Removing surrounding space in image.
|
ThumborUrlBuilder |
trim(ThumborUrlBuilder.TrimPixelColor value)
Removing surrounding space in image.
|
ThumborUrlBuilder |
trim(ThumborUrlBuilder.TrimPixelColor value,
int colorTolerance)
Removing surrounding space in image.
|
static java.lang.String |
watermark(java.lang.String imageUrl)
This filter adds a watermark to the image at (0, 0).
|
static java.lang.String |
watermark(java.lang.String imageUrl,
int x,
int y)
This filter adds a watermark to the image.
|
static java.lang.String |
watermark(java.lang.String imageUrl,
int x,
int y,
int transparency)
This filter adds a watermark to the image.
|
static java.lang.String |
watermark(ThumborUrlBuilder image)
This filter adds a watermark to the image at (0, 0).
|
static java.lang.String |
watermark(ThumborUrlBuilder image,
int x,
int y)
This filter adds a watermark to the image.
|
static java.lang.String |
watermark(ThumborUrlBuilder image,
int x,
int y,
int transparency)
This filter adds a watermark to the image.
|
public static final int ORIGINAL_SIZE
public ThumborUrlBuilder resize(int width, int height)
width - Desired width.height - Desired height.java.lang.IllegalArgumentException - if width or height is less than 0 or both are
0.public ThumborUrlBuilder flipHorizontally()
java.lang.IllegalStateException - if image has not been marked for resize.public ThumborUrlBuilder flipVertically()
java.lang.IllegalStateException - if image has not been marked for resize.public ThumborUrlBuilder fitIn()
java.lang.IllegalStateException - if image has not been marked for resize.public ThumborUrlBuilder fitIn(ThumborUrlBuilder.FitInStyle fitInStyle)
java.lang.IllegalStateException - if image has not been marked for resize.public ThumborUrlBuilder crop(int top, int left, int bottom, int right)
top - Top bound.left - Left bound.bottom - Bottom bound.right - Right bound.java.lang.IllegalArgumentException - if top or left are less than zero or bottom or right are less than one or less than top or left,
respectively.public ThumborUrlBuilder align(ThumborUrlBuilder.HorizontalAlign align)
align - Horizontal alignment.java.lang.IllegalStateException - if image has not been marked for resize.public ThumborUrlBuilder align(ThumborUrlBuilder.VerticalAlign align)
align - Vertical alignment.java.lang.IllegalStateException - if image has not been marked for resize.public ThumborUrlBuilder align(ThumborUrlBuilder.VerticalAlign valign, ThumborUrlBuilder.HorizontalAlign halign)
valign - Vertical alignment.halign - Horizontal alignment.java.lang.IllegalStateException - if image has not been marked for resize.public ThumborUrlBuilder smart()
java.lang.IllegalStateException - if image has not been marked for resize.public ThumborUrlBuilder trim()
public ThumborUrlBuilder trim(ThumborUrlBuilder.TrimPixelColor value)
value - orientation from where to get the pixel color.public ThumborUrlBuilder trim(ThumborUrlBuilder.TrimPixelColor value, int colorTolerance)
value - orientation from where to get the pixel color.colorTolerance - 0 - 442. This is the euclidian distance
between the colors of the reference pixel and the surrounding pixels is used.
If the distance is within the tolerance they'll get trimmed.public ThumborUrlBuilder filter(java.lang.String... filters)
If you have custom filters you can supply them as a string. (e.g.
"my_filter(1,2,3)").
filters - Filter strings.java.lang.IllegalArgumentException - if no arguments supplied or an argument is null.brightness(int),
contrast(int),
fill(int),
frame(String),
noise(int),
quality(int),
rgb(int, int, int),
roundCorner(int),
roundCorner(int, int),
roundCorner(int, int, int),
sharpen(float, float, boolean),
watermark(String),
watermark(ThumborUrlBuilder),
watermark(String, int, int),
watermark(ThumborUrlBuilder, int, int),
watermark(String, int, int, int),
watermark(ThumborUrlBuilder, int, int, int)public java.lang.String toUrl()
toUrlSafe() or toUrlUnsafe() depending
on whether a key was set.public java.lang.String toUrlUnsafe()
public java.lang.String toUrlSafe()
null key.public java.lang.String toMeta()
toMetaSafe() or toMetaUnsafe()
depending on whether a key was set.public java.lang.String toMetaUnsafe()
public java.lang.String toMetaSafe()
null key.public java.lang.String toString()
toString in class java.lang.Objectpublic static java.lang.String brightness(int amount)
amount - -100 to 100 - The amount (in %) to change the image brightness. Positive numbers
make the image brighter and negative numbers make the image darker.java.lang.IllegalArgumentException - if amount outside bounds.public static java.lang.String contrast(int amount)
amount - -100 to 100 - The amount (in %) to change the image contrast. Positive numbers
increase contrast and negative numbers decrease contrast.java.lang.IllegalArgumentException - if amount outside bounds.public static java.lang.String noise(int amount)
amount - 0 to 100 - The amount (in %) of noise to add to the image.java.lang.IllegalArgumentException - if amount outside bounds.public static java.lang.String quality(int amount)
amount - 0 to 100 - The quality level (in %) that the end image will feature.java.lang.IllegalArgumentException - if amount outside bounds.public static java.lang.String rgb(int r,
int g,
int b)
r - The amount of redness in the picture. Can range from -100 to 100 in percentage.g - The amount of greenness in the picture. Can range from -100 to 100 in percentage.b - The amount of blueness in the picture. Can range from -100 to 100 in percentage.java.lang.IllegalArgumentException - if r, g, or b are outside of bounds.public static java.lang.String roundCorner(int radius)
radius - amount of pixels to use as radius.public static java.lang.String roundCorner(int radius,
int color)
radius - amount of pixels to use as radius.color - fill color for clipped region.public static java.lang.String roundCorner(int radiusInner,
int radiusOuter,
int color)
radiusInner - amount of pixels to use as radius.radiusOuter - specifies the second value for the ellipse used for the radius. Use 0 for
no value.color - fill color for clipped region.public static java.lang.String watermark(java.lang.String imageUrl)
imageUrl - Watermark image URL. It is very important to understand that the same image
loader that Thumbor uses will be used here.java.lang.IllegalArgumentException - if image is blank.public static java.lang.String watermark(ThumborUrlBuilder image)
image - Watermark image URL. It is very important to understand that the same image
loader that Thumbor uses will be used here.java.lang.IllegalArgumentException - if image is null.public static java.lang.String watermark(java.lang.String imageUrl,
int x,
int y)
imageUrl - Watermark image URL. It is very important to understand that the same image
loader that Thumbor uses will be used here.x - Horizontal position that the watermark will be in. Positive numbers indicate position
from the left and negative numbers indicate position from the right.y - Vertical position that the watermark will be in. Positive numbers indicate position
from the top and negative numbers indicate position from the bottom.java.lang.IllegalArgumentException - if image is blank.public static java.lang.String watermark(ThumborUrlBuilder image, int x, int y)
image - Watermark image URL. It is very important to understand that the same image
loader that Thumbor uses will be used here.x - Horizontal position that the watermark will be in. Positive numbers indicate position
from the left and negative numbers indicate position from the right.y - Vertical position that the watermark will be in. Positive numbers indicate position
from the top and negative numbers indicate position from the bottom.java.lang.IllegalArgumentException - if image is null.public static java.lang.String watermark(java.lang.String imageUrl,
int x,
int y,
int transparency)
imageUrl - Watermark image URL. It is very important to understand that the same image
loader that Thumbor uses will be used here.x - Horizontal position that the watermark will be in. Positive numbers indicate position
from the left and negative numbers indicate position from the right.y - Vertical position that the watermark will be in. Positive numbers indicate position
from the top and negative numbers indicate position from the bottom.transparency - Watermark image transparency. Should be a number between 0 (fully opaque)
and 100 (fully transparent).java.lang.IllegalArgumentException - if image is blank or transparency is outside
bounds.public static java.lang.String watermark(ThumborUrlBuilder image, int x, int y, int transparency)
image - Watermark image URL. It is very important to understand that the same image
loader that Thumbor uses will be used here.x - Horizontal position that the watermark will be in. Positive numbers indicate position
from the left and negative numbers indicate position from the right.y - Vertical position that the watermark will be in. Positive numbers indicate position
from the top and negative numbers indicate position from the bottom.transparency - Watermark image transparency. Should be a number between 0 (fully opaque)
and 100 (fully transparent).java.lang.IllegalArgumentException - if image is null.public static java.lang.String sharpen(float amount,
float radius,
boolean luminanceOnly)
amount - Sharpen amount. Typical values are between 0.0 and 10.0.radius - Sharpen radius. Typical values are between 0.0 and 2.0.luminanceOnly - Sharpen only luminance channel.public static java.lang.String fill(int color)
color - integer representation of color.public static java.lang.String format(ThumborUrlBuilder.ImageFormat format)
ThumborUrlBuilder.ImageFormatpublic static java.lang.String frame(java.lang.String imageUrl)
imageUrl - Watermark image URL. It is very important to understand that the same image
loader that Thumbor uses will be used here.public static java.lang.String stripicc()
public static java.lang.String grayscale()
public static java.lang.String equalize()
public static java.lang.String blur(int radius)
radius - Radius used in the gaussian function to generate a matrix, maximum value is 150.
The bigger the radius more blurred will be the image.public static java.lang.String blur(int radius,
int sigma)
radius - Radius used in the gaussian function to generate a matrix, maximum value is 150.
The bigger the radius more blurred will be the image.sigma - Sigma used in the gaussian function.public static java.lang.String noUpscale()
public static java.lang.String rotate(int angle)
angle - The angle of rotation. Values can be either 0°, 90°, 180° or 270° – multiples of
90°. Angles equal to or greater than 360° will be replaced by their coterminal
angle of rotation.