public class PngImage extends RasterCachedImage
The new png image.
RasterCachedImage.RotateTestMode
Constructor and Description |
---|
PngImage(InputStream stream)
Initializes a new instance of the
PngImage class. |
PngImage(int width,
int height)
Initializes a new instance of the
PngImage class. |
PngImage(int width,
int height,
int colorType)
Initializes a new instance of the
PngImage class. |
PngImage(PngOptions pngOptions,
int width,
int height)
Initializes a new instance of the
PngImage class. |
PngImage(RasterImage rasterImage)
Initializes a new instance of the
PngImage class. |
PngImage(RasterImage rasterImage,
int colorType)
Initializes a new instance of the
PngImage class. |
PngImage(String path)
Initializes a new instance of the
PngImage class. |
PngImage(String path,
int colorType)
Initializes a new instance of the
PngImage class. |
Modifier and Type | Method and Description |
---|---|
Color |
getBackgroundColor()
Gets the background color.
|
int |
getBitsPerPixel()
Gets the bits per pixel.
|
ImageOptionsBase |
getDefaultOptions(Object[] args)
Gets the default options.
|
long |
getFileFormat()
Gets a value of file format
|
int |
getHeight()
Gets the height.
|
double |
getHorizontalResolution()
Gets or sets the horizontal resolution.
|
boolean |
getInterlaced()
Gets a value indicating whether this
PngImage is interlaced. |
ImageOptionsBase |
getOriginalOptions()
Gets the options based on the original file settings.
|
PixelDataFormat |
getRawDataFormat()
Gets the raw data format.
|
Color |
getTransparentColor()
Gets the transparent color.
|
double |
getVerticalResolution()
Gets or sets the vertical resolution.
|
int |
getWidth()
Gets the width.
|
XmpPacketWrapper |
getXmpData()
Gets or sets the XMP metadata.
|
boolean |
hasAlpha()
Get a value indicating whether this instance has alpha.
|
boolean |
hasBackgroundColor()
Gets a value indicating whether has background color.
|
boolean |
hasTransparentColor()
Gets a value indicating whether image has transparent color.
|
void |
setBackgroundColor(boolean value)
Gets a value indicating whether has background color.
|
void |
setBackgroundColor(Color value)
Gets the background color.
|
void |
setHorizontalResolution(double value)
Gets or sets the horizontal resolution.
|
void |
setTransparentColor(boolean value)
Gets a value indicating whether image has transparent color.
|
void |
setTransparentColor(Color value)
Gets the transparent color.
|
void |
setVerticalResolution(double value)
Gets or sets the vertical resolution.
|
void |
setXmpData(XmpPacketWrapper value)
Gets or sets the XMP metadata.
|
adjustBrightness, adjustContrast, adjustGamma, adjustGamma, binarizeBradley, binarizeFixed, binarizeOtsu, cacheData, crop, dither, getMaxAllowedAllocationForPartialRotateSave, getRotateMode, grayscale, isCached, resize, resize, rotate, rotateFlip, setMaxAllowedAllocationForPartialRotateSave, setRotateMode
crop, dither, filter, getArgb32Pixel, getDefaultArgb32Pixels, getDefaultPixels, getDefaultRawData, getDefaultRawData, getImageOpacity, getModifyDate, getPixel, getPremultiplyComponents, getRawCustomColorConverter, getRawDataSettings, getRawFallbackIndex, getRawIndexedColorConverter, getRawLineSize, getUpdateXmpData, getUseRawData, isRawDataAvailable, loadArgb32Pixels, loadCmyk32Pixels, loadCmykPixels, loadPartialArgb32Pixels, loadPartialPixels, loadPixels, loadRawData, loadRawData, readArgb32ScanLine, readScanLine, replaceColor, replaceColor, replaceNonTransparentColors, replaceNonTransparentColors, rotate, saveArgb32Pixels, saveCmyk32Pixels, saveCmykPixels, savePixels, saveRawData, setArgb32Pixel, setPalette, setPixel, setPremultiplyComponents, setRawCustomColorConverter, setRawFallbackIndex, setRawIndexedColorConverter, setResolution, setUpdateXmpData, setUseRawData, toBitmap, writeArgb32ScanLine, writeScanLine
canLoad, canLoad, canLoad, canLoad, canSave, create, getBounds, getContainer, getFileFormat, getFileFormat, getFittingRectangle, getFittingRectangle, getInterruptMonitor, getPalette, getProportionalHeight, getProportionalWidth, getSize, isAutoAdjustPalette, load, load, load, load, load, load, resize, resizeHeightProportionally, resizeHeightProportionally, resizeHeightProportionally, resizeWidthProportionally, resizeWidthProportionally, resizeWidthProportionally, save, save, save, save, save, save, save, setAutoAdjustPalette, setInterruptMonitor, setPalette
getDataStreamContainer, save, save, save, save
close, dispose, getDisposed
public PngImage(int width, int height)
Initializes a new instance of the PngImage
class.
width
- The width.height
- The height.public PngImage(String path)
Initializes a new instance of the PngImage
class.
path
- The path to load an image.public PngImage(RasterImage rasterImage)
Initializes a new instance of the PngImage
class.
rasterImage
- The raster image.public PngImage(String path, int colorType)
Initializes a new instance of the PngImage
class.
path
- The path to load an image.colorType
- The color type.com.aspose.ms.System.ArgumentNullException
- if path is nullpublic PngImage(RasterImage rasterImage, int colorType)
Initializes a new instance of the PngImage
class.
rasterImage
- The raster image.colorType
- The color type.public PngImage(InputStream stream)
Initializes a new instance of the PngImage
class.
stream
- The stream to load an image.public PngImage(int width, int height, int colorType)
Initializes a new instance of the PngImage
class.
width
- The width.height
- The height.colorType
- The color type.public PngImage(PngOptions pngOptions, int width, int height)
Initializes a new instance of the PngImage
class.
pngOptions
- The png options.width
- The width.height
- The height.public int getBitsPerPixel()
Gets the bits per pixel.
getBitsPerPixel
in class Image
public int getHeight()
Gets the height.
getHeight
in interface IObjectWithBounds
getHeight
in class Image
public double getHorizontalResolution()
Gets or sets the horizontal resolution.
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 or sets the horizontal resolution.
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 long getFileFormat()
Gets a value of file format
getFileFormat
in class Image
public PixelDataFormat getRawDataFormat()
Gets the raw data format.
getRawDataFormat
in class RasterImage
public double getVerticalResolution()
Gets or sets the vertical resolution.
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 or sets the vertical resolution.
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 int getWidth()
Gets the width.
getWidth
in interface IObjectWithBounds
getWidth
in class Image
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
public boolean hasAlpha()
Get a value indicating whether this instance has alpha.
Value:true
if this instance has alpha; otherwise, false
.hasAlpha
in class RasterImage
true
if this instance has alpha; otherwise, false
.public Color getTransparentColor()
Gets the transparent color.
getTransparentColor
in class RasterImage
public void setTransparentColor(Color value)
Gets the transparent color.
setTransparentColor
in class RasterImage
public boolean hasBackgroundColor()
Gets a value indicating whether has background color.
hasBackgroundColor
in class Image
public void setBackgroundColor(boolean value)
Gets a value indicating whether has background color.
setBackgroundColor
in class Image
public Color getBackgroundColor()
Gets the background color.
getBackgroundColor
in class Image
public void setBackgroundColor(Color value)
Gets the background color.
setBackgroundColor
in class Image
public boolean getInterlaced()
Gets a value indicating whether this PngImage
is interlaced.
true
if interlaced; otherwise, false
.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
value
- The XMP metadata.public ImageOptionsBase getDefaultOptions(Object[] args)
Gets the default options.
getDefaultOptions
in class Image
args
- The arguments.public ImageOptionsBase getOriginalOptions()
Gets the options based on the original file settings.
This can be helpful to keep bit-depth and other parameters of the original image unchanged.
For example, if we load a black-white PNG image with 1 bit per pixel and then save it using the
DataStreamSupporter.Save(string)
method, the output PNG image with 8-bit per pixel will be produced.
To avoid it and save PNG image with 1-bit per pixel, use this method to get corresponding saving options and pass them
to the Image.Save(string, ImageOptionsBase)
method as the second parameter.
getOriginalOptions
in class Image
Copyright (c) 2008-2018 Aspose Pty Ltd. All Rights Reserved.