image library
The Dart Image Library provides the ability to load, save, and manipulate images in a variety of image file formats.
Classes
- BinaryQuantizer
- BitmapFont
- A bitmap font that can be used with drawString and drawChar functions.
- BitmapFontCharacter
- A single character in a BitmapFont.
- BmpDecoder
- BmpEncoder
- Encode a BMP image.
- ChannelIterator
- An iterator over the channels of a Color.
- Color
- The abstract Color class is the base class for all specific color classes and Pixel classes. Colors are iterable, iterating over its channels.
- ColorFloat16
- A 16-bit floating point color.
- ColorFloat32
- A 32-bit floating point color.
- ColorFloat64
- A 64-bit floating point color.
- ColorInt16
- A 16-bit integer color.
- ColorInt32
- A 32-bit integer color.
- ColorInt8
- A 8-bit integer color.
- ColorRgb8
- ColorRgba8
- ColorUint1
- A 1-bit unsigned int color with channel values in the range [0, 1].
- ColorUint16
- A 16-bit unsigned int color with channel values in the range [0, 65535].
- ColorUint2
- A 2-bit unsigned int color with channel values in the range [0, 3].
- ColorUint32
- A 32-bit unsigned int color.
- ColorUint4
- A 4-bit unsigned int color with channel values in the range [0, 15].
- ColorUint8
- An 8-bit unsigned int color with channel values in the range [0, 255].
- Command
- Base class for commands that create, load, manipulate, and save images. Commands are not executed until either the execute or executeThread methods are called.
- DecodeInfo
- Provides information about the image being decoded.
- Decoder
- Base class for image format decoders.
- DibDecoder
- Encoder
- Base class for image format encoders.
- ExifData
- Stores EXIF data for an Image.
- ExifTag
- ExrDecoder
- Decode an OpenEXR formatted image.
- ExrImage
- Float16
- A 16-bit floating-point number, used by high-dynamic-range image formats as a more efficient storage for floating-point values that don't require full 32-bit precision. A list of Half floats can be stored in a Uint16List, and converted to a double using the float16ToDouble static method.
- GifColorMap
- GifDecoder
- A decoder for the GIF image format. This supports both single frame and animated GIF files, and transparency.
- GifEncoder
- GifImageDesc
- GifInfo
- IccProfile
- ICC Profile data stored with an image.
- IcoBmpInfo
- IcoDecoder
- Decodes an ICO formatted Image. Note that ICO files are always decoded to rgba8 32-bit Images in order to support how they encode transparency.
- IcoInfo
- IcoInfoImage
- IfdByteValue
- IfdContainer
- An EXIF container of one or more named EXIF IFD directories.
- IfdDirectory
- An EXIF IfdDirectory stores a collection of IFD tags and values.
- IfdValue
- IfdValueAscii
- IfdValueDouble
- IfdValueLong
- IfdValueRational
- IfdValueSByte
- IfdValueShort
- IfdValueSingle
- IfdValueSLong
- IfdValueSRational
- IfdValueSShort
- IfdValueUndefined
- Image
- An Image is a container for ImageData and other various meta-data representing an image in memory.
- ImageData
- ImageDataFloat16
- ImageDataFloat32
- ImageDataFloat64
- ImageDataInt16
- ImageDataInt32
- ImageDataInt8
- ImageDataUint1
- ImageDataUint16
- ImageDataUint2
- ImageDataUint32
- ImageDataUint4
- ImageDataUint8
- InputBuffer
- A buffer that can be read as a stream of bytes.
- JpegAdobe
- JpegComponent
- JpegData
- JpegDecoder
- Decode a jpeg encoded image.
- JpegEncoder
- Encode an image to the JPEG format.
- JpegFrame
- JpegInfo
- JpegJfif
- JpegScan
- NeuralQuantizer
- Compute a color map with a given number of colors that best represents the given image.
- OctreeQuantizer
- OutputBuffer
- Palette
- PaletteFloat16
- PaletteFloat32
- PaletteFloat64
- PaletteInt16
- PaletteInt32
- PaletteInt8
- PaletteUint16
- PaletteUint32
- PaletteUint8
- PaletteUndefined
- Pixel
- PixelFloat16
- PixelFloat32
- PixelFloat64
- PixelInt16
- PixelInt32
- PixelInt8
- PixelRangeIterator
- PixelUint1
- PixelUint16
- PixelUint2
- PixelUint32
- PixelUint4
- PixelUint8
- PixelUndefined
- Represents an invalid pixel.
- PngColorType
- PngDecoder
- Decode a PNG encoded image.
- PngEncoder
- Encode an image to the PNG format.
- PngFrame
- PngInfo
- PngPhysicalPixelDimensions
- The intended physical pixel size of the image. See www.w3.org/TR/png-3/#11pHYs.
- PnmDecoder
- Decode a PNM image.
- PnmInfo
- Point
- 2-dimensional point
- PsdDecoder
- Decode a Photoshop PSD image.
- PsdImage
- Pvr2Info
- Pvr3Info
- PvrAppleInfo
- PvrDecoder
- PvrEncoder
- Quantizer
- Abstract class for color quantizers, which reduce the total number of colors used by an image to a given maximum, used to convert images to palette images.
- SeparableKernel
- A kernel object to use with separableConvolution filtering.
- TgaDecoder
- Decode a TGA image. This only supports the 24-bit and 32-bit uncompressed format.
- TgaEncoder
- Encode a TGA image. This only supports the 24-bit uncompressed format.
- TgaInfo
- TiffCompression
- TiffDecoder
- TiffEncoder
- Encode am Image to the TIFF format.
- TiffImage
- TiffInfo
- Trim
- WebPDecoder
- Decode a WebP formatted image. This supports lossless (vp8l), lossy (vp8), lossy+alpha, and animated WebP images.
- WebPInfo
- Features gathered from the bitstream
Enums
- BlendMode
- Channel
- A channel of a color
- ChannelOrder
- Ordering of the channels in a pixel, used with Image.fromBytes and Image.getBytes to support alternative channel ordering.
- ContrastMode
- DitherKernel
- The pattern to use for dithering
- ExpandCanvasPosition
- FlipDirection
- Format
- The format of a color or image.
- FormatType
- FrameType
- The type of image this frame represents. Multi-page formats, such as Tiff, can represent the frames of an animation as pages in a document.
- IccProfileCompression
- IcoType
- IfdValueType
- ImageFormat
- Interpolation
- Interpolation method to use when resizing images.
- JpegChroma
- JPEG Chroma (sub)sampling format.
- NoiseType
- PixelateMode
- PngBlendMode
- PngDisposeMode
- PngFilter
- PngFilterType
- PnmFormat
- PsdColorMode
- PvrFormat
- QuantizeMethod
- QuantizerType
- SolarizeMode
- TgaImageType
- TiffFormat
- TiffImageType
- TiffPhotometricType
- TrimMode
- WebPFormat
Constants
-
channelOrderLength
→ const Map<
ChannelOrder, int> - The number of channels for each ChannelOrder.
-
exifTagNameToID
→ const Map<
String, int> -
formatMaxValue
→ const Map<
Format, int> -
formatSize
→ const Map<
Format, int> -
formatToFormatType
→ const Map<
Format, FormatType> -
ifdValueTypeSize
→ const List<
int>
Properties
- arial14 → BitmapFont
-
14px Arial font for use with drawString and drawChar.
final
- arial24 → BitmapFont
-
24px Arial font for use with drawString and drawChar.
final
- arial48 → BitmapFont
-
48px Arial font for use with drawString and drawChar.
final
-
exifGpsTags
→ Map<
int, ExifTag> -
final
-
exifImageTags
→ Map<
int, ExifTag> -
final
-
exifInteropTags
→ Map<
int, ExifTag> -
final
Functions
-
adjustColor(
Image src, {Color? blacks, Color? whites, Color? mids, num? contrast, num? saturation, num? brightness, num? gamma, num? exposure, num? hue, num amount = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Adjust the color of the
src
image using various color transformations. -
bakeOrientation(
Image image) → Image -
If
image
has an orientation value in its exif data, this will rotate the image so that it physically matches its orientation. This can be used to bake the orientation of the image for image formats that don't support exif data. -
billboard(
Image src, {num grid = 10, num amount = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image - Apply the billboard filter to the image.
-
bleachBypass(
Image src, {num amount = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
bulgeDistortion(
Image src, {int? centerX, int? centerY, num? radius, num scale = 0.5, Interpolation interpolation = Interpolation.nearest, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
bumpToNormal(
Image src, {num strength = 2.0}) → Image - Generate a normal map from a heightfield bump image.
-
chromaticAberration(
Image src, {int shift = 5, Image? mask, Channel maskChannel = Channel.luminance}) → Image - Apply chromatic aberration filter to the image.
-
clipLine(
List< int> line, List<int> rect) → bool -
Clip a line to a rectangle using the Cohen–Sutherland clipping algorithm.
line
is a list of 4 ints <x1, y1, x2, y2>.rect
is a list of 4 ints <x1, y1, x2, y2>. Results are stored inline
. Ifline
falls completely outside ofrect
, false is returned, otherwise true is returned. -
cmykToRgb(
num c, num m, num y, num k) → List< int> - Convert a CMYK color to RGB, where c, m, y, k values are in the range [0, 255]. Returns a list [r, g, b] with values in the range [0, 255].
-
colorHalftone(
Image src, {num amount = 1, int? centerX, int? centerY, num angle = 180, num size = 5, Image? mask, Channel maskChannel = Channel.luminance}) → Image - Apply color halftone filter to the image.
-
colorOffset(
Image src, {num red = 0, num green = 0, num blue = 0, num alpha = 0, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Add the
red
,green
,blue
andalpha
values to thesrc
image colors, a per-channel brightness. -
compositeImage(
Image dst, Image src, {int? dstX, int? dstY, int? dstW, int? dstH, int? srcX, int? srcY, int? srcW, int? srcH, BlendMode blend = BlendMode.alpha, bool linearBlend = false, bool center = false, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Composite the image
src
onto the imagedst
. -
contrast(
Image src, {required num contrast, Image? mask, Channel maskChannel = Channel.luminance, ContrastMode mode = ContrastMode.proportional}) → Image -
Set the
contrast
level for the imagesrc
. -
convertColor(
Color c, {Color? to, Format? format, int? numChannels, num? alpha}) → Color -
convertFormatValue(
num value, Format from, Format to) → num -
Convert a value from the
from
Format to theto
Format. -
convolution(
Image src, {required List< num> filter, num div = 1.0, num offset = 0.0, num amount = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Apply a 3x3 convolution filter to the
src
image.filter
should be a list of 9 numbers. -
copyCrop(
Image src, {required int x, required int y, required int width, required int height, num radius = 0, bool antialias = true}) → Image -
Returns a cropped copy of
src
. -
copyCropCircle(
Image src, {int? radius, int? centerX, int? centerY, bool antialias = true}) → Image -
Returns a circle cropped copy of
src
, centered atcenterX
andcenterY
and with the givenradius
. Ifradius
is not provided, a radius filling the image will be used. IfcenterX
is not provided, the horizontal mid-point of the image will be used. IfcenterY
is not provided, the vertical mid-point of the image will be used. -
copyExpandCanvas(
Image src, {int? newWidth, int? newHeight, int? padding, ExpandCanvasPosition position = ExpandCanvasPosition.center, Color? backgroundColor, Image? toImage}) → Image -
Returns a copy of the
src
image, where the original image has been placed on a new canvas of specified size at a specified location, and the rest of the canvas is filled with the specified color or transparent if no color is provided. -
copyFlip(
Image src, {required FlipDirection direction}) → Image -
Returns a copy of the
src
image, flipped by the givendirection
. -
copyImageChannels(
Image src, {required Image from, bool scaled = false, Channel? red, Channel? green, Channel? blue, Channel? alpha, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Copy channels from the
from
image to thesrc
image. Ifscaled
is true, then the from image will be scaled to the src image resolution. -
copyRectify(
Image src, {required Point topLeft, required Point topRight, required Point bottomLeft, required Point bottomRight, Interpolation interpolation = Interpolation.nearest, Image? toImage}) → Image -
Returns a copy of the
src
image, where the given rectangle has been mapped to the full image. -
copyResize(
Image src, {int? width, int? height, bool? maintainAspect, Color? backgroundColor, Interpolation interpolation = Interpolation.nearest}) → Image -
Returns a resized copy of the
src
Image. Ifheight
isn't specified, then it will be determined by the aspect ratio ofsrc
andwidth
. Ifwidth
isn't specified, then it will be determined by the aspect ratio ofsrc
andheight
. -
copyResizeCropSquare(
Image src, {required int size, Interpolation interpolation = Interpolation.nearest, num radius = 0, bool antialias = false}) → Image -
Returns a resized and square cropped copy of the
src
image ofsize
size. -
copyRotate(
Image src, {required num angle, Interpolation interpolation = Interpolation.nearest}) → Image -
Returns a copy of the
src
image, rotated byangle
degrees. -
crand(
Random rand) → double - Return a random variable between [-1, 1].
-
createDecoderForFormat(
ImageFormat format) → Decoder? -
Create a Decoder for the given
format
type. -
decodeBmp(
Uint8List bytes) → Image? - Decode a BMP formatted image.
-
decodeBmpFile(
String path) → Future< Image?> - Decode a BMP formatted image from a file. If the platform does not support dart:io, null will be returned.
-
decodeExr(
Uint8List bytes) → Image? - Decode an OpenEXR formatted image. EXR is a high dynamic range format.
-
decodeExrFile(
String path) → Future< Image?> - Decode a EXR formatted image from a file. If the platform does not support dart:io, null will be returned.
-
decodeGif(
Uint8List bytes, {int? frame}) → Image? - Decode a GIF formatted image.
-
decodeGifFile(
String path, {int? frame}) → Future< Image?> - Decode a GIF formatted image from a file. If the platform does not support dart:io, null will be returned.
-
decodeIco(
Uint8List bytes, {int? frame}) → Image? - Decode an ICO image.
-
decodeIcoFile(
String path, {int? frame}) → Future< Image?> - Decode a ICO formatted image from a file. If the platform does not support dart:io, null will be returned.
-
decodeImage(
Uint8List data, {int? frame}) → Image? - Decode the given image file bytes by first identifying the format of the file and using that decoder to decode the file into a single frame Image. WARNING Since this will check the image data against all known decoders, it is much slower than using an explicit decoder.
-
decodeImageFile(
String path, {int? frame}) → Future< Image?> - Decode an image from a file path. For platforms that do not support dart:io, such as the web, this will return null. WARNING Since this will check the image data against all known decoders, it is much slower than using an explicit decoder.
-
decodeJpg(
Uint8List bytes) → Image? - Decode a JPG formatted image.
-
decodeJpgExif(
Uint8List jpeg) → ExifData? - Decode only the ExifData from a JPEG file, returning null if it was unable to.
-
decodeJpgFile(
String path) → Future< Image?> - Decode a JPG formatted image from a file. If the platform does not support dart:io, null will be returned.
-
decodeNamedImage(
String path, Uint8List data, {int? frame}) → Image? - Decodes the given image file bytes, using the filename extension to determine the decoder.
-
decodePng(
Uint8List bytes, {int? frame}) → Image? - Decode a PNG formatted Image.
-
decodePngFile(
String path) → Future< Image?> - Decode a PNG formatted image from a file. If the platform does not support dart:io, null will be returned.
-
decodePnm(
Uint8List bytes) → Image? - Decode a PNM formatted Image.
-
decodePnmFile(
String path) → Future< Image?> - Decode a PNM formatted image from a file.
-
decodePsd(
Uint8List bytes) → Image? - Decode a Photoshop PSD formatted image.
-
decodePsdFile(
String path) → Future< Image?> - Decode a PSD formatted image from a file. If the platform does not support dart:io, null will be returned.
-
decodePvr(
Uint8List bytes, {int? frame}) → Image? - Decode an PVR image.
-
decodePvrFile(
String path, {int? frame}) → Future< Image?> - Decode a PVR formatted image from a file. If the platform does not support dart:io, null will be returned.
-
decodeTga(
Uint8List bytes, {int? frame}) → Image? - Decode a TGA formatted image.
-
decodeTgaFile(
String path) → Future< Image?> - Decode a TGA formatted image from a file. If the platform does not support dart:io, null will be returned.
-
decodeTiff(
Uint8List bytes, {int? frame}) → Image? - Decode a TIFF formatted image.
-
decodeTiffFile(
String path, {int? frame}) → Future< Image?> - Decode a TIFF formatted image from a file. If the platform does not support dart:io, null will be returned.
-
decodeWebP(
Uint8List bytes, {int? frame}) → Image? - Decode a WebP formatted image
-
decodeWebPFile(
String path, {int? frame}) → Future< Image?> - Decode a WebP formatted image from a file. If the platform does not support dart:io, null will be returned.
-
ditherImage(
Image image, {Quantizer? quantizer, DitherKernel kernel = DitherKernel.floydSteinberg, bool serpentine = false}) → Image - Dither an image to reduce banding patterns when reducing the number of colors. Derived from http://jsbin.com/iXofIji/2/edit
-
dotScreen(
Image src, {num angle = 180, num size = 5.75, int? centerX, int? centerY, num amount = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image - Apply the dot screen filter to the image.
-
drawChar(
Image image, String char, {required BitmapFont font, required int x, required int y, Color? color, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Draw a single character from
char
horizontally intoimage
at positionx
,y
with the givencolor
. -
drawCircle(
Image image, {required int x, required int y, required int radius, required Color color, bool antialias = false, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Draw a circle into the
image
with a center ofx
,y
and the givenradius
andcolor
. -
drawLine(
Image image, {required int x1, required int y1, required int x2, required int y2, required Color color, bool antialias = false, num thickness = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Draw a line into
image
. -
drawPixel(
Image image, int x, int y, Color c, {Color? filter, num? alpha, BlendMode blend = BlendMode.alpha, bool linearBlend = false, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Draw a single pixel into the image, applying alpha and opacity blending.
If
filter
is provided, the color c will be scaled by thefilter
color. Ifalpha
is provided, it will be used in place of the color alpha, as a normalized color value [0, 1]. -
drawPolygon(
Image src, {required List< Point> vertices, required Color color, bool antialias = false, num thickness = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Fill a polygon defined by the given
vertices
. -
drawRect(
Image dst, {required int x1, required int y1, required int x2, required int y2, required Color color, num thickness = 1, num radius = 0, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Draw a rectangle in the image
dst
with thecolor
. -
drawString(
Image image, String string, {required BitmapFont font, int? x, int? y, Color? color, bool rightJustify = false, bool wrap = false, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Draw a string horizontally into
image
horizontally intoimage
at positionx
,y
with the givencolor
. Ifx
is not specified, the string will be centered horizontally. Ify
is not specified, the string will be centered vertically. -
dropShadow(
Image src, int hShadow, int vShadow, int blur, {Color? shadowColor}) → Image - Create a drop-shadow effect for the image.
-
edgeGlow(
Image src, {num amount = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Apply the edge glow filter to the
src
Image. -
emboss(
Image src, {num amount = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image - Apply an emboss convolution filter.
-
encodeBmp(
Image image) → Uint8List - Encode an Image to the BMP format.
-
encodeBmpFile(
String path, Image image) → Future< bool> -
Encode an
image
to a TIFF file at the givenpath
. -
encodeCur(
Image image, {bool singleFrame = false}) → Uint8List - Encode an Image to the CUR format.
-
encodeCurFile(
String path, Image image, {bool singleFrame = false}) → Future< bool> -
Encode an
image
to a CUR file at the givenpath
. -
encodeGif(
Image image, {bool singleFrame = false, int repeat = 0, int samplingFactor = 10, DitherKernel dither = DitherKernel.floydSteinberg, bool ditherSerpentine = false}) → Uint8List - Encode an image to the GIF format.
-
encodeGifFile(
String path, Image image, {bool singleFrame = false, int repeat = 0, int samplingFactor = 10, DitherKernel dither = DitherKernel.floydSteinberg, bool ditherSerpentine = false}) → Future< bool> -
Encode an
image
to a GIF file at the givenpath
. -
encodeIco(
Image image, {bool singleFrame = false}) → Uint8List - Encode an image to the ICO format.
-
encodeIcoFile(
String path, Image image, {bool singleFrame = false}) → Future< bool> -
Encode an
image
to a ICO file at the givenpath
. -
encodeImageFile(
String path, Image image) → Future< bool> -
Encode the
image
to a file at the givenpath
. The format of the image file is determined from the extension of the file. If the image was successfully written to the file, true will be returned, otherwise false. For platforms that do not support dart:io, false will be returned. -
encodeJpg(
Image image, {int quality = 100, JpegChroma chroma = JpegChroma.yuv444}) → Uint8List -
Encode an
image
to the JPEG format. -
encodeJpgFile(
String path, Image image, {int quality = 100, JpegChroma chroma = JpegChroma.yuv444}) → Future< bool> -
Encode an
image
to a JPG file at the givenpath
. -
encodeNamedImage(
String path, Image image) → Uint8List? -
Encode the
image
to the format determined by the file extension ofpath
. If a format wasn't able to be identified, null will be returned. Otherwise the encoded format bytes of the image will be returned. -
encodePng(
Image image, {bool singleFrame = false, int level = 6, PngFilter filter = PngFilter.paeth}) → Uint8List - Encode an image to the PNG format.
-
encodePngFile(
String path, Image image, {bool singleFrame = false, int level = 6, PngFilter filter = PngFilter.paeth}) → Future< bool> -
Encode an
image
to a PNG file at the givenpath
. -
encodePvr(
Image image, {bool singleFrame = false}) → Uint8List - Encode an image to the PVR format.
-
encodePvrFile(
String path, Image image, {bool singleFrame = false}) → Future< bool> -
Encode an
image
to a PVR file at the givenpath
. -
encodeTga(
Image image) → Uint8List - Encode an image to the TGA format.
-
encodeTgaFile(
String path, Image image) → Future< bool> -
Encode an
image
to a TGA file at the givenpath
. -
encodeTiff(
Image image, {bool singleFrame = false}) → Uint8List -
encodeTiffFile(
String path, Image image, {bool singleFrame = false}) → Future< bool> -
Encode an
image
to a TIFF file at the givenpath
. -
executeCommandAsync(
Command? command) → Future< ExecuteResult> -
executeCommandBytes(
Command? command) → Uint8List? -
executeCommandBytesAsync(
Command? command) → Future< Uint8List?> -
executeCommandImage(
Command? command) → Image? -
executeCommandImageAsync(
Command? command) → Future< Image?> -
fill(
Image image, {required Color color, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Set all of the pixels of an
image
to the givencolor
. -
fillCircle(
Image image, {required int x, required int y, required int radius, required Color color, bool antialias = false, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Draw and fill a circle into the
image
with a center ofx
,y
and the givenradius
andcolor
. -
fillFlood(
Image src, {required int x, required int y, required Color color, num threshold = 0.0, bool compareAlpha = false, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Fill the 4-connected shape containing
x
,y
in the imagesrc
with the givencolor
. -
fillPolygon(
Image src, {required List< Point> vertices, required Color color, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Fill a polygon defined by the given
vertices
. -
fillRect(
Image src, {required int x1, required int y1, required int x2, required int y2, required Color color, num radius = 0, bool alphaBlend = true, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Fill a rectangle in the image
src
with the givencolor
with the cornersx1
,y1
andx2
,y2
. -
findDecoderForData(
List< int> data) → Decoder? -
Find a Decoder that is able to decode the given image
data
. Use this is you don't know the type of image it is. WARNING Since this will check the image data against all known decoders, it is much slower than using an explicit decoder. -
findDecoderForNamedImage(
String name) → Decoder? -
Return the Decoder that can decode image with the given
name
, by looking at the file extension. -
findEncoderForNamedImage(
String name) → Encoder? -
Return the Encoder that can decode image with the given
name
, by looking at the file extension. -
findFormatForData(
List< int> data) → ImageFormat - Find the ImageFormat for the given file data.
-
findTrim(
Image src, {TrimMode mode = TrimMode.transparent, Trim sides = Trim.all}) → List< int> - Find the crop area to be used by the trim function. Returns the coordinates as [x, y, width, height]. You could pass these coordinates to the copyCrop function to crop the image.
-
flip(
Image src, {required FlipDirection direction}) → Image -
Flips the
src
image using the givendirection
, which can be one of: FlipDirection.horizontal, FlipDirection.vertical, or FlipDirection.both. -
flipHorizontal(
Image src) → Image - Flip the src image horizontally.
-
flipHorizontalVertical(
Image src) → Image - Flip the src image horizontally and vertically.
-
flipVertical(
Image src) → Image -
Flip the
src
image vertically. -
gamma(
Image src, {required num gamma, Image? mask, Channel maskChannel = Channel.luminance}) → Image - Apply gamma scaling
-
gaussianBlur(
Image src, {required int radius, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Apply gaussian blur to the
src
image.radius
determines how many pixels away from the current pixel should contribute to the blur, where 0 is no blur and the larger the radius, the stronger the blur. -
getLuminance(
Color c) → num - Returns the luminance (grayscale) value of the color.
-
getLuminanceNormalized(
Color c) → num - Returns the normalized [0, 1] luminance (grayscale) value of the color.
-
getLuminanceRgb(
num r, num g, num b) → num - Returns the luminance (grayscale) value of the color.
-
getRowStride(
int width, int numChannels, Format format) → int -
grand(
Random rand) → double - Return a random variable following a gaussian distribution and a standard deviation of 1.
-
grayscale(
Image src, {num amount = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image - Convert the image to grayscale.
-
hdrToLdr(
Image hdr, {num? exposure}) → Image - Convert a high dynamic range image to a low dynamic range image, with optional exposure control.
-
hexagonPixelate(
Image src, {int? centerX, int? centerY, int size = 5, num amount = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image - Apply the hexagon pixelate filter to the image.
-
hslToRgb(
num hue, num saturation, num lightness) → List< int> - Convert an HSL color to RGB, where h is specified in normalized degrees [0, 1] (where 1 is 360-degrees); s and l are in the range [0, 1]. Returns a list [r, g, b] with values in the range [0, 255].
-
hsvToRgb(
num hue, num saturation, num brightness) → List< int> - Convert an HSV color to RGB, where h is specified in normalized degrees [0, 1] (where 1 is 360-degrees); s and l are in the range [0, 1]. Returns a list [r, g, b] with values in the range [0, 255].
-
injectJpgExif(
Uint8List jpeg, ExifData exif) → Uint8List? - Inject ExifData into a JPEG file, replacing any existing EXIF data. The new JPEG file bytes will be returned, otherwise null if there was an issue.
-
invert(
Image src, {Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Invert the colors of the
src
image. -
labToRgb(
num l, num a, num b) → List< int> - Convert a CIE-L*ab color to RGB.
-
labToXyz(
num l, num a, num b) → List< int> - Convert a CIE-L*ab color to XYZ.
-
luminanceThreshold(
Image src, {num threshold = 0.5, bool outputColor = false, num amount = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
maskFlood(
Image src, int x, int y, {num threshold = 0.0, bool compareAlpha = false, int fillValue = 255}) → Uint8List -
Create a mask describing the 4-connected shape containing
x
,y
in the imagesrc
. -
minMax(
Image image) → List< num> - Find the minimum and maximum color value in the image. Returns a list as [min, max].
-
monochrome(
Image src, {Color? color, num amount = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
amount
controls the strength of the effect, in the range [0, 1]. -
noise(
Image image, num sigma, {NoiseType type = NoiseType.gaussian, Random? random, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Add random noise to pixel values.
sigma
determines how strong the effect should be.type
should be one of the following: NoiseType.gaussian, NoiseType.uniform, NoiseType.saltAndPepper, NoiseType.poisson, or NoiseType.rice. -
normalize(
Image src, {required num min, required num max, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Linearly normalize the colors of the image. All color values will be mapped
to the range
min
,max
inclusive. -
pixelate(
Image src, {required int size, PixelateMode mode = PixelateMode.upperLeft, num amount = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Pixelate the
src
image. -
prand(
Random rand, double z) → int -
Return a random variable following a Poisson distribution of parameter
z
. -
quantize(
Image src, {int numberOfColors = 256, QuantizeMethod method = QuantizeMethod.neuralNet, DitherKernel dither = DitherKernel.none, bool ditherSerpentine = false}) → Image - Quantize the number of colors in image to 256.
-
readFile(
String path) → Future< Uint8List?> -
readFont(
String font, Image map) → BitmapFont -
Decode a BitmapFont from the contents of
font
definition (.fnt) file, and an Image that stores the fontmap
. -
readFontZip(
List< int> bytes) → BitmapFont - Decode a BitmapFont from the contents of a zip file that stores the .fnt font definition and associated PNG images.
-
reinhardTonemap(
Image hdr, {Image? mask, Channel maskChannel = Channel.luminance}) → Image - Applies Reinhard tone mapping to the hdr image, in-place.
-
remapColors(
Image src, {Channel red = Channel.red, Channel green = Channel.green, Channel blue = Channel.blue, Channel alpha = Channel.alpha}) → Image -
Remap the color channels of the image.
red
,green
,blue
andalpha
should be set to one of the following: Channel.red, Channel.green, Channel.blue, Channel.alpha, or Channel.luminance. For example, remapColors(src, red: Channel.green, green: Channel.red); will swap the red and green channels of the image. remapColors(src, alpha: Channel.luminance) will set the alpha channel to the luminance (grayscale) of the image. -
rgbaToUint32(
int r, int g, int b, int a) → int -
rgbToHsl(
num r, num g, num b) → List< num> - Convert an RGB color to HSL, where r, g and b are in the range [0, 255]. Returns a list [h, s, l] with values in the range [0, 1].
-
rgbToLab(
num r, num g, num b) → List< num> - Convert a RGB color to CIE-L*ab.
-
rgbToXyz(
num r, num g, num b) → List< num> - Convert a RGB color to XYZ.
-
scaleRgba(
Image src, {required Color scale, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
separableConvolution(
Image src, {required SeparableKernel kernel, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Apply a generic separable convolution filter the
src
image, using the givenkernel
. -
sepia(
Image src, {num amount = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image - Apply sepia tone to the image.
-
sketch(
Image src, {num amount = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image - Apply sketch filter to the image.
-
smooth(
Image src, {required num weight, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Apply a smoothing convolution filter to the
src
image. -
sobel(
Image src, {num amount = 1, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Apply Sobel edge detection filtering to the
src
Image. -
solarize(
Image src, {required int threshold, SolarizeMode mode = SolarizeMode.highlights}) → Image -
Solarize the colors of the
src
image. {threshold} should be int from 1 to 254. If {mode} is SolarizeMode.highlights, bright objects become black, otherwise it will solarize shadows. -
stretchDistortion(
Image src, {int? centerX, int? centerY, Interpolation interpolation = Interpolation.nearest, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
supportsFileAccess(
) → bool -
trim(
Image src, {TrimMode mode = TrimMode.topLeftColor, Trim sides = Trim.all}) → Image -
Automatically crops the image by finding the corners of the image that
meet the
mode
criteria (not transparent or a different color). -
uint32ToAlpha(
int c) → int -
uint32ToBlue(
int c) → int -
uint32ToGreen(
int c) → int -
uint32ToRed(
int c) → int -
vignette(
Image src, {num start = 0.3, num end = 0.85, num amount = 0.9, Color? color, Image? mask, Channel maskChannel = Channel.luminance}) → Image -
Apply a vignette filter to the image.
start
is the inner radius from the center of the image, where the fade tocolor
starts to be applied; andend
is the outer radius of the vignette effect where thecolor
is fully applied. The radius values are in normalized percentage of the image size [0, 1].amount
controls the blend of the effect with the original image. -
writeFile(
String path, Uint8List bytes) → Future< bool> -
xyzToLab(
num x, num y, num z) → List< num> - Convert a XYZ color to CIE-L*ab.
-
xyzToRgb(
num x, num y, num z) → List< int> - Convert an XYZ color to RGB.
Exceptions / Errors
- ImageException
- An exception thrown when there was a problem in the image library.