public final class WebPImage extends RasterCachedImage
A webp image.
RasterCachedImage.RotateTestMode
Constructor and Description |
---|
WebPImage(InputStream stream)
Initializes a new instance of the
WebPImage class
from stream. |
WebPImage(InputStream stream,
LoadOptions loadOptions)
Initializes a new instance of the
WebPImage class from stream. |
WebPImage(int width,
int height,
WebPOptions options)
Initializes a new instance of the
WebPImage class with empty image. |
WebPImage(int width,
int height,
WebPOptions options,
LoadOptions loadOptions)
Initializes a new instance of the
WebPImage class with empty image. |
WebPImage(RasterImage rasterImage)
Initializes a new instance of the
WebPImage class from rasterImage. |
WebPImage(RasterImage rasterImage,
LoadOptions loadOptions)
Initializes a new instance of the
WebPImage class from rasterImage. |
WebPImage(String path)
Initializes a new instance of the
WebPImage class from file. |
WebPImage(String path,
LoadOptions loadOptions)
Initializes a new instance of the
WebPImage class from file. |
Modifier and Type | Method and Description |
---|---|
void |
addBlock(IFrame block)
Adds a new Webp block.
|
void |
adjustBrightness(int brightness)
Adjust of a
brightness for image. |
void |
adjustContrast(float contrast)
Image contrasting |
void |
adjustGamma(float gamma)
Gamma-correction of an image.
|
void |
adjustGamma(float gammaRed,
float gammaGreen,
float gammaBlue)
Gamma-correction of an image.
|
void |
binarizeBradley(double brightnessDifference)
Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding
|
void |
binarizeFixed(byte threshold)
Binarization of an image with predefined threshold
|
void |
binarizeOtsu()
Binarization of an image with Otsu thresholding
|
void |
clearBlocks()
Clears all the Webp blocks.
|
void |
crop(Rectangle rectangle)
Cropping the image.
|
void |
dither(int ditheringMethod,
int bitsCount,
IColorPalette customPalette)
Performs dithering on the current image.
|
void |
filter(Rectangle rectangle,
FilterOptionsBase options)
Filters the specified rectangle.
|
int |
getBitsPerPixel()
Gets the image bits per pixel count.
|
IFrame[] |
getBlocks()
Gets the Webp blocks.
|
long |
getFileFormat()
Gets a value of file format
|
int |
getHeight()
Gets the image height.
|
float |
getImageOpacity()
Gets opacity of this image.
|
WebPOptions |
getOptions()
Gets or sets the options.
|
int |
getWidth()
Gets the image width.
|
void |
grayscale()
Transformation of an image to its grayscale representation
|
boolean |
hasAlpha()
Gets a value indicating whether this instance has alpha.
|
void |
insertBlock(int index,
IFrame block)
Adds a new Webp block.
|
void |
removeBlock(IFrame block)
Removes the Webp block.
|
void |
replaceColor(int oldColorArgb,
byte oldColorDiff,
int newColorArgb)
Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
|
void |
replaceNonTransparentColors(int newColorArgb)
Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges.
|
void |
resize(int newWidth,
int newHeight,
ImageResizeSettings settings)
Resizes the image.
|
void |
resize(int newWidth,
int newHeight,
int resizeType)
Resizes the image.
|
void |
rotate(float angle,
boolean resizeProportionally,
Color backgroundColor)
WebPImage.Rotate image around the center. |
void |
rotateFlipAll(int rotateFlip)
Rotates the flip all frames in the image.
|
cacheData, getMaxAllowedAllocationForPartialRotateSave, getRotateMode, isCached, rotateFlip, setMaxAllowedAllocationForPartialRotateSave, setRotateMode
crop, dither, getArgb32Pixel, getDefaultArgb32Pixels, getDefaultPixels, getDefaultRawData, getDefaultRawData, getHorizontalResolution, getModifyDate, getPixel, getPremultiplyComponents, getRawCustomColorConverter, getRawDataFormat, getRawDataSettings, getRawFallbackIndex, getRawIndexedColorConverter, getRawLineSize, getTransparentColor, getUpdateXmpData, getUseRawData, getVerticalResolution, getXmpData, hasTransparentColor, isRawDataAvailable, loadArgb32Pixels, loadCmyk32Pixels, loadCmykPixels, loadPartialArgb32Pixels, loadPartialPixels, loadPixels, loadRawData, loadRawData, readArgb32ScanLine, readScanLine, replaceColor, replaceNonTransparentColors, rotate, saveArgb32Pixels, saveCmyk32Pixels, saveCmykPixels, savePixels, saveRawData, setArgb32Pixel, setHorizontalResolution, setPalette, setPixel, setPremultiplyComponents, setRawCustomColorConverter, setRawFallbackIndex, setRawIndexedColorConverter, setResolution, setTransparentColor, setTransparentColor, setUpdateXmpData, setUseRawData, setVerticalResolution, setXmpData, toBitmap, writeArgb32ScanLine, writeScanLine
canLoad, canLoad, canLoad, canLoad, canSave, create, getBackgroundColor, getBounds, getContainer, getDefaultOptions, getFileFormat, getFileFormat, getFittingRectangle, getFittingRectangle, getInterruptMonitor, getOriginalOptions, getPalette, getProportionalHeight, getProportionalWidth, getSize, hasBackgroundColor, isAutoAdjustPalette, load, load, load, load, load, load, resize, resizeHeightProportionally, resizeHeightProportionally, resizeHeightProportionally, resizeWidthProportionally, resizeWidthProportionally, resizeWidthProportionally, save, save, save, save, save, save, save, setAutoAdjustPalette, setBackgroundColor, setBackgroundColor, setInterruptMonitor, setPalette
getDataStreamContainer, save, save, save, save
close, dispose, getDisposed
public WebPImage(InputStream stream)
Initializes a new instance of the WebPImage
class
from stream.
stream
- The stream WebP image.public WebPImage(InputStream stream, LoadOptions loadOptions)
Initializes a new instance of the WebPImage
class from stream.
stream
- The stream WebP image.loadOptions
- The load options.public WebPImage(String path)
Initializes a new instance of the WebPImage
class from file.
path
- The path to file WebP Imagepublic WebPImage(String path, LoadOptions loadOptions)
Initializes a new instance of the WebPImage
class from file.
path
- The path to file WebP ImageloadOptions
- The load options.public WebPImage(RasterImage rasterImage)
Initializes a new instance of the WebPImage
class from rasterImage.
rasterImage
- The raster image.public WebPImage(RasterImage rasterImage, LoadOptions loadOptions)
Initializes a new instance of the WebPImage
class from rasterImage.
rasterImage
- The raster image.loadOptions
- The load options.public WebPImage(int width, int height, WebPOptions options)
Initializes a new instance of the WebPImage
class with empty image.
width
- The image widthheight
- The image height.options
- The options.public WebPImage(int width, int height, WebPOptions options, LoadOptions loadOptions)
Initializes a new instance of the WebPImage
class with empty image.
width
- The image widthheight
- The image height.options
- The options.loadOptions
- The load options.public WebPOptions getOptions()
Gets or sets the options.
public int getBitsPerPixel()
Gets the image bits per pixel count.
getBitsPerPixel
in class Image
public int getHeight()
Gets the image height.
getHeight
in interface IObjectWithBounds
getHeight
in class Image
public int getWidth()
Gets the image width.
getWidth
in interface IObjectWithBounds
getWidth
in class Image
public IFrame[] getBlocks()
Gets the Webp blocks.
public boolean hasAlpha()
Gets a value indicating whether this instance has alpha.
hasAlpha
in class RasterImage
true
if this instance has alpha; otherwise, false
.public float getImageOpacity()
Gets opacity of this image.
getImageOpacity
in class RasterImage
public long getFileFormat()
Gets a value of file format
getFileFormat
in class Image
public void adjustBrightness(int brightness)
Adjust of a brightness
for image.
adjustBrightness
in class RasterCachedImage
brightness
- Brightness value.public void adjustContrast(float contrast)
Image
contrasting
adjustContrast
in class RasterCachedImage
contrast
- Contrast value (in range [-100; 100])public void adjustGamma(float gammaRed, float gammaGreen, float gammaBlue)
Gamma-correction of an image.
adjustGamma
in class RasterCachedImage
gammaRed
- Gamma for red channel coefficientgammaGreen
- Gamma for green channel coefficientgammaBlue
- Gamma for blue channel coefficientpublic void adjustGamma(float gamma)
Gamma-correction of an image.
adjustGamma
in class RasterCachedImage
gamma
- Gamma for red, green and blue channels coefficientpublic void binarizeFixed(byte threshold)
Binarization of an image with predefined threshold
binarizeFixed
in class RasterCachedImage
threshold
- Threshold value. If corresponding gray value of a pixel is greater than threshold, a value of 255 will be assigned to it, 0 otherwise.public void binarizeBradley(double brightnessDifference)
Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding
binarizeBradley
in class RasterCachedImage
brightnessDifference
- The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.public void binarizeOtsu()
Binarization of an image with Otsu thresholding
binarizeOtsu
in class RasterCachedImage
public void crop(Rectangle rectangle)
Cropping the image.
crop
in class RasterCachedImage
rectangle
- The rectangle.public void dither(int ditheringMethod, int bitsCount, IColorPalette customPalette)
Performs dithering on the current image.
dither
in class RasterCachedImage
ditheringMethod
- The dithering method.bitsCount
- The final bits count for dithering.customPalette
- The custom palette for dithering.public void grayscale()
Transformation of an image to its grayscale representation
grayscale
in class RasterCachedImage
public void rotate(float angle, boolean resizeProportionally, Color backgroundColor)
WebPImage.Rotate
image around the center.
rotate
in class RasterCachedImage
angle
- The rotate angle in degrees. Positive values will rotate clockwise.resizeProportionally
- if set to true
you will have your image size changed
according to rotated rectangle (corner points) projections in other
case that leaves dimensions untouched and only
image contents are rotated.backgroundColor
- Color of the background.public void resize(int newWidth, int newHeight, int resizeType)
Resizes the image.
resize
in class RasterCachedImage
newWidth
- The new width.newHeight
- The new height.resizeType
- The resize type.public void resize(int newWidth, int newHeight, ImageResizeSettings settings)
Resizes the image.
resize
in class RasterCachedImage
newWidth
- The new width.newHeight
- The new height.settings
- The resize settings.public void addBlock(IFrame block)
Adds a new Webp block.
block
- The Webp block to add.public void clearBlocks()
Clears all the Webp blocks.
public void insertBlock(int index, IFrame block)
Adds a new Webp block.
index
- The zero-based element, at which block
will be
inserted.block
- The Webp block to add.public void removeBlock(IFrame block)
Removes the Webp block.
block
- The block to remove.
Note: do not forget to Dispose the block
if you
will not add it to some other WebPImage.
public void rotateFlipAll(int rotateFlip)
Rotates the flip all frames in the image.
rotateFlip
- The rotate flip type to perform.public void filter(Rectangle rectangle, FilterOptionsBase options)
Filters the specified rectangle.
filter
in class RasterImage
rectangle
- The rectangle.options
- The options.public void replaceColor(int oldColorArgb, byte oldColorDiff, int newColorArgb)
Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
replaceColor
in class RasterImage
oldColorArgb
- Old color ARGB value to be replaced.oldColorDiff
- Allowed difference in old color to be able to widen replaced color tone.newColorArgb
- New color ARGB value to replace old color with.public void replaceNonTransparentColors(int newColorArgb)
Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges. Note: if you use it on images without transparency, all colors will be replaced with a single one.
replaceNonTransparentColors
in class RasterImage
newColorArgb
- New color ARGB value to replace non transparent colors with.Copyright (c) 2008-2018 Aspose Pty Ltd. All Rights Reserved.