public final class GifImage extends RasterImage
A gif image.
Constructor and Description |
---|
GifImage(GifFrameBlock firstFrame)
Initializes a new instance of the
GifImage class. |
GifImage(GifFrameBlock firstFrame,
IColorPalette globalPalette)
Initializes a new instance of the
GifImage class. |
GifImage(GifFrameBlock firstFrame,
IColorPalette globalPalette,
boolean isPaletteSorted,
byte paletteColorResolution,
byte paletteBackgroundColorIndex,
byte aspectRatio,
boolean hasTrailer)
Initializes a new instance of the
GifImage class. |
Modifier and Type | Method and Description |
---|---|
void |
addBlock(IGifBlock block)
Adds a new GIF 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 |
cacheData()
Caches the data and ensures no additional data loading will be performed from the underlying
DataStreamSupporter.DataStreamContainer . |
void |
clearBlocks()
Clears all the GIF blocks.
|
static GifImage |
createInstance_internalized(com.aspose.imaging_internal.fileformats.gif.GifHeader gifHeader,
IGifBlock[] blocks,
IColorPalette colorPalette,
boolean hasTrailer,
GifFrameBlock activeFrame)
Creates the new instance of the
GifImage class. |
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.
|
GifFrameBlock |
getActiveFrame()
Gets or sets the active frame.
|
Color |
getBackgroundColor()
Gets or sets the background color.
|
byte |
getBackgroundColorIndex()
Gets or sets the background color index.
|
int |
getBitsPerPixel()
Gets the bits per pixel count.
|
IGifBlock[] |
getBlocks()
Gets the GIF blocks.
|
int |
getHeight()
Gets the object height.
|
byte |
getPaletteColorResolutionBits()
Gets or sets the palette color resolution bits.
|
byte |
getPixelAspectRatio()
Gets or sets the pixel aspect ratio.
|
Color |
getTransparentColor()
Gets active frame transparent color.
|
int |
getWidth()
Gets the object width.
|
XmpPacketWrapper |
getXmpData()
Gets or sets the XMP metadata.
|
void |
grayscale()
Transformation of an image to its grayscale representation
|
boolean |
hasBackgroundColor()
Gets a value indicating whether image has background color.
|
boolean |
hasTrailer()
Gets or sets a value indicating whether GIF has trailer.
|
boolean |
hasTransparentColor()
Gets a value indicating whether active frame has transparent color.
|
void |
insertBlock(int index,
IGifBlock block)
Adds a new GIF block.
|
boolean |
isCached()
Gets a value indicating whether object's data is cached currently and no data reading is required.
|
boolean |
isPaletteSorted()
Gets or sets a value indicating whether palette is sorted.
|
void |
orderBlocks()
Orders the GIF blocks according to the GIF specification.
|
void |
removeBlock(IGifBlock block)
Removes the GIF block.
|
void |
resize(int newWidth,
int newHeight,
ImageResizeSettings settings)
Resizes the image with extended options.
|
void |
resize(int newWidth,
int newHeight,
int resizeType)
Resizes the image.
|
void |
resizeProportional(int newWidth,
int newHeight,
int resizeType)
Performs proportional resize on the image.
|
void |
rotate(float angle,
boolean resizeProportionally,
Color backgroundColor)
Rotate image around the center.
|
void |
rotateFlip(int rotateFlipType)
Rotates, flips, or rotates and flips the image.
|
void |
rotateFlipAll(int rotateFlip)
Rotates the flip all frames in the image.
|
void |
setActiveFrame(GifFrameBlock value)
Gets or sets the active frame.
|
void |
setBackgroundColor(Color value)
Gets or sets the background color.
|
void |
setBackgroundColorIndex(byte value)
Gets or sets the background color index.
|
void |
setPaletteColorResolutionBits(byte value)
Gets or sets the palette color resolution bits.
|
void |
setPaletteSorted(boolean value)
Gets or sets a value indicating whether palette is sorted.
|
void |
setPixelAspectRatio(byte value)
Gets or sets the pixel aspect ratio.
|
void |
setTrailer(boolean value)
Gets or sets a value indicating whether GIF has trailer.
|
void |
setTransparentColor(boolean value)
Gets a value indicating whether active frame has transparent color.
|
void |
setXmpData(XmpPacketWrapper value)
Gets or sets the XMP metadata.
|
crop, dither, getArgb32Pixel, getDefaultArgb32Pixels, getDefaultPixels, getDefaultRawData, getDefaultRawData, getHorizontalResolution, getPixel, getRawCustomColorConverter, getRawDataFormat, getRawDataSettings, getRawFallbackIndex, getRawIndexedColorConverter, getRawLineSize, getVerticalResolution, hasAlpha, isRawDataAvailable, loadArgb32Pixels, loadCmykPixels, loadPartialArgb32Pixels, loadPartialPixels, loadPixels, loadRawData, readScanLine, rotate, saveArgb32Pixels, saveCmykPixels, savePixels, saveRawData, setArgb32Pixel, setHorizontalResolution, setPalette, setPixel, setRawCustomColorConverter, setRawFallbackIndex, setRawIndexedColorConverter, setResolution, setTransparentColor, setVerticalResolution, writeScanLine
canLoad, canLoad, canLoad, canLoad, canLoadInternal_internalized, canLoadInternal_internalized, canSave, create, getBounds, getContainer, getFileFormat, getFileFormat, getFileFormatInternal_internalized, getFittingRectangle, getFittingRectangle, getPalette, getProportionalHeight, getProportionalWidth, getSize, getVentureLicense_internalized, load, load, load, load, loadInternal_internalized, loadInternal_internalized, resize, resizeHeightProportionally, resizeHeightProportionally, resizeHeightProportionally, resizeWidthProportionally, resizeWidthProportionally, resizeWidthProportionally, save_internalized, save, save, save, save, save, setBackgroundColor, setContainer_internalized, setPalette, setVentureLicense_internalized
getDataStreamContainer, save_internalized, save, save, save, setDataStreamContainer
close, dispose, getDisposed
public GifImage(GifFrameBlock firstFrame, IColorPalette globalPalette)
Initializes a new instance of the GifImage
class.
firstFrame
- The first frame to initialize gif image with.globalPalette
- The global palette to use. Note if both firstFrame
and globalPalette
are null then default global palette is used.com.aspose.ms.System.ArgumentNullException
- The frame cannot be null;firstFramecom.aspose.ms.System.ArgumentException
- The first frame already belongs to some other image. Check the Container property.;firstFrameGifImageException
- The palette specified should contain entries count equal to power of 2. Minimal palette size is 2, maximal is 256.public GifImage(GifFrameBlock firstFrame)
Initializes a new instance of the GifImage
class.
firstFrame
- The first frame to initialize gif image with.com.aspose.ms.System.ArgumentNullException
- The frame cannot be null;firstFramecom.aspose.ms.System.ArgumentException
- The first frame already belongs to some other image. Check the Container property.;firstFrameGifImageException
- The palette specified should contain entries count equal to power of 2. Minimal palette size is 2, maximal is 256.public GifImage(GifFrameBlock firstFrame, IColorPalette globalPalette, boolean isPaletteSorted, byte paletteColorResolution, byte paletteBackgroundColorIndex, byte aspectRatio, boolean hasTrailer)
Initializes a new instance of the GifImage
class.
firstFrame
- The first frame to initialize gif image with.globalPalette
- The global palette to use. Note if both firstFrame
and globalPalette
are null then default global palette is used.isPaletteSorted
- if set to true
the palette is sorted. Note the parameter is used when globalPalette
is not null.paletteColorResolution
- The palette color resolution. Note the parameter is used when globalPalette
is not null.paletteBackgroundColorIndex
- The palette background color index.aspectRatio
- The aspect ratio.hasTrailer
- if set to true
the gif image has trailer otherwise no trailer written at the end of the stream.com.aspose.ms.System.ArgumentNullException
- The frame cannot be null;firstFramecom.aspose.ms.System.ArgumentException
- The first frame already belongs to some other image. Check the Container property.;firstFrameGifImageException
- The palette specified should contain entries count equal to power of 2. Minimal palette size is 2, maximal is 256.public XmpPacketWrapper getXmpData()
Gets or sets the XMP metadata.
Value: The XMP metadata.getXmpData
in class RasterImage
public void setXmpData(XmpPacketWrapper value)
Gets or sets the XMP metadata.
Value: The XMP metadata.setXmpData
in class RasterImage
public boolean hasTrailer()
Gets or sets a value indicating whether GIF has trailer.
Value:true
if GIF has trailer; otherwise, false
.public void setTrailer(boolean value)
Gets or sets a value indicating whether GIF has trailer.
Value:true
if GIF has trailer; otherwise, false
.public boolean isPaletteSorted()
Gets or sets a value indicating whether palette is sorted.
Value:true
if palette is sorted; otherwise, false
.public void setPaletteSorted(boolean value)
Gets or sets a value indicating whether palette is sorted.
Value:true
if palette is sorted; otherwise, false
.public byte getPaletteColorResolutionBits()
Gets or sets the palette color resolution bits.
Value: The palette color resolution bits.public void setPaletteColorResolutionBits(byte value)
Gets or sets the palette color resolution bits.
Value: The palette color resolution bits.public int getWidth()
Gets the object width.
Value: The object width.getWidth
in interface IObjectWithBounds
getWidth
in class Image
public int getHeight()
Gets the object height.
Value: The object height.getHeight
in interface IObjectWithBounds
getHeight
in class Image
public int getBitsPerPixel()
Gets the bits per pixel count.
Value: The bits per pixel count.For GIF this value is calculated from active frame.
getBitsPerPixel
in class Image
public IGifBlock[] getBlocks()
Gets the GIF blocks.
public GifFrameBlock getActiveFrame()
Gets or sets the active frame.
Value: The active frame.public void setActiveFrame(GifFrameBlock value)
Gets or sets the active frame.
Value: The active frame.public Color getBackgroundColor()
Gets or sets the background color.
Value: The background color.getBackgroundColor
in class Image
public void setBackgroundColor(Color value)
Gets or sets the background color.
Value: The background color.setBackgroundColor
in class Image
public byte getBackgroundColorIndex()
Gets or sets the background color index.
Value: The background color index.public void setBackgroundColorIndex(byte value)
Gets or sets the background color index.
Value: The background color index.public byte getPixelAspectRatio()
Gets or sets the pixel aspect ratio.
Value: The pixel aspect ratio.public void setPixelAspectRatio(byte value)
Gets or sets the pixel aspect ratio.
Value: The pixel aspect ratio.public final boolean isCached()
Gets a value indicating whether object's data is cached currently and no data reading is required.
Value:true
if object's data is cached; otherwise, false
.isCached
in class DataStreamSupporter
public boolean hasTransparentColor()
Gets a value indicating whether active frame has transparent color.
hasTransparentColor
in class RasterImage
public void setTransparentColor(boolean value)
Gets a value indicating whether active frame has transparent color.
setTransparentColor
in class RasterImage
public Color getTransparentColor()
Gets active frame transparent color.
getTransparentColor
in class RasterImage
public boolean hasBackgroundColor()
Gets a value indicating whether image has background color.
hasBackgroundColor
in class Image
public void dither(int ditheringMethod, int bitsCount, IColorPalette customPalette)
Performs dithering on the current image.
dither
in class RasterImage
ditheringMethod
- The dithering method.bitsCount
- The final bits count for dithering.customPalette
- The custom palette for dithering.public final void cacheData()
Caches the data and ensures no additional data loading will be performed from the underlying DataStreamSupporter.DataStreamContainer
.
cacheData
in class DataStreamSupporter
public void rotateFlipAll(int rotateFlip)
Rotates the flip all frames in the image.
rotateFlip
- The rotate flip type to perform.public void orderBlocks()
Orders the GIF blocks according to the GIF specification. Some GifGraphicsControlBlock
may be removed for proper GIF layout.
public void clearBlocks()
Clears all the GIF blocks.
public void insertBlock(int index, IGifBlock block)
Adds a new GIF block.
index
- The zero-based element, at which block will be inserted.block
- The GIF block to add.public void addBlock(IGifBlock block)
Adds a new GIF block.
block
- The GIF block to add.public void removeBlock(IGifBlock block)
Removes the GIF block.
block
- The block to remove.
Note: do not forget to Dispose the block if you will not add it to some other GifImage.
public void rotateFlip(int rotateFlipType)
Rotates, flips, or rotates and flips the image.
rotateFlip
in class Image
rotateFlipType
- The rotate flip type.public void rotate(float angle, boolean resizeProportionally, Color backgroundColor)
Rotate image around the center.
rotate
in class RasterImage
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 internal image contents are rotated.backgroundColor
- Color of the background.public void resize(int newWidth, int newHeight, int resizeType)
Resizes the image.
resize
in class RasterImage
newWidth
- The new width.newHeight
- The new height.resizeType
- The resize type.public void resize(int newWidth, int newHeight, ImageResizeSettings settings)
Resizes the image with extended options.
resize
in class RasterImage
newWidth
- The new width.newHeight
- The new height.settings
- The resize settings.com.aspose.ms.System.ArgumentOutOfRangeException
- newWidth;The new width should be positive number and at least 1.
or
newHeight;The new height should be positive number and at least 1.public void resizeProportional(int newWidth, int newHeight, int resizeType)
Performs proportional resize on the image.
The proportional resize will resize each frame according to the ratio of newWidth
/width and newHeight
/height.
newWidth
- The new width.newHeight
- The new height.resizeType
- The resize type.public void crop(Rectangle rectangle)
Cropping the image.
crop
in class RasterImage
rectangle
- The rectangle.public void grayscale()
Transformation of an image to its grayscale representation
grayscale
in class RasterImage
public void binarizeFixed(byte threshold)
Binarization of an image with predefined threshold
binarizeFixed
in class RasterImage
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 binarizeOtsu()
Binarization of an image with Otsu thresholding
binarizeOtsu
in class RasterImage
public void binarizeBradley(double brightnessDifference)
Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding
binarizeBradley
in class RasterImage
brightnessDifference
- The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.public void adjustBrightness(int brightness)
Adjust of a brightness for image.
adjustBrightness
in class RasterImage
brightness
- Brightness value.public void adjustContrast(float contrast)
Image contrasting
adjustContrast
in class RasterImage
contrast
- Contrast value (in range [-100; 100])public void adjustGamma(float gammaRed, float gammaGreen, float gammaBlue)
Gamma-correction of an image.
adjustGamma
in class RasterImage
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 RasterImage
gamma
- Gamma for red, green and blue channels coefficientpublic void filter(Rectangle rectangle, FilterOptionsBase options)
Filters the specified rectangle.
filter
in class RasterImage
rectangle
- The rectangle.options
- The options.public static GifImage createInstance_internalized(com.aspose.imaging_internal.fileformats.gif.GifHeader gifHeader, IGifBlock[] blocks, IColorPalette colorPalette, boolean hasTrailer, GifFrameBlock activeFrame)
Creates the new instance of the GifImage
class.
gifHeader
- The GIF header.blocks
- The GIF blocks.colorPalette
- The color palette.hasTrailer
- if set to true
GIF has trailer.activeFrame
- The active frame.GifImage
class.Copyright (c) 2008-2016 Aspose Pty Ltd. All Rights Reserved.