public final class TiffImage extends RasterImage
The tiff image.
Constructor and Description |
---|
TiffImage(TiffFrame frame)
Initializes a new instance of the
TiffImage class. |
TiffImage(TiffFrame[] frames)
Initializes a new instance of the
TiffImage class. |
Modifier and Type | Method and Description |
---|---|
void |
add(TiffImage image)
Adds the specified image's frames to current frame.
|
void |
addFrame(TiffFrame frame)
Adds the frame to image
|
void |
addFrames(TiffFrame[] frames)
Adds the frames array to image
|
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 |
alignResolutions()
Helper method to make horizontal and vertical resolutions equal.
|
void |
binarizeBradley(double brightnessDifference,
int windowSize)
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 |
crop(int leftShift,
int rightShift,
int topShift,
int bottomShift)
Crop image with shifts.
|
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.
|
TiffFrame |
getActiveFrame()
Gets or sets the active frame.
|
Color |
getBackgroundColor()
Gets or sets a value for the background color.
|
int |
getBitsPerPixel()
Gets the image bits per pixel value of current frame.
|
int |
getByteOrder()
Gets or sets a value indicating the tiff byte order.
|
ExifData |
getExifData()
Gets or sets EXIF data for the active frame.
|
long |
getFileFormat()
Gets a value of file format
|
TiffFrame[] |
getFrames()
Gets Frames array of the image.
|
int |
getHeight()
Gets the image height.
|
double |
getHorizontalResolution()
Gets the horizontal resolution, in pixels per inch, of this
Image . |
float |
getImageOpacity()
Gets opacity of this image (active frame).
|
boolean |
getPremultiplyComponents()
Gets or sets a value indicating whether components must be premultiplied.
|
double |
getVerticalResolution()
Gets the vertical resolution, in pixels per inch, of this
Image . |
int |
getWidth()
Gets the image width.
|
XmpPacketWrapper |
getXmpData()
Gets or sets XMP data from frame.
|
void |
grayscale()
Transformation of an image to its grayscale representation
|
boolean |
hasAlpha()
Gets a value indicating whether this instance has alpha.
|
boolean |
hasTransparentColor()
Gets a value indicating whether image has transparent color.
|
void |
insertFrame(int index,
TiffFrame frameToInsert)
The insert frame.
|
boolean |
isCached()
Gets a value indicating whether object's data is cached currently and no data reading is required.
|
TiffFrame |
removeFrame(int index)
Removes the frame by its index.
|
void |
removeFrame(TiffFrame frame)
Removes the specified frame.
|
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.
|
TiffFrame |
replaceFrame(int index,
TiffFrame frameToReplace)
Replaces the frame at the specified position.
|
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 |
resizeHeightProportionally(int newHeight,
int resizeType)
Resizes the height proportionally.
|
void |
resizeProportional(int newWidth,
int newHeight,
int resizeType)
Performs proportional resize on the image.
|
void |
resizeWidthProportionally(int newWidth,
int resizeType)
Resizes the width proportionally.
|
void |
rotate(float angle,
boolean resizeProportionally,
Color backgroundColor)
Rotate image around the center.
|
void |
rotateFlip(int rotateFlipType)
Rotates, flips, or rotates and flips the Active frame only.
|
void |
rotateFlipAll(int rotateFlip)
Rotates the flip all frames in image.
|
void |
setActiveFrame(TiffFrame value)
Gets or sets the active frame.
|
void |
setBackgroundColor(Color value)
Gets or sets a value for the background color.
|
void |
setByteOrder(int value)
Gets or sets a value indicating the tiff byte order.
|
void |
setExifData(ExifData value)
Gets or sets EXIF data for the active frame.
|
void |
setHorizontalResolution(double value)
Gets the horizontal resolution, in pixels per inch, of this
Image . |
void |
setPremultiplyComponents(boolean value)
Gets or sets a value indicating whether components must be premultiplied.
|
void |
setResolution(double dpiX,
double dpiY)
Sets the resolution for this
RasterImage . |
void |
setTransparentColor(boolean value)
Gets a value indicating whether image has transparent color.
|
void |
setVerticalResolution(double value)
Gets the vertical resolution, in pixels per inch, of this
Image . |
void |
setXmpData(XmpPacketWrapper value)
Gets or sets XMP data from frame.
|
binarizeBradley, dither, getArgb32Pixel, getDefaultArgb32Pixels, getDefaultPixels, getDefaultRawData, getDefaultRawData, getModifyDate, getPixel, getRawCustomColorConverter, getRawDataFormat, getRawDataSettings, getRawFallbackIndex, getRawIndexedColorConverter, getRawLineSize, getTransparentColor, getUpdateXmpData, getUseRawData, isRawDataAvailable, loadArgb32Pixels, loadArgb64Pixels, loadCmyk32Pixels, loadCmykPixels, loadPartialArgb32Pixels, loadPartialPixels, loadPixels, loadRawData, loadRawData, readArgb32ScanLine, readScanLine, replaceColor, replaceNonTransparentColors, rotate, saveArgb32Pixels, saveCmyk32Pixels, saveCmykPixels, savePixels, saveRawData, setArgb32Pixel, setPalette, setPixel, setRawCustomColorConverter, setRawFallbackIndex, setRawIndexedColorConverter, setTransparentColor, setUpdateXmpData, setUseRawData, toBitmap, writeArgb32ScanLine, writeScanLine
canLoad, canLoad, canLoad, canLoad, canSave, create, getBounds, getContainer, getDefaultOptions, getFileFormat, getFileFormat, getFittingRectangle, getFittingRectangle, getInterruptMonitor, getOriginalOptions, getPalette, getProportionalHeight, getProportionalWidth, getSize, hasBackgroundColor, isAutoAdjustPalette, load, load, load, load, load, load, resize, resizeHeightProportionally, resizeHeightProportionally, resizeWidthProportionally, resizeWidthProportionally, save, save, save, save, save, save, save, setAutoAdjustPalette, setBackgroundColor, setInterruptMonitor, setPalette
getDataStreamContainer, save, save, save, save
close, dispose, getDisposed
public TiffImage(TiffFrame frame)
Initializes a new instance of the TiffImage
class.
frame
- The tiff frame to initialize image with.com.aspose.ms.System.ArgumentNullException
- Tiff frame cannot be empty.;framepublic TiffImage(TiffFrame[] frames)
Initializes a new instance of the TiffImage
class.
frames
- The frames.com.aspose.ms.System.ArgumentNullException
- framespublic boolean hasAlpha()
Gets a value indicating whether this instance has alpha.
hasAlpha
in class RasterImage
true
if this instance has alpha; otherwise, false
.public boolean hasTransparentColor()
Gets a value indicating whether image has transparent color.
hasTransparentColor
in class RasterImage
public void setTransparentColor(boolean value)
Gets a value indicating whether image has transparent color.
setTransparentColor
in class RasterImage
value
- a value indicating whether image has transparent color.public long getFileFormat()
Gets a value of file format
getFileFormat
in class Image
public boolean getPremultiplyComponents()
Gets or sets a value indicating whether components must be premultiplied.
getPremultiplyComponents
in class RasterImage
true
if components must be premultiplied; otherwise, false
.public void setPremultiplyComponents(boolean value)
Gets or sets a value indicating whether components must be premultiplied.
setPremultiplyComponents
in class RasterImage
value
- true
if components must be premultiplied; otherwise, false
.public int getByteOrder()
Gets or sets a value indicating the tiff byte order.
public void setByteOrder(int value)
Gets or sets a value indicating the tiff byte order.
value
- The tiff byte order.public double getHorizontalResolution()
Gets the horizontal resolution, in pixels per inch, of this Image
.
getHorizontalResolution
in class RasterImage
Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.
public void setHorizontalResolution(double value)
Gets the horizontal resolution, in pixels per inch, of this Image
.
setHorizontalResolution
in class RasterImage
value
- The horizontal resolution.
Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.
public double getVerticalResolution()
Gets the vertical resolution, in pixels per inch, of this Image
.
getVerticalResolution
in class RasterImage
Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.
public void setVerticalResolution(double value)
Gets the vertical resolution, in pixels per inch, of this Image
.
setVerticalResolution
in class RasterImage
value
- The vertical resolution.
Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.
public Color getBackgroundColor()
Gets or sets a value for the background color.
getBackgroundColor
in class Image
public void setBackgroundColor(Color value)
Gets or sets a value for the background color.
setBackgroundColor
in class Image
public int getBitsPerPixel()
Gets the image bits per pixel value of current frame.
getBitsPerPixel
in class Image
public TiffFrame getActiveFrame()
Gets or sets the active frame.
public void setActiveFrame(TiffFrame value)
Gets or sets the active frame.
value
- Active frame.public TiffFrame[] getFrames()
Gets Frames array of the 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 final boolean isCached()
Gets a value indicating whether object's data is cached currently and no data reading is required.
isCached
in class DataStreamSupporter
true
if object's data is cached; otherwise, false
.public ExifData getExifData()
Gets or sets EXIF data for the active frame.
public void setExifData(ExifData value)
Gets or sets EXIF data for the active frame.
public float getImageOpacity()
Gets opacity of this image (active frame).
getImageOpacity
in class RasterImage
public XmpPacketWrapper getXmpData()
Gets or sets XMP data from frame.
getXmpData
in class RasterImage
public void setXmpData(XmpPacketWrapper value)
Gets or sets XMP data from frame.
setXmpData
in class RasterImage
value
- XMP packet data wrapperpublic void alignResolutions()
Helper method to make horizontal and vertical resolutions equal.
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 void setResolution(double dpiX, double dpiY)
Sets the resolution for this RasterImage
.
setResolution
in class RasterImage
dpiX
- The horizontal resolution, in dots per inch, of the RasterImage
.dpiY
- The vertical resolution, in dots per inch, of the RasterImage
.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 rotateFlip(int rotateFlipType)
Rotates, flips, or rotates and flips the Active frame only.
rotateFlip
in class Image
rotateFlipType
- The rotate flip type.public void rotateFlipAll(int rotateFlip)
Rotates the flip all frames in image.
rotateFlip
- 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 addFrame(TiffFrame frame)
Adds the frame to image
frame
- The frame to add.public void add(TiffImage image)
Adds the specified image's frames to current frame.
image
- The source image.public void addFrames(TiffFrame[] frames)
Adds the frames array to image
frames
- The frames array to addpublic void insertFrame(int index, TiffFrame frameToInsert)
The insert frame.
index
- Index of new frame in list of framesframeToInsert
- The frame To Insert.public final TiffFrame replaceFrame(int index, TiffFrame frameToReplace)
Replaces the frame at the specified position.
index
- The zero based frame position.frameToReplace
- The frame to replace.
public TiffFrame removeFrame(int index)
Removes the frame by its index.
index
- Index of frame to be removed.
Note: do not forget to Dispose the frame if you will not add it to some other TiffImage.
public void removeFrame(TiffFrame frame)
Removes the specified frame.
frame
- The frame to remove.
Note: do not forget to Dispose the frame if you will not add it to some other TiffImage.
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.
resize
in class RasterImage
newWidth
- The new width.newHeight
- The new height.settings
- The resize settings.public void resizeWidthProportionally(int newWidth, int resizeType)
Resizes the width proportionally.
resizeWidthProportionally
in class Image
newWidth
- The new width.resizeType
- Type of the resize.public void resizeHeightProportionally(int newHeight, int resizeType)
Resizes the height proportionally.
resizeHeightProportionally
in class Image
newHeight
- The new height.resizeType
- Type of the resize.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, int windowSize)
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.windowSize
- The size of s x s window of pixels centered around this pixelpublic void crop(int leftShift, int rightShift, int topShift, int bottomShift)
Crop image with shifts.
crop
in class RasterImage
leftShift
- The left shift.rightShift
- The right shift.topShift
- The top shift.bottomShift
- The bottom shift.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 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.