diff --git a/vendor/NetVips/Cache.cs b/vendor/NetVips/Cache.cs
new file mode 100644
index 0000000..66e3d1b
--- /dev/null
+++ b/vendor/NetVips/Cache.cs
@@ -0,0 +1,49 @@
+using NetVips.Internal;
+
+namespace NetVips;
+
+///
+/// A class around libvips' operation cache.
+///
+public static class Cache
+{
+ ///
+ /// Gets or sets the maximum number of operations libvips keeps in cache.
+ ///
+ public static int Max
+ {
+ get => Vips.CacheGetMax();
+ set => Vips.CacheSetMax(value);
+ }
+
+ ///
+ /// Gets or sets the maximum amount of tracked memory allowed.
+ ///
+ public static ulong MaxMem
+ {
+ get => Vips.CacheGetMaxMem();
+ set => Vips.CacheSetMaxMem(value);
+ }
+
+ ///
+ /// Gets or sets the maximum amount of tracked files allowed.
+ ///
+ public static int MaxFiles
+ {
+ get => Vips.CacheGetMaxFiles();
+ set => Vips.CacheSetMaxFiles(value);
+ }
+
+ ///
+ /// Gets the current number of operations in cache.
+ ///
+ public static int Size => Vips.CacheGetSize();
+
+ ///
+ /// Enable or disable libvips cache tracing.
+ ///
+ public static bool Trace
+ {
+ set => Vips.CacheSetTrace(value);
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/Connection.cs b/vendor/NetVips/Connection.cs
new file mode 100644
index 0000000..ca250c2
--- /dev/null
+++ b/vendor/NetVips/Connection.cs
@@ -0,0 +1,32 @@
+namespace NetVips;
+
+///
+/// The abstract base Connection class.
+///
+public abstract class Connection : VipsObject
+{
+ ///
+ internal Connection(nint pointer) : base(pointer)
+ {
+ }
+
+ ///
+ /// Get the filename associated with a connection. Return if there
+ /// is no associated file.
+ ///
+ /// The filename associated with this connection or .
+ public string GetFileName()
+ {
+ return Internal.VipsConnection.FileName(this).ToUtf8String();
+ }
+
+ ///
+ /// Make a human-readable name for a connection suitable for error
+ /// messages.
+ ///
+ /// The human-readable name for this connection.
+ public string GetNick()
+ {
+ return Internal.VipsConnection.Nick(this).ToUtf8String();
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/Enums.cs b/vendor/NetVips/Enums.cs
new file mode 100644
index 0000000..04efc68
--- /dev/null
+++ b/vendor/NetVips/Enums.cs
@@ -0,0 +1,1312 @@
+using System;
+
+namespace NetVips;
+
+///
+/// This module contains the various libvips enums.
+///
+public static class Enums
+{
+ #region semi-generated enums
+
+ ///
+ /// The type of access an operation has to supply.
+ ///
+ ///
+ /// See for example .
+ ///
+ public enum Access
+ {
+ /// Requests can come in any order.
+ Random = 0, // "random"
+
+ ///
+ /// Means requests will be top-to-bottom, but with some
+ /// amount of buffering behind the read point for small non-local
+ /// accesses.
+ ///
+ Sequential = 1, // "sequential"
+
+ /// Top-to-bottom without a buffer.
+ SequentialUnbuffered = 2 // "sequential-unbuffered"
+ }
+
+ ///
+ /// Various types of alignment.
+ ///
+ ///
+ /// See for example .
+ ///
+ public enum Align
+ {
+ /// Align on the low coordinate edge.
+ Low = 0, // "low"
+
+ /// Align on the centre.
+ Centre = 1, // "centre"
+
+ /// Align on the high coordinate edge.
+ High = 2 // "high"
+ }
+
+ ///
+ /// Various fixed 90 degree rotation angles.
+ ///
+ ///
+ /// See for example .
+ ///
+ public enum Angle
+ {
+ /// No rotate.
+ D0 = 0, // "d0"
+
+ /// 90 degrees clockwise.
+ D90 = 1, // "d90"
+
+ /// 180 degrees.
+ D180 = 2, // "d180"
+
+ /// 90 degrees anti-clockwise.
+ D270 = 3 // "d270"
+ }
+
+ ///
+ /// Various fixed 45 degree rotation angles.
+ ///
+ ///
+ /// See for example .
+ ///
+ public enum Angle45
+ {
+ /// No rotate.
+ D0 = 0, // "d0"
+
+ /// 45 degrees clockwise.
+ D45 = 1, // "d45"
+
+ /// 90 degrees clockwise.
+ D90 = 2, // "d90"
+
+ /// 135 degrees clockwise.
+ D135 = 3, // "d135"
+
+ /// 180 degrees.
+ D180 = 4, // "d180"
+
+ /// 135 degrees anti-clockwise.
+ D225 = 5, // "d225"
+
+ /// 90 degrees anti-clockwise.
+ D270 = 6, // "d270"
+
+ /// 45 degrees anti-clockwise.
+ D315 = 7 // "d315"
+ }
+
+ ///
+ /// The format of image bands.
+ ///
+ ///
+ /// The format used for each band element. Each corresponds to a native C type
+ /// for the current machine.
+ ///
+ public enum BandFormat
+ {
+ /// Invalid setting.
+ Notset = -1, // "notset"
+
+ /// unsigned char format.
+ Uchar = 0, // "uchar"
+
+ /// char format.
+ Char = 1, // "char"
+
+ /// unsigned short format.
+ Ushort = 2, // "ushort"
+
+ /// short format.
+ Short = 3, // "short"
+
+ /// unsigned int format.
+ Uint = 4, // "uint"
+
+ /// int format.
+ Int = 5, // "int"
+
+ /// float format.
+ Float = 6, // "float"
+
+ /// complex (two floats) format.
+ Complex = 7, // "complex"
+
+ /// double float format.
+ Double = 8, // "double"
+
+ /// double complex (two double) format.
+ Dpcomplex = 9 // "dpcomplex"
+ }
+
+ ///
+ /// The various Porter-Duff and PDF blend modes. See .
+ ///
+ ///
+ /// The Cairo docs have a nice explanation of all the blend modes:
+ /// https://www.cairographics.org/operators
+ ///
+ /// The non-separable modes are not implemented.
+ ///
+ public enum BlendMode
+ {
+ /// Where the second object is drawn, the first is removed.
+ Clear = 0, // "clear"
+
+ /// The second object is drawn as if nothing were below.
+ Source = 1, // "source"
+
+ /// The image shows what you would expect if you held two semi-transparent slides on top of each other.
+ Over = 2, // "over"
+
+ /// The first object is removed completely, the second is only drawn where the first was.
+ In = 3, // "in"
+
+ /// The second is drawn only where the first isn't.
+ Out = 4, // "out"
+
+ /// This leaves the first object mostly intact, but mixes both objects in the overlapping area.
+ Atop = 5, // "atop"
+
+ /// Leaves the first object untouched, the second is discarded completely.
+ Dest = 6, // "dest"
+
+ /// Like Over, but swaps the arguments.
+ DestOver = 7, // "dest-over"
+
+ /// Like In, but swaps the arguments.
+ DestIn = 8, // "dest-in"
+
+ /// Like Out, but swaps the arguments.
+ DestOut = 9, // "dest-out"
+
+ /// Like Atop, but swaps the arguments.
+ DestAtop = 10, // "dest-atop"
+
+ /// Something like a difference operator.
+ Xor = 11, // "xor"
+
+ /// A bit like adding the two images.
+ Add = 12, // "add"
+
+ /// A bit like the darker of the two.
+ Saturate = 13, // "saturate"
+
+ /// At least as dark as the darker of the two inputs.
+ Multiply = 14, // "multiply"
+
+ /// At least as light as the lighter of the inputs.
+ Screen = 15, // "screen"
+
+ /// Multiplies or screens colors, depending on the lightness.
+ Overlay = 16, // "overlay"
+
+ /// The darker of each component.
+ Darken = 17, // "darken"
+
+ /// The lighter of each component.
+ Lighten = 18, // "lighten"
+
+ /// Brighten first by a factor second.
+ ColourDodge = 19, // "colour-dodge"
+
+ /// Darken first by a factor of second.
+ ColourBurn = 20, // "colour-burn"
+
+ /// Multiply or screen, depending on lightness.
+ HardLight = 21, // "hard-light"
+
+ /// Darken or lighten, depending on lightness.
+ SoftLight = 22, // "soft-light"
+
+ /// Difference of the two.
+ Difference = 23, // "difference"
+
+ /// Somewhat like Difference, but lower-contrast.
+ Exclusion = 24 // "exclusion"
+ }
+
+ ///
+ /// How pixels are coded.
+ ///
+ ///
+ /// Normally, pixels are uncoded and can be manipulated as you would expect.
+ /// However some file formats code pixels for compression, and sometimes it's
+ /// useful to be able to manipulate images in the coded format.
+ ///
+ public enum Coding
+ {
+ /// Invalid setting.
+ Error = -1, // "error"
+
+ /// Pixels are not coded.
+ None = 0, // "none"
+
+ /// Pixels encode 3 float CIELAB values as 4 uchar.
+ Labq = 2, // "labq"
+
+ /// Pixels encode 3 float RGB as 4 uchar (Radiance coding).
+ Rad = 6 // "rad"
+ }
+
+ ///
+ /// How to combine passes.
+ ///
+ ///
+ /// See for example .
+ ///
+ public enum Combine
+ {
+ /// Take the maximum of all values.
+ Max = 0, // "max"
+
+ /// Take the sum of all values.
+ Sum = 1, // "sum"
+
+ /// Take the minimum value.
+ Min = 2 // "min"
+ }
+
+ ///
+ /// How to combine pixels.
+ ///
+ ///
+ /// Operations like need to be told how to
+ /// combine images from two sources. See also .
+ ///
+ public enum CombineMode
+ {
+ /// Set pixels to the new value.
+ Set = 0, // "set"
+
+ /// Add pixels.
+ Add = 1 // "add"
+ }
+
+ ///
+ /// A direction on a compass. Used for , for example.
+ ///
+ public enum CompassDirection
+ {
+ /// Centre
+ Centre = 0, // "centre"
+
+ /// North
+ North = 1, // "north"
+
+ /// East
+ East = 2, // "east"
+
+ /// South
+ South = 3, // "south"
+
+ /// West
+ West = 4, // "west"
+
+ /// North-east
+ NorthEast = 5, // "north-east"
+
+ /// South-east
+ SouthEast = 6, // "south-east"
+
+ /// South-west
+ SouthWest = 7, // "south-west"
+
+ /// North-west
+ NorthWest = 8 // "north-west"
+ }
+
+ ///
+ /// A direction.
+ ///
+ ///
+ /// Operations like need to be told whether to flip
+ /// left-right or top-bottom.
+ ///
+ public enum Direction
+ {
+ /// left-right.
+ Horizontal = 0, // "horizontal"
+
+ /// top-bottom.
+ Vertical = 1 // "vertical"
+ }
+
+ ///
+ /// How to extend image edges.
+ ///
+ ///
+ /// When the edges of an image are extended, you can specify how you want
+ /// the extension done. See , ,
+ /// and so on.
+ ///
+ public enum Extend
+ {
+ /// New pixels are black, ie. all bits are zero.
+ Black = 0, // "black"
+
+ /// Each new pixel takes the value of the nearest edge pixel.
+ Copy = 1, // "copy"
+
+ /// The image is tiled to fill the new area.
+ Repeat = 2, // "repeat"
+
+ /// The image is reflected and tiled to reduce hash edges.
+ Mirror = 3, // "mirror"
+
+ /// New pixels are white, ie. all bits are set.
+ White = 4, // "white"
+
+ /// Colour set from the @background property.
+ Background = 5 // "background"
+ }
+
+ ///
+ /// How sensitive loaders are to errors, from never stop (very insensitive), to
+ /// stop on the smallest warning (very sensitive).
+ ///
+ /// Each one implies the ones before it, so implies
+ /// .
+ ///
+ public enum FailOn
+ {
+ /// Never stop,
+ None = 0, // "none"
+
+ /// Stop on image truncated, nothing else.
+ Truncated = 1, // "truncated"
+
+ /// Stop on serious error or truncation.
+ Error = 2, // "error"
+
+ /// Stop on anything, even warnings.
+ Warning = 3 // "warning"
+ }
+
+ ///
+ /// The container type of the pyramid.
+ ///
+ ///
+ /// See for example .
+ ///
+ public enum ForeignDzContainer
+ {
+ /// Write tiles to the filesystem.
+ Fs = 0, // "fs"
+
+ /// Write tiles to a zip file.
+ Zip = 1, // "zip"
+
+ /// Write to a szi file.
+ Szi = 2 // "szi"
+ }
+
+ ///
+ /// How many pyramid layers to create.
+ ///
+ ///
+ /// See for example .
+ ///
+ public enum ForeignDzDepth
+ {
+ /// Create layers down to 1x1 pixel.
+ Onepixel = 0, // "onepixel"
+
+ /// Create layers down to 1x1 tile.
+ Onetile = 1, // "onetile"
+
+ /// Only create a single layer.
+ One = 2 // "one"
+ }
+
+ ///
+ /// What directory layout and metadata standard to use.
+ ///
+ public enum ForeignDzLayout
+ {
+ /// Use DeepZoom directory layout.
+ Dz = 0, // "dz"
+
+ /// Use Zoomify directory layout.
+ Zoomify = 1, // "zoomify"
+
+ /// Use Google maps directory layout.
+ Google = 2, // "google"
+
+ /// Use IIIF v2 directory layout.
+ Iiif = 3, // "iiif"
+
+ /// Use IIIF v3 directory layout
+ Iiif3 = 4 // "iiif3"
+ }
+
+ ///
+ /// The compression format to use inside a HEIF container.
+ ///
+ public enum ForeignHeifCompression
+ {
+ /// x265
+ Hevc = 1, // "hevc"
+
+ /// x264
+ Avc = 2, // "avc"
+
+ /// JPEG
+ Jpeg = 3, // "jpeg"
+
+ /// AOM
+ Av1 = 4 // "av1"
+ }
+
+ ///
+ /// The PNG filter to use.
+ ///
+ [Flags]
+ public enum ForeignPngFilter
+ {
+ /// No filtering.
+ None = 0x08, // "none"
+
+ /// Difference to the left.
+ Sub = 0x10, // "sub"
+
+ /// Difference up.
+ Up = 0x20, // "up"
+
+ /// Average of left and up.
+ Avg = 0x40, // "avg"
+
+ /// Pick best neighbor predictor automatically.
+ Paeth = 0x80, // "paeth"
+
+ /// Adaptive.
+ All = None | Sub | Up | Avg | Paeth // "all"
+ }
+
+ ///
+ /// Which metadata to retain.
+ ///
+ [Flags]
+ public enum ForeignKeep
+ {
+ /// Don't attach metadata.
+ None = 0, // "none"
+
+ /// Keep Exif metadata.
+ Exif = 1 << 0, // "exif"
+
+ /// Keep XMP metadata.
+ Xmp = 1 << 1, // "xmp"
+
+ /// Keep IPTC metadata.
+ Iptc = 1 << 2, // "iptc"
+
+ /// Keep ICC metadata.
+ Icc = 1 << 3, // "icc"
+
+ /// Keep other metadata (e.g. PNG comments and some TIFF tags)
+ Other = 1 << 4, // "other"
+
+ /// Keep all metadata.
+ All = Exif | Xmp | Iptc | Icc | Other // "all"
+ }
+
+ ///
+ /// The selected encoder to use.
+ ///
+ ///
+ /// If libheif hasn't been compiled with the selected encoder, it will
+ /// fallback to the default encoder based on .
+ ///
+ public enum ForeignHeifEncoder
+ {
+ /// Pick encoder automatically.
+ Auto = 0, // "auto"
+
+ /// AOM
+ Aom = 1, // "aom"
+
+ /// RAV1E
+ Rav1e = 2, // "rav1e"
+
+ /// SVT-AV1
+ Svt = 3, // "svt"
+
+ /// x265
+ X265 = 4 // "x265"
+ }
+
+ ///
+ /// The netpbm file format to save as.
+ ///
+ public enum ForeignPpmFormat
+ {
+ /// Images are single bit.
+ Pbm = 0, // "pbm"
+
+ /// Images are 8, 16, or 32-bits, one band.
+ Pgm = 1, // "pgm"
+
+ /// Images are 8, 16, or 32-bits, three bands.
+ Ppm = 2, // "ppm"
+
+ /// Images are 32-bit float pixels.
+ Pfm = 3, // "pfm"
+
+ /// Images are anymap images -- the image format is used to pick the saver.
+ Pnm = 4 // "pnm"
+ }
+
+ ///
+ /// Set JPEG/HEIF subsampling mode.
+ ///
+ public enum ForeignSubsample
+ {
+ /// Prevent subsampling when quality > 90.
+ Auto = 0, // "auto"
+
+ /// Always perform subsampling.
+ On = 1, // "on"
+
+ /// Never perform subsampling.
+ Off = 2 // "off"
+ }
+
+ ///
+ /// The compression types supported by the tiff writer.
+ ///
+ public enum ForeignTiffCompression
+ {
+ /// No compression.
+ None = 0, // "none"
+
+ /// JPEG compression.
+ Jpeg = 1, // "jpeg"
+
+ /// Deflate (zip) compression.
+ Deflate = 2, // "deflate"
+
+ /// Packbits compression.
+ Packbits = 3, // "packbits"
+
+ /// Fax4 compression.
+ Ccittfax4 = 4, // "ccittfax4"
+
+ /// LZW compression.
+ Lzw = 5, // "lzw"
+
+ /// WebP compression.
+ Webp = 6, // "webp"
+
+ /// ZSTD compression.
+ Zstd = 7, // "zstd"
+
+ /// JP2K compression.
+ Jp2k = 8 // "jp2k"
+ }
+
+ ///
+ /// The predictor can help deflate and lzw compression.
+ /// The values are fixed by the tiff library.
+ ///
+ public enum ForeignTiffPredictor
+ {
+ /// No prediction.
+ None = 1, // "none"
+
+ /// Horizontal differencing.
+ Horizontal = 2, // "horizontal"
+
+ /// Float predictor.
+ Float = 3 // "float"
+ }
+
+ ///
+ /// Use inches or centimeters as the resolution unit for a tiff file.
+ ///
+ public enum ForeignTiffResunit
+ {
+ /// Use centimeters.
+ Cm = 0, // "cm"
+
+ /// Use inches.
+ Inch = 1 // "inch"
+ }
+
+ ///
+ /// Tune lossy encoder settings for different image types.
+ ///
+ public enum ForeignWebpPreset
+ {
+ /// Default preset.
+ Default = 0, // "default"
+
+ /// Digital picture, like portrait, inner shot.
+ Picture = 1, // "picture"
+
+ /// Outdoor photograph, with natural lighting.
+ Photo = 2, // "photo"
+
+ /// Hand or line drawing, with high-contrast details.
+ Drawing = 3, // "drawing"
+
+ /// Small-sized colorful images/
+ Icon = 4, // "icon"
+
+ /// Text-like.
+ Text = 5 // "text"
+ }
+
+ ///
+ /// The rendering intent.
+ ///
+ ///
+ /// See .
+ ///
+ public enum Intent
+ {
+ /// Perceptual rendering intent.
+ Perceptual = 0, // "perceptual"
+
+ /// Relative colorimetric rendering intent.
+ Relative = 1, // "relative"
+
+ /// Saturation rendering intent.
+ Saturation = 2, // "saturation"
+
+ /// Absolute colorimetric rendering intent.
+ Absolute = 3, // "absolute"
+
+ /// The rendering intent that the profile suggests.
+ Auto = 32 // "auto"
+ }
+
+ ///
+ /// Pick the algorithm vips uses to decide image "interestingness".
+ /// This is used by , for example, to decide what parts of the image to keep.
+ ///
+ public enum Interesting
+ {
+ /// Do nothing.
+ None = 0, // "none"
+
+ /// Just take the centre.
+ Centre = 1, // "centre"
+
+ /// Use an entropy measure.
+ Entropy = 2, // "entropy"
+
+ /// Look for features likely to draw human attention.
+ Attention = 3, // "attention"
+
+ /// Position the crop towards the low coordinate.
+ Low = 4, // "low"
+
+ /// Position the crop towards the high coordinate.
+ High = 5, // "high"
+
+ /// Everything is interesting.
+ All = 6 // "all"
+ }
+
+ ///
+ /// How the values in an image should be interpreted.
+ ///
+ ///
+ /// For example, a three-band float image of type LAB should have its
+ /// pixels interpreted as coordinates in CIE Lab space.
+ ///
+ public enum Interpretation
+ {
+ /// Invalid setting.
+ Error = -1, // "error"
+
+ /// Generic many-band image.
+ Multiband = 0, // "multiband"
+
+ /// Some kind of single-band image.
+ Bw = 1, // "b-w"
+
+ /// A 1D image, eg. histogram or lookup table.
+ Histogram = 10, // "histogram"
+
+ /// The first three bands are CIE XYZ.
+ Xyz = 12, // "xyz"
+
+ /// Pixels are in CIE Lab space.
+ Lab = 13, // "lab"
+
+ /// The first four bands are in CMYK space.
+ Cmyk = 15, // "cmyk"
+
+ /// Implies .
+ Labq = 16, // "labq"
+
+ /// Generic RGB space.
+ Rgb = 17, // "rgb"
+
+ /// A uniform colourspace based on CMC(1:1).
+ Cmc = 18, // "cmc"
+
+ /// Pixels are in CIE LCh space.
+ Lch = 19, // "lch"
+
+ /// CIE LAB coded as three signed 16-bit values.
+ Labs = 21, // "labs"
+
+ /// Pixels are sRGB.
+ Srgb = 22, // "srgb"
+
+ /// Pixels are CIE Yxy.
+ Yxy = 23, // "yxy"
+
+ /// Image is in fourier space.
+ Fourier = 24, // "fourier"
+
+ /// Generic 16-bit RGB.
+ Rgb16 = 25, // "rgb16"
+
+ /// Generic 16-bit mono.
+ Grey16 = 26, // "grey16"
+
+ /// A matrix.
+ Matrix = 27, // "matrix"
+
+ /// Pixels are scRGB.
+ Scrgb = 28, // "scrgb"
+
+ /// Pixels are HSV.
+ Hsv = 29 // "hsv"
+ }
+
+ ///
+ /// A resizing kernel. One of these can be given to operations like
+ /// or to select the resizing kernel to use.
+ ///
+ public enum Kernel
+ {
+ /// Nearest-neighbour interpolation.
+ Nearest = 0, // "nearest"
+
+ /// Linear interpolation.
+ Linear = 1, // "linear"
+
+ /// Cubic interpolation.
+ Cubic = 2, // "cubic"
+
+ /// Mitchell
+ Mitchell = 3, // "mitchell"
+
+ /// Two-lobe Lanczos.
+ Lanczos2 = 4, // "lanczos2"
+
+ /// Three-lobe Lanczos.
+ Lanczos3 = 5, // "lanczos3"
+
+ /// Magic Kernel Sharp 2013.
+ Mks2013 = 6, // "mks2013"
+
+ /// Magic Kernel Sharp 2021.
+ Mks2021 = 7 // "mks2021"
+ }
+
+ ///
+ /// Boolean operations.
+ ///
+ ///
+ /// See .
+ ///
+ public enum OperationBoolean
+ {
+ /// &
+ And = 0, // "and"
+
+ /// |
+ Or = 1, // "or"
+
+ /// ^
+ Eor = 2, // "eor"
+
+ /// <<
+ Lshift = 3, // "lshift"
+
+ /// >>
+ Rshift = 4 // "rshift"
+ }
+
+ ///
+ /// Operations on complex images.
+ ///
+ ///
+ /// See .
+ ///
+ public enum OperationComplex
+ {
+ /// Convert to polar coordinates.
+ Polar = 0, // "polar"
+
+ /// Convert to rectangular coordinates.
+ Rect = 1, // "rect"
+
+ /// Complex conjugate.
+ Conj = 2 // "conj"
+ }
+
+ ///
+ /// Binary operations on complex images.
+ ///
+ ///
+ /// See .
+ ///
+ public enum OperationComplex2
+ {
+ /// Convert to polar coordinates.
+ CrossPhase = 0 // "cross-phase"
+ }
+
+ ///
+ /// Components of complex images.
+ ///
+ ///
+ /// See .
+ ///
+ public enum OperationComplexget
+ {
+ /// Get real component.
+ Real = 0, // "real"
+
+ /// Get imaginary component.
+ Imag = 1 // "imag"
+ }
+
+ ///
+ /// Various math functions on images.
+ ///
+ ///
+ /// See .
+ ///
+ public enum OperationMath
+ {
+ /// sin(), angles in degrees.
+ Sin = 0, // "sin"
+
+ /// cos(), angles in degrees.
+ Cos = 1, // "cos"
+
+ /// tan(), angles in degrees.
+ Tan = 2, // "tan"
+
+ /// asin(), angles in degrees.
+ Asin = 3, // "asin"
+
+ /// acos(), angles in degrees.
+ Acos = 4, // "acos"
+
+ /// atan(), angles in degrees.
+ Atan = 5, // "atan"
+
+ /// log base e.
+ Log = 6, // "log"
+
+ /// log base 10.
+ Log10 = 7, // "log10"
+
+ /// e to the something.
+ Exp = 8, // "exp"
+
+ /// 10 to the something.
+ Exp10 = 9, // "exp10"
+
+ /// sinh(), angles in radians.
+ Sinh = 10, // "sinh"
+
+ /// cosh(), angles in radians.
+ Cosh = 11, // "cosh"
+
+ /// tanh(), angles in radians.
+ Tanh = 12, // "tanh"
+
+ /// asinh(), angles in radians.
+ Asinh = 13, // "asinh"
+
+ /// acosh(), angles in radians.
+ Acosh = 14, // "acosh"
+
+ /// atanh(), angles in radians.
+ Atanh = 15 // "atanh"
+ }
+
+ ///
+ /// Various math functions on images.
+ ///
+ ///
+ /// See .
+ ///
+ public enum OperationMath2
+ {
+ /// pow( left, right ).
+ Pow = 0, // "pow"
+
+ /// pow( right, left ).
+ Wop = 1, // "wop"
+
+ /// atan2( left, right )
+ Atan2 = 2 // "atan2"
+ }
+
+ ///
+ /// Morphological operations.
+ ///
+ ///
+ /// See .
+ ///
+ public enum OperationMorphology
+ {
+ /// true if all set.
+ Erode = 0, // "erode"
+
+ /// true if one set.
+ Dilate = 1 // "dilate"
+ }
+
+ ///
+ /// Various relational operations.
+ ///
+ ///
+ /// See .
+ ///
+ public enum OperationRelational
+ {
+ /// ==
+ Equal = 0, // "equal"
+
+ /// !=
+ Noteq = 1, // "noteq"
+
+ /// <
+ Less = 2, // "less"
+
+ /// <=
+ Lesseq = 3, // "lesseq"
+
+ /// >
+ More = 4, // "more"
+
+ /// >=
+ Moreeq = 5 // "moreeq"
+ }
+
+ ///
+ /// Round operations.
+ ///
+ public enum OperationRound
+ {
+ /// Round to nearest.
+ Rint = 0, // "rint"
+
+ /// The smallest integral value not less than.
+ Ceil = 1, // "ceil"
+
+ /// Largest integral value not greater than.
+ Floor = 2 // "floor"
+ }
+
+ ///
+ /// Set Profile Connection Space.
+ ///
+ ///
+ /// See for example .
+ ///
+ public enum PCS
+ {
+ /// CIE Lab space.
+ Lab = 0, // "lab"
+
+ /// CIE XYZ space.
+ Xyz = 1 // "xyz"
+ }
+
+ ///
+ /// Computation precision.
+ ///
+ ///
+ /// See for example .
+ ///
+ public enum Precision
+ {
+ /// Integer.
+ Integer = 0, // "integer"
+
+ /// Floating point.
+ Float = 1, // "float"
+
+ /// Compute approximate result.
+ Approximate = 2 // "approximate"
+ }
+
+ ///
+ /// How to calculate the output pixels when shrinking a 2x2 region.
+ ///
+ public enum RegionShrink
+ {
+ /// Use the average.
+ Mean = 0, // "mean"
+
+ /// Use the median.
+ Median = 1, // "median"
+
+ /// Use the mode.
+ Mode = 2, // "mode"
+
+ /// Use the maximum.
+ Max = 3, // "max"
+
+ /// Use the minimum.
+ Min = 4, // "min"
+
+ /// Use the top-left pixel.
+ Nearest = 5 // "nearest"
+ }
+
+ ///
+ /// The SDF to generate.
+ ///
+ ///
+ /// See for example .
+ ///
+ public enum SdfShape
+ {
+ /// A circle at @a, radius @r.
+ Circle = 0, // "circle"
+ /// A box from @a to @b.
+ Box = 1, // "box"
+ /// A box with rounded @corners from @a to @b.
+ RoundedBox = 2, // "rounded-box"
+ /// A line from @a to @b.
+ Line = 3 // "line"
+ }
+
+ ///
+ /// Controls whether an operation should upsize, downsize, both up and downsize, or force a size.
+ ///
+ ///
+ /// See for example .
+ ///
+ public enum Size
+ {
+ /// Size both up and down.
+ Both = 0, // "both"
+
+ /// Only upsize.
+ Up = 1, // "up"
+
+ /// Only downsize.
+ Down = 2, // "down"
+
+ /// Force size, that is, break aspect ratio.
+ Force = 3 // "force"
+ }
+
+ ///
+ /// Sets the word wrapping style for when used with a maximum width.
+ ///
+ public enum TextWrap
+ {
+ /// Wrap at word boundaries.
+ Word = 0, // "word"
+
+ /// Wrap at character boundaries.
+ Char = 1, // "char"
+
+ /// Wrap at word boundaries, but fall back to character boundaries if there is not enough space for a full word.
+ WordChar = 2, // "word-char"
+
+ /// No wrapping.
+ None = 3 // "none"
+ }
+
+ #endregion
+
+ ///
+ /// Flags specifying the level of log messages.
+ ///
+ [Flags]
+ public enum LogLevelFlags
+ {
+ #region Internal log flags
+
+ /// Internal flag.
+ FlagRecursion = 1 << 0,
+
+ /// Internal flag.
+ FlagFatal = 1 << 1,
+
+ #endregion
+
+ #region GLib log levels
+
+ /// Log level for errors.
+ Error = 1 << 2, // always fatal
+
+ /// Log level for critical warning messages.
+ Critical = 1 << 3,
+
+ /// Log level for warnings.
+ Warning = 1 << 4,
+
+ /// Log level for messages.
+ Message = 1 << 5,
+
+ /// Log level for informational messages.
+ Info = 1 << 6,
+
+ /// Log level for debug messages.
+ Debug = 1 << 7,
+
+ #endregion
+
+ #region Convenience values
+
+ /// All log levels except fatal.
+ AllButFatal = All & ~FlagFatal,
+
+ /// All log levels except recursion.
+ AllButRecursion = All & ~FlagRecursion,
+
+ /// All log levels.
+ All = FlagMask | Error | Critical | Warning | Message | Info | Debug,
+
+ /// Flag mask.
+ FlagMask = ~LevelMask,
+
+ /// A mask including all log levels.
+ LevelMask = ~(FlagRecursion | FlagFatal),
+
+ /// A mask with log levels that are considered fatal by default.
+ FatalMask = FlagRecursion | Error
+
+ #endregion
+ }
+
+ ///
+ /// Flags we associate with each object argument.
+ ///
+ [Flags]
+ public enum ArgumentFlags
+ {
+ /// No flags.
+ NONE = 0,
+
+ /// Must be set in the constructor.
+ REQUIRED = 1 << 0,
+
+ /// Can only be set in the constructor.
+ CONSTRUCT = 1 << 1,
+
+ /// Can only be set once.
+ SET_ONCE = 1 << 2,
+
+ /// Don't do use-before-set checks.
+ SET_ALWAYS = 1 << 3,
+
+ /// Is an input argument (one we depend on).
+ INPUT = 1 << 4,
+
+ /// Is an output argument (depends on us).
+ OUTPUT = 1 << 5,
+
+ /// Just there for back-compat, hide.
+ DEPRECATED = 1 << 6,
+
+ /// The input argument will be modified.
+ MODIFY = 1 << 7
+ }
+
+ ///
+ /// Flags we associate with an .
+ ///
+ [Flags]
+ public enum OperationFlags : uint
+ {
+ /// No flags.
+ NONE = 0,
+
+ /// Can work sequentially with a small buffer.
+ SEQUENTIAL = 1 << 0,
+
+ /// Can work sequentially without a buffer.
+ SEQUENTIAL_UNBUFFERED = 1 << 1,
+
+ /// Must not be cached.
+ NOCACHE = 1 << 2,
+
+ /// A compatibility thing.
+ DEPRECATED = 1 << 3,
+
+ /// Not hardened for untrusted input.
+ UNTRUSTED = 1 << 4,
+
+ /// Prevent this operation from running.
+ BLOCKED = 1 << 5
+ }
+
+ ///
+ /// Flags we associate with a file load operation.
+ ///
+ [Flags]
+ public enum ForeignFlags : uint
+ {
+ /// No flags set.
+ NONE = 0,
+
+ /// Lazy read OK (eg. tiled tiff).
+ PARTIAL = 1 << 0,
+
+ /// Most-significant byte first.
+ BIGENDIAN = 1 << 1,
+
+ /// Top-to-bottom lazy read OK.
+ SEQUENTIAL = 1 << 2,
+
+ /// All flags set.
+ ALL = 1 << 3
+ }
+
+ ///
+ /// Signals that can be used on an . See .
+ ///
+ public enum Signals
+ {
+ /// Evaluation is starting.
+ ///
+ /// The preeval signal is emitted once before computation of
+ /// starts. It's a good place to set up evaluation feedback.
+ ///
+ PreEval = 0, // "preeval"
+
+ /// Evaluation progress.
+ ///
+ /// The eval signal is emitted once per work unit (typically a 128 x
+ /// 128 area of pixels) during image computation.
+ ///
+ /// You can use this signal to update user-interfaces with progress
+ /// feedback. Beware of updating too frequently: you will usually
+ /// need some throttling mechanism.
+ ///
+ Eval = 1, // "eval"
+
+ /// Evaluation is ending.
+ ///
+ /// The posteval signal is emitted once at the end of the computation
+ /// of . It's a good place to shut down evaluation feedback.
+ ///
+ PostEval = 2 // "posteval"
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/ExtensionMethods.cs b/vendor/NetVips/ExtensionMethods.cs
new file mode 100644
index 0000000..cb4479b
--- /dev/null
+++ b/vendor/NetVips/ExtensionMethods.cs
@@ -0,0 +1,289 @@
+using System;
+using System.Buffers;
+using System.Runtime.InteropServices;
+using System.Text;
+using NetVips.Internal;
+
+namespace NetVips;
+
+///
+/// Useful extension methods that we use in our codebase.
+///
+internal static class ExtensionMethods
+{
+ ///
+ /// Removes the element with the specified key from the
+ /// and retrieves the value to .
+ ///
+ /// The to remove from.
+ /// >The key of the element to remove.
+ /// The target to retrieve the value to.
+ /// if the element is successfully removed; otherwise, .
+ internal static bool Remove(this VOption self, string key, out object target)
+ {
+ self.TryGetValue(key, out target);
+ return self.Remove(key);
+ }
+
+ ///
+ /// Merges 2 s.
+ ///
+ /// The to merge into.
+ /// The to merge from.
+ internal static void Merge(this VOption self, VOption merge)
+ {
+ foreach (var item in merge)
+ {
+ self[item.Key] = item.Value;
+ }
+ }
+
+ ///
+ /// Call a libvips operation.
+ ///
+ /// A used as guide.
+ /// Operation name.
+ /// A new object.
+ internal static object Call(this Image image, string operationName) =>
+ Operation.Call(operationName, null, image);
+
+ ///
+ /// Call a libvips operation.
+ ///
+ /// A used as guide.
+ /// Operation name.
+ /// An arbitrary number and variety of arguments.
+ /// A new object.
+ internal static object Call(this Image image, string operationName, params object[] args) =>
+ Operation.Call(operationName, null, image, args);
+
+ ///
+ /// Call a libvips operation.
+ ///
+ /// A used as guide.
+ /// Operation name.
+ /// Optional arguments.
+ /// A new object.
+ internal static object Call(this Image image, string operationName, VOption kwargs) =>
+ Operation.Call(operationName, kwargs, image);
+
+ ///
+ /// Call a libvips operation.
+ ///
+ /// A used as guide.
+ /// Operation name.
+ /// Optional arguments.
+ /// An arbitrary number and variety of arguments.
+ /// A new object.
+ internal static object Call(this Image image, string operationName, VOption kwargs, params object[] args) =>
+ Operation.Call(operationName, kwargs, image, args);
+
+ ///
+ /// Prepends to .
+ ///
+ /// The array.
+ /// The to prepend to .
+ /// A new object array.
+ internal static object[] PrependImage(this T[] args, Image image)
+ {
+ if (args == null)
+ {
+ return new object[] { image };
+ }
+
+ var newValues = new object[args.Length + 1];
+ newValues[0] = image;
+ Array.Copy(args, 0, newValues, 1, args.Length);
+ return newValues;
+ }
+
+ ///
+ /// Marshals a GLib UTF8 char* to a managed string.
+ ///
+ /// Pointer to the GLib string.
+ /// If set to , free the GLib string.
+ /// Size of the GLib string, use 0 to read until the null character.
+ /// The managed string.
+ internal static string ToUtf8String(this nint utf8Str, bool freePtr = false, int size = 0)
+ {
+ if (utf8Str == IntPtr.Zero)
+ {
+ return null;
+ }
+
+ if (size == 0)
+ {
+ while (Marshal.ReadByte(utf8Str, size) != 0)
+ {
+ ++size;
+ }
+ }
+
+ if (size == 0)
+ {
+ if (freePtr)
+ {
+ GLib.GFree(utf8Str);
+ }
+
+ return string.Empty;
+ }
+
+ var bytes = ArrayPool.Shared.Rent(size);
+ try
+ {
+ Marshal.Copy(utf8Str, bytes, 0, size);
+ return Encoding.UTF8.GetString(bytes, 0, size);
+ }
+ finally
+ {
+ ArrayPool.Shared.Return(bytes);
+ if (freePtr)
+ {
+ GLib.GFree(utf8Str);
+ }
+ }
+ }
+
+ ///
+ /// Convert bytes to human readable format.
+ ///
+ /// The number of bytes.
+ /// The readable format of the bytes.
+ internal static string ToReadableBytes(this ulong value)
+ {
+ string[] sizeSuffixes = { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" };
+
+ var i = 0;
+ decimal dValue = value;
+ while (Math.Round(dValue, 2) >= 1000)
+ {
+ dValue /= 1024;
+ i++;
+ }
+
+ return $"{dValue:n2} {sizeSuffixes[i]}";
+ }
+
+ ///
+ /// Negate all elements in an array.
+ ///
+ /// An array of doubles.
+ /// The negated array.
+ internal static double[] Negate(this double[] array)
+ {
+ for (var i = 0; i < array.Length; i++)
+ {
+ array[i] *= -1;
+ }
+
+ return array;
+ }
+
+ ///
+ /// Negate all elements in an array.
+ ///
+ ///
+ /// It will output an array of doubles instead of integers.
+ ///
+ /// An array of integers.
+ /// The negated array.
+ internal static double[] Negate(this int[] array)
+ {
+ var doubles = new double[array.Length];
+ for (var i = 0; i < array.Length; i++)
+ {
+ ref var value = ref doubles[i];
+ value = array[i] * -1;
+ }
+
+ return doubles;
+ }
+
+ ///
+ /// Invert all elements in an array.
+ ///
+ /// An array of doubles.
+ /// The inverted array.
+ internal static double[] Invert(this double[] array)
+ {
+ for (var i = 0; i < array.Length; i++)
+ {
+ array[i] = 1.0 / array[i];
+ }
+
+ return array;
+ }
+
+ ///
+ /// Invert all elements in an array.
+ ///
+ ///
+ /// It will output an array of doubles instead of integers.
+ ///
+ /// An array of integers.
+ /// The inverted array.
+ internal static double[] Invert(this int[] array)
+ {
+ var doubles = new double[array.Length];
+ for (var i = 0; i < array.Length; i++)
+ {
+ ref var value = ref doubles[i];
+ value = 1.0 / array[i];
+ }
+
+ return doubles;
+ }
+
+ ///
+ /// Compatibility method to call loaders with the enum.
+ ///
+ /// The optional arguments for the loader.
+ /// The optional parameter.
+ internal static void AddFailOn(this VOption options, Enums.FailOn? failOn = null)
+ {
+ if (!failOn.HasValue)
+ {
+ return;
+ }
+
+ if (NetVips.AtLeastLibvips(8, 12))
+ {
+ options.Add("fail_on", failOn);
+ }
+ else
+ {
+ // The deprecated "fail" param was at the highest sensitivity (>= warning),
+ // but for compat it would be more correct to set this to true only when
+ // a non-permissive enum is given (> none).
+ options.Add("fail", failOn > Enums.FailOn.None);
+ }
+ }
+
+ ///
+ /// Compatibility method to call savers with the enum.
+ ///
+ /// The optional arguments for the saver.
+ /// The optional parameter.
+ /// Whether this operation is -like.
+ internal static void AddForeignKeep(this VOption options, Enums.ForeignKeep? keep = null, bool isDzsave = false)
+ {
+ if (!keep.HasValue)
+ {
+ return;
+ }
+
+ if (NetVips.AtLeastLibvips(8, 15))
+ {
+ options.Add(nameof(keep), keep);
+ }
+ else if (isDzsave)
+ {
+ options.Add("no_strip", keep != Enums.ForeignKeep.None);
+ }
+ else
+ {
+ options.Add("strip", keep == Enums.ForeignKeep.None);
+ }
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/GObject.cs b/vendor/NetVips/GObject.cs
new file mode 100644
index 0000000..071a115
--- /dev/null
+++ b/vendor/NetVips/GObject.cs
@@ -0,0 +1,198 @@
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using NetVips.Internal;
+
+using GSignalMatchType = NetVips.Internal.Enums.GSignalMatchType;
+
+namespace NetVips;
+
+///
+/// Manage lifetime.
+///
+public class GObject : SafeHandle
+{
+ ///
+ /// We have to record all of the delegates to
+ /// prevent them from being re-located or disposed of by the garbage collector.
+ ///
+ ///
+ /// All recorded delegates are freed in .
+ ///
+ private readonly ICollection _handles = new List();
+
+ ///
+ /// Hint of how much native memory is actually occupied by the object.
+ ///
+ internal long MemoryPressure;
+
+ // Handy for debugging
+ // public static int NObjects;
+
+ ///
+ /// Initializes a new instance of the class
+ /// with the specified pointer to wrap around.
+ ///
+ ///
+ /// Wraps a GObject instance around an underlying GValue. When the
+ /// instance is garbage-collected, the underlying object is unreferenced.
+ ///
+ /// The pointer to wrap around.
+ internal GObject(nint pointer) : base(IntPtr.Zero, true)
+ {
+ // record the pointer we were given to manage
+ SetHandle(pointer);
+
+ // NObjects++;
+ }
+
+ ///
+ /// Connects a callback function () to a signal on this object.
+ ///
+ ///
+ /// The callback will be triggered every time this signal is issued on this instance.
+ ///
+ /// The type of the callback to connect.
+ /// A string of the form "signal-name::detail".
+ /// The callback to connect.
+ /// Data to pass to handler calls.
+ /// The handler id.
+ /// If it failed to connect the signal.
+ public ulong SignalConnect(string detailedSignal, T callback, nint data = default)
+ where T : notnull
+ {
+ // add a weak reference callback to ensure all handles are released on finalization
+ if (_handles.Count == 0)
+ {
+ GWeakNotify notify = ReleaseDelegates;
+ var notifyHandle = GCHandle.Alloc(notify);
+
+ Internal.GObject.WeakRef(this, notify, GCHandle.ToIntPtr(notifyHandle));
+ }
+
+ // prevent the delegate from being re-located or disposed of by the garbage collector
+ var delegateHandle = GCHandle.Alloc(callback);
+ _handles.Add(delegateHandle);
+
+ var cHandler = Marshal.GetFunctionPointerForDelegate(callback);
+ var ret = GSignal.ConnectData(this, detailedSignal, cHandler, data, null, default);
+ if (ret == 0)
+ {
+ throw new ArgumentException("Failed to connect signal " + detailedSignal);
+ }
+
+ return ret;
+ }
+
+ ///
+ /// Disconnects a handler from this object.
+ ///
+ ///
+ /// If the is 0 then this function does nothing.
+ ///
+ /// Handler id of the handler to be disconnected.
+ public void SignalHandlerDisconnect(ulong handlerId)
+ {
+ if (handlerId != 0)
+ {
+ GSignal.HandlerDisconnect(this, handlerId);
+ }
+ }
+
+ ///
+ /// Disconnects all handlers from this object that match and
+ /// .
+ ///
+ /// The type of the func.
+ /// The func of the handlers.
+ /// The data of the handlers.
+ /// The number of handlers that matched.
+ public uint SignalHandlersDisconnectByFunc(T func, nint data = default)
+ where T : notnull
+ {
+ var funcPtr = Marshal.GetFunctionPointerForDelegate(func);
+ return GSignal.HandlersDisconnectMatched(this,
+ GSignalMatchType.G_SIGNAL_MATCH_FUNC | GSignalMatchType.G_SIGNAL_MATCH_DATA,
+ 0, 0, IntPtr.Zero, funcPtr, data);
+ }
+
+ ///
+ /// Disconnects all handlers from this object that match .
+ ///
+ /// The data of the handlers.
+ /// The number of handlers that matched.
+ public uint SignalHandlersDisconnectByData(nint data)
+ {
+ return GSignal.HandlersDisconnectMatched(this,
+ GSignalMatchType.G_SIGNAL_MATCH_DATA,
+ 0, 0, IntPtr.Zero, IntPtr.Zero, data);
+ }
+
+ ///
+ /// Decreases the reference count of object.
+ /// When its reference count drops to 0, the object is finalized (i.e. its memory is freed).
+ ///
+ /// if the handle is released successfully; otherwise,
+ /// in the event of a catastrophic failure, .
+ protected override bool ReleaseHandle()
+ {
+ if (!IsInvalid)
+ {
+ Internal.GObject.Unref(handle);
+ }
+ // NObjects--;
+
+ return true;
+ }
+
+ ///
+ /// Release all the delegates by this object on finalization.
+ ///
+ ///
+ /// This function is only called when was used on this object.
+ ///
+ /// Data that was provided when the weak reference was established.
+ /// The object being disposed.
+ internal void ReleaseDelegates(nint data, nint objectPointer)
+ {
+ foreach (var gcHandle in _handles)
+ {
+ if (gcHandle.IsAllocated)
+ {
+ gcHandle.Free();
+ }
+ }
+
+ // All GCHandles are free'd. Clear the list to prevent inadvertent use.
+ _handles.Clear();
+
+ // Free the GCHandle used by this GWeakNotify
+ var notifyHandle = GCHandle.FromIntPtr(data);
+ if (notifyHandle.IsAllocated)
+ {
+ notifyHandle.Free();
+ }
+ }
+
+ ///
+ /// Increases the reference count of object.
+ ///
+ internal nint ObjectRef()
+ {
+ return Internal.GObject.Ref(handle);
+ }
+
+ ///
+ /// Gets a value indicating whether the handle is invalid.
+ ///
+ /// if the handle is not valid; otherwise, .
+ public override bool IsInvalid => handle == IntPtr.Zero;
+
+ ///
+ /// Get the reference count of object. Handy for debugging.
+ ///
+ internal uint RefCount => Marshal.PtrToStructure(handle).RefCount;
+
+ // Do not provide a finalizer - SafeHandle's critical finalizer will
+ // call ReleaseHandle for us.
+}
\ No newline at end of file
diff --git a/vendor/NetVips/GValue.cs b/vendor/NetVips/GValue.cs
new file mode 100644
index 0000000..74d8343
--- /dev/null
+++ b/vendor/NetVips/GValue.cs
@@ -0,0 +1,513 @@
+using System;
+using System.Collections;
+using System.Runtime.InteropServices;
+using System.Text;
+using NetVips.Internal;
+
+namespace NetVips;
+
+///
+/// Wrap in a C# class.
+///
+///
+/// This class wraps in a convenient interface. You can use
+/// instances of this class to get and set properties.
+///
+/// On construction, is all zero (empty). You can pass it to
+/// a get function to have it filled by , or use init to
+/// set a type, set to set a value, then use it to set an object property.
+///
+/// GValue lifetime is managed automatically.
+///
+public class GValue : IDisposable
+{
+ ///
+ /// The specified struct to wrap around.
+ ///
+ internal Internal.GValue.Struct Struct;
+
+ ///
+ /// Track whether has been called.
+ ///
+ private bool _disposed;
+
+ ///
+ /// Shift value used in converting numbers to type IDs.
+ ///
+ private const int FundamentalShift = 2;
+
+ // look up some common gtypes at init for speed
+
+ ///
+ /// The fundamental type corresponding to gboolean.
+ ///
+ public static readonly nint GBoolType = 5 << FundamentalShift;
+
+ ///
+ /// The fundamental type corresponding to gint.
+ ///
+ public static readonly nint GIntType = 6 << FundamentalShift;
+
+ ///
+ /// The fundamental type corresponding to guint64.
+ ///
+ public static readonly nint GUint64Type = 11 << FundamentalShift;
+
+ ///
+ /// The fundamental type from which all enumeration types are derived.
+ ///
+ public static readonly nint GEnumType = 12 << FundamentalShift;
+
+ ///
+ /// The fundamental type from which all flags types are derived.
+ ///
+ public static readonly nint GFlagsType = 13 << FundamentalShift;
+
+ ///
+ /// The fundamental type corresponding to gdouble.
+ ///
+ public static readonly nint GDoubleType = 15 << FundamentalShift;
+
+ ///
+ /// The fundamental type corresponding to null-terminated C strings.
+ ///
+ public static readonly nint GStrType = 16 << FundamentalShift;
+
+ ///
+ /// The fundamental type for GObject.
+ ///
+ public static readonly nint GObjectType = 20 << FundamentalShift;
+
+ ///
+ /// The fundamental type for VipsImage.
+ ///
+ public static readonly nint ImageType = NetVips.TypeFromName("VipsImage");
+
+ ///
+ /// The fundamental type for VipsArrayInt.
+ ///
+ public static readonly nint ArrayIntType = NetVips.TypeFromName("VipsArrayInt");
+
+ ///
+ /// The fundamental type for VipsArrayDouble.
+ ///
+ public static readonly nint ArrayDoubleType = NetVips.TypeFromName("VipsArrayDouble");
+
+ ///
+ /// The fundamental type for VipsArrayImage.
+ ///
+ public static readonly nint ArrayImageType = NetVips.TypeFromName("VipsArrayImage");
+
+ ///
+ /// The fundamental type for VipsRefString.
+ ///
+ public static readonly nint RefStrType = NetVips.TypeFromName("VipsRefString");
+
+ ///
+ /// The fundamental type for VipsBlob.
+ ///
+ public static readonly nint BlobType = NetVips.TypeFromName("VipsBlob");
+
+ ///
+ /// The fundamental type for VipsBlendMode. See .
+ ///
+ public static readonly nint BlendModeType;
+
+ ///
+ /// The fundamental type for VipsSource. See .
+ ///
+ public static readonly nint SourceType;
+
+ ///
+ /// The fundamental type for VipsTarget. See .
+ ///
+ public static readonly nint TargetType;
+
+ ///
+ /// Hint of how much native memory is actually occupied by the object.
+ ///
+ private long _memoryPressure;
+
+ static GValue()
+ {
+ if (NetVips.AtLeastLibvips(8, 6))
+ {
+ BlendModeType = Vips.BlendModeGetType();
+ }
+
+ if (NetVips.AtLeastLibvips(8, 9))
+ {
+ SourceType = NetVips.TypeFromName("VipsSource");
+ TargetType = NetVips.TypeFromName("VipsTarget");
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public GValue()
+ {
+ Struct = new Internal.GValue.Struct();
+ }
+
+ ///
+ /// Initializes a new instance of the class
+ /// with the specified struct to wrap around.
+ ///
+ /// The specified struct to wrap around.
+ internal GValue(Internal.GValue.Struct value)
+ {
+ Struct = value;
+ }
+
+ ///
+ /// Set the type of a GValue.
+ ///
+ ///
+ /// GValues have a set type, fixed at creation time. Use SetType to set
+ /// the type of a GValue before assigning to it.
+ ///
+ /// GTypes are 32 or 64-bit integers (depending on the platform). See
+ /// TypeFind.
+ ///
+ /// Type the GValue should hold values of.
+ public void SetType(nint gtype)
+ {
+ Internal.GValue.Init(ref Struct, gtype);
+ }
+
+ ///
+ /// Ensure that the GC knows the true cost of the object during collection.
+ ///
+ ///
+ /// If the object is actually bigger than the managed size reflects, it may
+ /// be a candidate for quick(er) collection.
+ ///
+ /// The amount of unmanaged memory that has been allocated.
+ private void AddMemoryPressure(long bytesAllocated)
+ {
+ if (bytesAllocated <= 0)
+ {
+ return;
+ }
+
+ GC.AddMemoryPressure(bytesAllocated);
+ _memoryPressure += bytesAllocated;
+ }
+
+ ///
+ /// Set a GValue.
+ ///
+ ///
+ /// The value is converted to the type of the GValue, if possible, and
+ /// assigned.
+ ///
+ /// Value to be set.
+ public void Set(object value)
+ {
+ var gtype = GetTypeOf();
+ var fundamental = GType.Fundamental(gtype);
+ if (gtype == GBoolType)
+ {
+ Internal.GValue.SetBoolean(ref Struct, Convert.ToBoolean(value));
+ }
+ else if (gtype == GIntType)
+ {
+ Internal.GValue.SetInt(ref Struct, Convert.ToInt32(value));
+ }
+ else if (gtype == GUint64Type)
+ {
+ Internal.GValue.SetUint64(ref Struct, Convert.ToUInt64(value));
+ }
+ else if (gtype == GDoubleType)
+ {
+ Internal.GValue.SetDouble(ref Struct, Convert.ToDouble(value));
+ }
+ else if (fundamental == GEnumType)
+ {
+ Internal.GValue.SetEnum(ref Struct, Convert.ToInt32(value));
+ }
+ else if (fundamental == GFlagsType)
+ {
+ Internal.GValue.SetFlags(ref Struct, Convert.ToUInt32(value));
+ }
+ else if (gtype == GStrType)
+ {
+ var bytes = Encoding.UTF8.GetBytes(Convert.ToString(value) +
+ char.MinValue); // Ensure null-terminated string
+ Internal.GValue.SetString(ref Struct, bytes);
+ }
+ else if (gtype == RefStrType)
+ {
+ var bytes = Encoding.UTF8.GetBytes(Convert.ToString(value) +
+ char.MinValue); // Ensure null-terminated string
+ VipsValue.SetRefString(ref Struct, bytes);
+ }
+ else if (fundamental == GObjectType && value is GObject gObject)
+ {
+ AddMemoryPressure(gObject.MemoryPressure);
+ Internal.GValue.SetObject(ref Struct, gObject);
+ }
+ else if (gtype == ArrayIntType)
+ {
+ if (value is not IEnumerable)
+ {
+ value = new[] { value };
+ }
+
+ var integers = value switch
+ {
+ int[] ints => ints,
+ double[] doubles => Array.ConvertAll(doubles, Convert.ToInt32),
+ object[] objects => Array.ConvertAll(objects, Convert.ToInt32),
+ _ => throw new ArgumentException(
+ $"unsupported value type {value.GetType()} for gtype {NetVips.TypeName(gtype)}")
+ };
+
+ VipsValue.SetArrayInt(ref Struct, integers, integers.Length);
+ }
+ else if (gtype == ArrayDoubleType)
+ {
+ if (value is not IEnumerable)
+ {
+ value = new[] { value };
+ }
+
+ var doubles = value switch
+ {
+ double[] dbls => dbls,
+ int[] ints => Array.ConvertAll(ints, Convert.ToDouble),
+ object[] objects => Array.ConvertAll(objects, Convert.ToDouble),
+ _ => throw new ArgumentException(
+ $"unsupported value type {value.GetType()} for gtype {NetVips.TypeName(gtype)}")
+ };
+
+ VipsValue.SetArrayDouble(ref Struct, doubles, doubles.Length);
+ }
+ else if (gtype == ArrayImageType && value is Image[] images)
+ {
+ var size = images.Length;
+ VipsValue.SetArrayImage(ref Struct, size);
+
+ var ptrArr = VipsValue.GetArrayImage(in Struct, out _);
+
+ for (var i = 0; i < size; i++)
+ {
+ ref var image = ref images[i];
+
+ // the gvalue needs a ref on each of the images
+ Marshal.WriteIntPtr(ptrArr, i * IntPtr.Size, image.ObjectRef());
+
+ AddMemoryPressure(image.MemoryPressure);
+ }
+ }
+ else if (gtype == BlobType && value is VipsBlob blob)
+ {
+ AddMemoryPressure((long)blob.Length);
+ Internal.GValue.SetBoxed(ref Struct, blob);
+ }
+ else if (gtype == BlobType)
+ {
+ var memory = value switch
+ {
+ string strValue => Encoding.UTF8.GetBytes(strValue),
+ char[] charArrValue => Encoding.UTF8.GetBytes(charArrValue),
+ byte[] byteArrValue => byteArrValue,
+ _ => throw new ArgumentException(
+ $"unsupported value type {value.GetType()} for gtype {NetVips.TypeName(gtype)}")
+ };
+
+ // We need to set the blob to a copy of the string that vips can own
+ var ptr = GLib.GMalloc((ulong)memory.Length);
+ Marshal.Copy(memory, 0, ptr, memory.Length);
+
+ AddMemoryPressure(memory.Length);
+
+ if (NetVips.AtLeastLibvips(8, 6))
+ {
+ VipsValue.SetBlobFree(ref Struct, ptr, (ulong)memory.Length);
+ }
+ else
+ {
+ int FreeFn(nint a, nint b)
+ {
+ GLib.GFree(a);
+
+ return 0;
+ }
+
+ VipsValue.SetBlob(ref Struct, FreeFn, ptr, (ulong)memory.Length);
+ }
+ }
+ else
+ {
+ throw new ArgumentException(
+ $"unsupported gtype for set {NetVips.TypeName(gtype)}, fundamental {NetVips.TypeName(fundamental)}, value type {value.GetType()}");
+ }
+ }
+
+ ///
+ /// Get the contents of a GValue.
+ ///
+ ///
+ /// The contents of the GValue are read out as a C# type.
+ ///
+ /// The contents of this GValue.
+ public object Get()
+ {
+ var gtype = GetTypeOf();
+ var fundamental = GType.Fundamental(gtype);
+
+ object result;
+ if (gtype == GBoolType)
+ {
+ result = Internal.GValue.GetBoolean(in Struct);
+ }
+ else if (gtype == GIntType)
+ {
+ result = Internal.GValue.GetInt(in Struct);
+ }
+ else if (gtype == GUint64Type)
+ {
+ result = Internal.GValue.GetUint64(in Struct);
+ }
+ else if (gtype == GDoubleType)
+ {
+ result = Internal.GValue.GetDouble(in Struct);
+ }
+ else if (fundamental == GEnumType)
+ {
+ result = Internal.GValue.GetEnum(in Struct);
+ }
+ else if (fundamental == GFlagsType)
+ {
+ result = Internal.GValue.GetFlags(in Struct);
+ }
+ else if (gtype == GStrType)
+ {
+ result = Internal.GValue.GetString(in Struct).ToUtf8String();
+ }
+ else if (gtype == RefStrType)
+ {
+ result = VipsValue.GetRefString(in Struct, out var size).ToUtf8String(size: (int)size);
+ }
+ else if (gtype == ImageType)
+ {
+ // g_value_get_object() will not add a ref ... that is
+ // held by the gvalue
+ var vi = Internal.GValue.GetObject(in Struct);
+
+ // we want a ref that will last with the life of the vimage:
+ // this ref is matched by the unref that's attached to finalize
+ // by GObject
+ var image = new Image(vi);
+ image.ObjectRef();
+
+ result = image;
+ }
+ else if (gtype == ArrayIntType)
+ {
+ var intPtr = VipsValue.GetArrayInt(in Struct, out var size);
+
+ var intArr = new int[size];
+ Marshal.Copy(intPtr, intArr, 0, size);
+ result = intArr;
+ }
+ else if (gtype == ArrayDoubleType)
+ {
+ var intPtr = VipsValue.GetArrayDouble(in Struct, out var size);
+
+ var doubleArr = new double[size];
+ Marshal.Copy(intPtr, doubleArr, 0, size);
+ result = doubleArr;
+ }
+ else if (gtype == ArrayImageType)
+ {
+ var ptrArr = VipsValue.GetArrayImage(in Struct, out var size);
+
+ var images = new Image[size];
+ for (var i = 0; i < size; i++)
+ {
+ var vi = Marshal.ReadIntPtr(ptrArr, i * IntPtr.Size);
+ ref var image = ref images[i];
+ image = new Image(vi);
+ image.ObjectRef();
+ }
+
+ result = images;
+ }
+ else if (gtype == BlobType)
+ {
+ var array = VipsValue.GetBlob(in Struct, out var size);
+
+ // Blob types are returned as an array of bytes.
+ var byteArr = new byte[size];
+ Marshal.Copy(array, byteArr, 0, (int)size);
+ result = byteArr;
+ }
+ else
+ {
+ throw new ArgumentException($"unsupported gtype for get {NetVips.TypeName(gtype)}");
+ }
+
+ return result;
+ }
+
+ ///
+ /// Get the GType of this GValue.
+ ///
+ /// The GType of this GValue.
+ public nint GetTypeOf()
+ {
+ return Struct.GType;
+ }
+
+ ///
+ /// Finalizes an instance of the class.
+ ///
+ ///
+ /// Allows an object to try to free resources and perform other cleanup
+ /// operations before it is reclaimed by garbage collection.
+ ///
+ ~GValue()
+ {
+ // Do not re-create Dispose clean-up code here.
+ Dispose(false);
+ }
+
+ ///
+ /// Releases unmanaged and - optionally - managed resources.
+ ///
+ /// to release both managed and unmanaged resources;
+ /// to release only unmanaged resources.
+ protected void Dispose(bool disposing)
+ {
+ // Check to see if Dispose has already been called.
+ if (!_disposed)
+ {
+ // and tag it to be unset on GC as well
+ Internal.GValue.Unset(ref Struct);
+
+ if (_memoryPressure > 0)
+ {
+ GC.RemoveMemoryPressure(_memoryPressure);
+ _memoryPressure = 0;
+ }
+
+ // Note disposing has been done.
+ _disposed = true;
+ }
+ }
+
+ ///
+ /// Performs application-defined tasks associated with freeing, releasing,
+ /// or resetting unmanaged resources.
+ ///
+ public void Dispose()
+ {
+ Dispose(true);
+
+ // This object will be cleaned up by the Dispose method.
+ GC.SuppressFinalize(this);
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/Image.Generated.cs b/vendor/NetVips/Image.Generated.cs
new file mode 100644
index 0000000..1c56e29
--- /dev/null
+++ b/vendor/NetVips/Image.Generated.cs
@@ -0,0 +1,11770 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// libvips version: 8.17.0
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+using System.IO;
+
+namespace NetVips;
+
+public partial class Image
+{
+ #region auto-generated functions
+
+ ///
+ /// Absolute value of an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Abs();
+ ///
+ ///
+ /// A new .
+ public Image Abs()
+ {
+ return this.Call("abs") as Image;
+ }
+
+ ///
+ /// Add two images.
+ ///
+ ///
+ ///
+ /// using Image @out = left.Add(right);
+ ///
+ ///
+ /// Right-hand image argument.
+ /// A new .
+ public Image Add(Image right)
+ {
+ return this.Call("add", right) as Image;
+ }
+
+ ///
+ /// Affine transform of an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Affine(matrix, interpolate: GObject, oarea: int[], odx: double, ody: double, idx: double, idy: double, background: double[], premultiplied: bool, extend: Enums.Extend);
+ ///
+ ///
+ /// Transformation matrix.
+ /// Interpolate pixels with this.
+ /// Area of output to generate.
+ /// Horizontal output displacement.
+ /// Vertical output displacement.
+ /// Horizontal input displacement.
+ /// Vertical input displacement.
+ /// Background value.
+ /// Images have premultiplied alpha.
+ /// How to generate the extra pixels.
+ /// A new .
+ public Image Affine(double[] matrix, GObject interpolate = null, int[] oarea = null, double? odx = null, double? ody = null, double? idx = null, double? idy = null, double[] background = null, bool? premultiplied = null, Enums.Extend? extend = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(interpolate), interpolate);
+ options.AddIfPresent(nameof(oarea), oarea);
+ options.AddIfPresent(nameof(odx), odx);
+ options.AddIfPresent(nameof(ody), ody);
+ options.AddIfPresent(nameof(idx), idx);
+ options.AddIfPresent(nameof(idy), idy);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent(nameof(premultiplied), premultiplied);
+ options.AddIfPresent(nameof(extend), extend);
+
+ return this.Call("affine", options, matrix) as Image;
+ }
+
+ ///
+ /// Load an Analyze6 image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Analyzeload(filename, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Analyzeload(string filename, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("analyzeload", options, filename) as Image;
+ }
+
+ ///
+ /// Load an Analyze6 image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Analyzeload(filename, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Analyzeload(string filename, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("analyzeload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Join an array of images.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Arrayjoin(@in, across: int, shim: int, background: double[], halign: Enums.Align, valign: Enums.Align, hspacing: int, vspacing: int);
+ ///
+ ///
+ /// Array of input images.
+ /// Number of images across grid.
+ /// Pixels between images.
+ /// Colour for new pixels.
+ /// Align on the left, centre or right.
+ /// Align on the top, centre or bottom.
+ /// Horizontal spacing between images.
+ /// Vertical spacing between images.
+ /// A new .
+ public static Image Arrayjoin(Image[] @in, int? across = null, int? shim = null, double[] background = null, Enums.Align? halign = null, Enums.Align? valign = null, int? hspacing = null, int? vspacing = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(across), across);
+ options.AddIfPresent(nameof(shim), shim);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent(nameof(halign), halign);
+ options.AddIfPresent(nameof(valign), valign);
+ options.AddIfPresent(nameof(hspacing), hspacing);
+ options.AddIfPresent(nameof(vspacing), vspacing);
+
+ return Operation.Call("arrayjoin", options, new object[] { @in }) as Image;
+ }
+
+ ///
+ /// Autorotate image by exif tag.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Autorot();
+ ///
+ ///
+ /// A new .
+ public Image Autorot()
+ {
+ return this.Call("autorot") as Image;
+ }
+
+ ///
+ /// Autorotate image by exif tag.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Autorot(out var angle);
+ ///
+ ///
+ /// Angle image was rotated by.
+ /// A new .
+ public Image Autorot(out Enums.Angle angle)
+ {
+ var optionalOutput = new VOption
+ {
+ {"angle", true}
+ };
+
+ var results = this.Call("autorot", optionalOutput) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ angle = (Enums.Angle)opts?["angle"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Autorotate image by exif tag.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Autorot(out var angle, out var flip);
+ ///
+ ///
+ /// Angle image was rotated by.
+ /// Whether the image was flipped or not.
+ /// A new .
+ public Image Autorot(out Enums.Angle angle, out bool flip)
+ {
+ var optionalOutput = new VOption
+ {
+ {"angle", true},
+ {"flip", true}
+ };
+
+ var results = this.Call("autorot", optionalOutput) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ angle = (Enums.Angle)opts?["angle"];
+ flip = opts?["flip"] is bool out2 && out2;
+
+ return finalResult;
+ }
+
+ ///
+ /// Find image average.
+ ///
+ ///
+ ///
+ /// double @out = in.Avg();
+ ///
+ ///
+ /// A double.
+ public double Avg()
+ {
+ return this.Call("avg") is double result ? result : 0d;
+ }
+
+ ///
+ /// Boolean operation across image bands.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Bandbool(boolean);
+ ///
+ ///
+ /// Boolean to perform.
+ /// A new .
+ public Image Bandbool(Enums.OperationBoolean boolean)
+ {
+ return this.Call("bandbool", boolean) as Image;
+ }
+
+ ///
+ /// Fold up x axis into bands.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Bandfold(factor: int);
+ ///
+ ///
+ /// Fold by this factor.
+ /// A new .
+ public Image Bandfold(int? factor = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(factor), factor);
+
+ return this.Call("bandfold", options) as Image;
+ }
+
+ ///
+ /// Append a constant band to an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.BandjoinConst(c);
+ ///
+ ///
+ /// Array of constants to add.
+ /// A new .
+ public Image BandjoinConst(double[] c)
+ {
+ return this.Call("bandjoin_const", c) as Image;
+ }
+
+ ///
+ /// Band-wise average.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Bandmean();
+ ///
+ ///
+ /// A new .
+ public Image Bandmean()
+ {
+ return this.Call("bandmean") as Image;
+ }
+
+ ///
+ /// Unfold image bands into x axis.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Bandunfold(factor: int);
+ ///
+ ///
+ /// Unfold by this factor.
+ /// A new .
+ public Image Bandunfold(int? factor = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(factor), factor);
+
+ return this.Call("bandunfold", options) as Image;
+ }
+
+ ///
+ /// Make a black image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Black(width, height, bands: int);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Number of bands in image.
+ /// A new .
+ public static Image Black(int width, int height, int? bands = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(bands), bands);
+
+ return Operation.Call("black", options, width, height) as Image;
+ }
+
+ ///
+ /// Boolean operation on two images.
+ ///
+ ///
+ ///
+ /// using Image @out = left.Boolean(right, boolean);
+ ///
+ ///
+ /// Right-hand image argument.
+ /// Boolean to perform.
+ /// A new .
+ public Image Boolean(Image right, Enums.OperationBoolean boolean)
+ {
+ return this.Call("boolean", right, boolean) as Image;
+ }
+
+ ///
+ /// Boolean operations against a constant.
+ ///
+ ///
+ ///
+ /// using Image @out = in.BooleanConst(boolean, c);
+ ///
+ ///
+ /// Boolean to perform.
+ /// Array of constants.
+ /// A new .
+ public Image BooleanConst(Enums.OperationBoolean boolean, double[] c)
+ {
+ return this.Call("boolean_const", boolean, c) as Image;
+ }
+
+ ///
+ /// Build a look-up table.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Buildlut();
+ ///
+ ///
+ /// A new .
+ public Image Buildlut()
+ {
+ return this.Call("buildlut") as Image;
+ }
+
+ ///
+ /// Byteswap an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Byteswap();
+ ///
+ ///
+ /// A new .
+ public Image Byteswap()
+ {
+ return this.Call("byteswap") as Image;
+ }
+
+ ///
+ /// Canny edge detector.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Canny(sigma: double, precision: Enums.Precision);
+ ///
+ ///
+ /// Sigma of Gaussian.
+ /// Convolve with this precision.
+ /// A new .
+ public Image Canny(double? sigma = null, Enums.Precision? precision = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(sigma), sigma);
+ options.AddIfPresent(nameof(precision), precision);
+
+ return this.Call("canny", options) as Image;
+ }
+
+ ///
+ /// Cast an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Cast(format, shift: bool);
+ ///
+ ///
+ /// Format to cast to.
+ /// Shift integer values up and down.
+ /// A new .
+ public Image Cast(Enums.BandFormat format, bool? shift = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(shift), shift);
+
+ return this.Call("cast", options, format) as Image;
+ }
+
+ ///
+ /// Clamp values of an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Clamp(min: double, max: double);
+ ///
+ ///
+ /// Minimum value.
+ /// Maximum value.
+ /// A new .
+ public Image Clamp(double? min = null, double? max = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(min), min);
+ options.AddIfPresent(nameof(max), max);
+
+ return this.Call("clamp", options) as Image;
+ }
+
+ ///
+ /// Transform LCh to CMC.
+ ///
+ ///
+ ///
+ /// using Image @out = in.CMC2LCh();
+ ///
+ ///
+ /// A new .
+ public Image CMC2LCh()
+ {
+ return this.Call("CMC2LCh") as Image;
+ }
+
+ ///
+ /// Transform CMYK to XYZ.
+ ///
+ ///
+ ///
+ /// using Image @out = in.CMYK2XYZ();
+ ///
+ ///
+ /// A new .
+ public Image CMYK2XYZ()
+ {
+ return this.Call("CMYK2XYZ") as Image;
+ }
+
+ ///
+ /// Convert to a new colorspace.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Colourspace(space, sourceSpace: Enums.Interpretation);
+ ///
+ ///
+ /// Destination color space.
+ /// Source color space.
+ /// A new .
+ public Image Colourspace(Enums.Interpretation space, Enums.Interpretation? sourceSpace = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("source_space", sourceSpace);
+
+ return this.Call("colourspace", options, space) as Image;
+ }
+
+ ///
+ /// Convolve with rotating mask.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Compass(mask, times: int, angle: Enums.Angle45, combine: Enums.Combine, precision: Enums.Precision, layers: int, cluster: int);
+ ///
+ ///
+ /// Input matrix image.
+ /// Rotate and convolve this many times.
+ /// Rotate mask by this much between convolutions.
+ /// Combine convolution results like this.
+ /// Convolve with this precision.
+ /// Use this many layers in approximation.
+ /// Cluster lines closer than this in approximation.
+ /// A new .
+ public Image Compass(Image mask, int? times = null, Enums.Angle45? angle = null, Enums.Combine? combine = null, Enums.Precision? precision = null, int? layers = null, int? cluster = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(times), times);
+ options.AddIfPresent(nameof(angle), angle);
+ options.AddIfPresent(nameof(combine), combine);
+ options.AddIfPresent(nameof(precision), precision);
+ options.AddIfPresent(nameof(layers), layers);
+ options.AddIfPresent(nameof(cluster), cluster);
+
+ return this.Call("compass", options, mask) as Image;
+ }
+
+ ///
+ /// Perform a complex operation on an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Complex(cmplx);
+ ///
+ ///
+ /// Complex to perform.
+ /// A new .
+ public Image Complex(Enums.OperationComplex cmplx)
+ {
+ return this.Call("complex", cmplx) as Image;
+ }
+
+ ///
+ /// Complex binary operations on two images.
+ ///
+ ///
+ ///
+ /// using Image @out = left.Complex2(right, cmplx);
+ ///
+ ///
+ /// Right-hand image argument.
+ /// Binary complex operation to perform.
+ /// A new .
+ public Image Complex2(Image right, Enums.OperationComplex2 cmplx)
+ {
+ return this.Call("complex2", right, cmplx) as Image;
+ }
+
+ ///
+ /// Form a complex image from two real images.
+ ///
+ ///
+ ///
+ /// using Image @out = left.Complexform(right);
+ ///
+ ///
+ /// Right-hand image argument.
+ /// A new .
+ public Image Complexform(Image right)
+ {
+ return this.Call("complexform", right) as Image;
+ }
+
+ ///
+ /// Get a component from a complex image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Complexget(get);
+ ///
+ ///
+ /// Complex to perform.
+ /// A new .
+ public Image Complexget(Enums.OperationComplexget get)
+ {
+ return this.Call("complexget", get) as Image;
+ }
+
+ ///
+ /// Blend a pair of images with a blend mode.
+ ///
+ ///
+ ///
+ /// using Image @out = base.Composite2(overlay, mode, x: int, y: int, compositingSpace: Enums.Interpretation, premultiplied: bool);
+ ///
+ ///
+ /// Overlay image.
+ /// VipsBlendMode to join with.
+ /// x position of overlay.
+ /// y position of overlay.
+ /// Composite images in this colour space.
+ /// Images have premultiplied alpha.
+ /// A new .
+ public Image Composite2(Image overlay, Enums.BlendMode mode, int? x = null, int? y = null, Enums.Interpretation? compositingSpace = null, bool? premultiplied = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(x), x);
+ options.AddIfPresent(nameof(y), y);
+ options.AddIfPresent("compositing_space", compositingSpace);
+ options.AddIfPresent(nameof(premultiplied), premultiplied);
+
+ return this.Call("composite2", options, overlay, mode) as Image;
+ }
+
+ ///
+ /// Convolution operation.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Conv(mask, precision: Enums.Precision, layers: int, cluster: int);
+ ///
+ ///
+ /// Input matrix image.
+ /// Convolve with this precision.
+ /// Use this many layers in approximation.
+ /// Cluster lines closer than this in approximation.
+ /// A new .
+ public Image Conv(Image mask, Enums.Precision? precision = null, int? layers = null, int? cluster = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(precision), precision);
+ options.AddIfPresent(nameof(layers), layers);
+ options.AddIfPresent(nameof(cluster), cluster);
+
+ return this.Call("conv", options, mask) as Image;
+ }
+
+ ///
+ /// Approximate integer convolution.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Conva(mask, layers: int, cluster: int);
+ ///
+ ///
+ /// Input matrix image.
+ /// Use this many layers in approximation.
+ /// Cluster lines closer than this in approximation.
+ /// A new .
+ public Image Conva(Image mask, int? layers = null, int? cluster = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(layers), layers);
+ options.AddIfPresent(nameof(cluster), cluster);
+
+ return this.Call("conva", options, mask) as Image;
+ }
+
+ ///
+ /// Approximate separable integer convolution.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Convasep(mask, layers: int);
+ ///
+ ///
+ /// Input matrix image.
+ /// Use this many layers in approximation.
+ /// A new .
+ public Image Convasep(Image mask, int? layers = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(layers), layers);
+
+ return this.Call("convasep", options, mask) as Image;
+ }
+
+ ///
+ /// Float convolution operation.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Convf(mask);
+ ///
+ ///
+ /// Input matrix image.
+ /// A new .
+ public Image Convf(Image mask)
+ {
+ return this.Call("convf", mask) as Image;
+ }
+
+ ///
+ /// Int convolution operation.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Convi(mask);
+ ///
+ ///
+ /// Input matrix image.
+ /// A new .
+ public Image Convi(Image mask)
+ {
+ return this.Call("convi", mask) as Image;
+ }
+
+ ///
+ /// Separable convolution operation.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Convsep(mask, precision: Enums.Precision, layers: int, cluster: int);
+ ///
+ ///
+ /// Input matrix image.
+ /// Convolve with this precision.
+ /// Use this many layers in approximation.
+ /// Cluster lines closer than this in approximation.
+ /// A new .
+ public Image Convsep(Image mask, Enums.Precision? precision = null, int? layers = null, int? cluster = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(precision), precision);
+ options.AddIfPresent(nameof(layers), layers);
+ options.AddIfPresent(nameof(cluster), cluster);
+
+ return this.Call("convsep", options, mask) as Image;
+ }
+
+ ///
+ /// Copy an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Copy(width: int, height: int, bands: int, format: Enums.BandFormat, coding: Enums.Coding, interpretation: Enums.Interpretation, xres: double, yres: double, xoffset: int, yoffset: int);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Number of bands in image.
+ /// Pixel format in image.
+ /// Pixel coding.
+ /// Pixel interpretation.
+ /// Horizontal resolution in pixels/mm.
+ /// Vertical resolution in pixels/mm.
+ /// Horizontal offset of origin.
+ /// Vertical offset of origin.
+ /// A new .
+ public Image Copy(int? width = null, int? height = null, int? bands = null, Enums.BandFormat? format = null, Enums.Coding? coding = null, Enums.Interpretation? interpretation = null, double? xres = null, double? yres = null, int? xoffset = null, int? yoffset = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(width), width);
+ options.AddIfPresent(nameof(height), height);
+ options.AddIfPresent(nameof(bands), bands);
+ options.AddIfPresent(nameof(format), format);
+ options.AddIfPresent(nameof(coding), coding);
+ options.AddIfPresent(nameof(interpretation), interpretation);
+ options.AddIfPresent(nameof(xres), xres);
+ options.AddIfPresent(nameof(yres), yres);
+ options.AddIfPresent(nameof(xoffset), xoffset);
+ options.AddIfPresent(nameof(yoffset), yoffset);
+
+ return this.Call("copy", options) as Image;
+ }
+
+ ///
+ /// Count lines in an image.
+ ///
+ ///
+ ///
+ /// double nolines = in.Countlines(direction);
+ ///
+ ///
+ /// Countlines left-right or up-down.
+ /// A double.
+ public double Countlines(Enums.Direction direction)
+ {
+ return this.Call("countlines", direction) is double result ? result : 0d;
+ }
+
+ ///
+ /// Load csv.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Csvload(filename, skip: int, lines: int, whitespace: string, separator: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Skip this many lines at the start of the file.
+ /// Read this many lines from the file.
+ /// Set of whitespace characters.
+ /// Set of separator characters.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Csvload(string filename, int? skip = null, int? lines = null, string whitespace = null, string separator = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(skip), skip);
+ options.AddIfPresent(nameof(lines), lines);
+ options.AddIfPresent(nameof(whitespace), whitespace);
+ options.AddIfPresent(nameof(separator), separator);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("csvload", options, filename) as Image;
+ }
+
+ ///
+ /// Load csv.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Csvload(filename, out var flags, skip: int, lines: int, whitespace: string, separator: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Skip this many lines at the start of the file.
+ /// Read this many lines from the file.
+ /// Set of whitespace characters.
+ /// Set of separator characters.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Csvload(string filename, out Enums.ForeignFlags flags, int? skip = null, int? lines = null, string whitespace = null, string separator = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(skip), skip);
+ options.AddIfPresent(nameof(lines), lines);
+ options.AddIfPresent(nameof(whitespace), whitespace);
+ options.AddIfPresent(nameof(separator), separator);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("csvload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load csv.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.CsvloadSource(source, skip: int, lines: int, whitespace: string, separator: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Skip this many lines at the start of the file.
+ /// Read this many lines from the file.
+ /// Set of whitespace characters.
+ /// Set of separator characters.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image CsvloadSource(Source source, int? skip = null, int? lines = null, string whitespace = null, string separator = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(skip), skip);
+ options.AddIfPresent(nameof(lines), lines);
+ options.AddIfPresent(nameof(whitespace), whitespace);
+ options.AddIfPresent(nameof(separator), separator);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("csvload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load csv.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.CsvloadStream(stream, skip: int, lines: int, whitespace: string, separator: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Skip this many lines at the start of the file.
+ /// Read this many lines from the file.
+ /// Set of whitespace characters.
+ /// Set of separator characters.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image CsvloadStream(Stream stream, int? skip = null, int? lines = null, string whitespace = null, string separator = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = CsvloadSource(source, skip, lines, whitespace, separator, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load csv.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.CsvloadSource(source, out var flags, skip: int, lines: int, whitespace: string, separator: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// Skip this many lines at the start of the file.
+ /// Read this many lines from the file.
+ /// Set of whitespace characters.
+ /// Set of separator characters.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image CsvloadSource(Source source, out Enums.ForeignFlags flags, int? skip = null, int? lines = null, string whitespace = null, string separator = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(skip), skip);
+ options.AddIfPresent(nameof(lines), lines);
+ options.AddIfPresent(nameof(whitespace), whitespace);
+ options.AddIfPresent(nameof(separator), separator);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("csvload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load csv.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.CsvloadStream(stream, out var flags, skip: int, lines: int, whitespace: string, separator: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// Skip this many lines at the start of the file.
+ /// Read this many lines from the file.
+ /// Set of whitespace characters.
+ /// Set of separator characters.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image CsvloadStream(Stream stream, out Enums.ForeignFlags flags, int? skip = null, int? lines = null, string whitespace = null, string separator = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = CsvloadSource(source, out flags, skip, lines, whitespace, separator, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Save image to csv.
+ ///
+ ///
+ ///
+ /// in.Csvsave(filename, separator: string, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Separator characters.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Csvsave(string filename, string separator = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(separator), separator);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("csvsave", options, filename);
+ }
+
+ ///
+ /// Save image to csv.
+ ///
+ ///
+ ///
+ /// in.CsvsaveTarget(target, separator: string, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Target to save to.
+ /// Separator characters.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void CsvsaveTarget(Target target, string separator = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(separator), separator);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("csvsave_target", options, target);
+ }
+
+ ///
+ /// Save image to csv.
+ ///
+ ///
+ ///
+ /// in.CsvsaveStream(stream, separator: string, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Stream to save to.
+ /// Separator characters.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void CsvsaveStream(Stream stream, string separator = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ CsvsaveTarget(target, separator, keep, background, pageHeight, profile);
+ }
+
+ ///
+ /// Calculate dE00.
+ ///
+ ///
+ ///
+ /// using Image @out = left.DE00(right);
+ ///
+ ///
+ /// Right-hand input image.
+ /// A new .
+ public Image DE00(Image right)
+ {
+ return this.Call("dE00", right) as Image;
+ }
+
+ ///
+ /// Calculate dE76.
+ ///
+ ///
+ ///
+ /// using Image @out = left.DE76(right);
+ ///
+ ///
+ /// Right-hand input image.
+ /// A new .
+ public Image DE76(Image right)
+ {
+ return this.Call("dE76", right) as Image;
+ }
+
+ ///
+ /// Calculate dECMC.
+ ///
+ ///
+ ///
+ /// using Image @out = left.DECMC(right);
+ ///
+ ///
+ /// Right-hand input image.
+ /// A new .
+ public Image DECMC(Image right)
+ {
+ return this.Call("dECMC", right) as Image;
+ }
+
+ ///
+ /// Find image standard deviation.
+ ///
+ ///
+ ///
+ /// double @out = in.Deviate();
+ ///
+ ///
+ /// A double.
+ public double Deviate()
+ {
+ return this.Call("deviate") is double result ? result : 0d;
+ }
+
+ ///
+ /// Divide two images.
+ ///
+ ///
+ ///
+ /// using Image @out = left.Divide(right);
+ ///
+ ///
+ /// Right-hand image argument.
+ /// A new .
+ public Image Divide(Image right)
+ {
+ return this.Call("divide", right) as Image;
+ }
+
+ ///
+ /// Save image to deepzoom file.
+ ///
+ ///
+ ///
+ /// in.Dzsave(filename, imagename: string, layout: Enums.ForeignDzLayout, suffix: string, overlap: int, tileSize: int, centre: bool, depth: Enums.ForeignDzDepth, angle: Enums.Angle, container: Enums.ForeignDzContainer, compression: int, regionShrink: Enums.RegionShrink, skipBlanks: int, id: string, q: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Image name.
+ /// Directory layout.
+ /// Filename suffix for tiles.
+ /// Tile overlap in pixels.
+ /// Tile size in pixels.
+ /// Center image in tile.
+ /// Pyramid depth.
+ /// Rotate image during save.
+ /// Pyramid container type.
+ /// ZIP deflate compression level.
+ /// Method to shrink regions.
+ /// Skip tiles which are nearly equal to the background.
+ /// Resource ID.
+ /// Q factor.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Dzsave(string filename, string imagename = null, Enums.ForeignDzLayout? layout = null, string suffix = null, int? overlap = null, int? tileSize = null, bool? centre = null, Enums.ForeignDzDepth? depth = null, Enums.Angle? angle = null, Enums.ForeignDzContainer? container = null, int? compression = null, Enums.RegionShrink? regionShrink = null, int? skipBlanks = null, string id = null, int? q = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(NetVips.AtLeastLibvips(8, 15) ? nameof(imagename) : "basename", imagename);
+ options.AddIfPresent(nameof(layout), layout);
+ options.AddIfPresent(nameof(suffix), suffix);
+ options.AddIfPresent(nameof(overlap), overlap);
+ options.AddIfPresent("tile_size", tileSize);
+ options.AddIfPresent(nameof(centre), centre);
+ options.AddIfPresent(nameof(depth), depth);
+ options.AddIfPresent(nameof(angle), angle);
+ options.AddIfPresent(nameof(container), container);
+ options.AddIfPresent(nameof(compression), compression);
+ options.AddIfPresent("region_shrink", regionShrink);
+ options.AddIfPresent("skip_blanks", skipBlanks);
+ options.AddIfPresent(nameof(id), id);
+ options.AddIfPresent("Q", q);
+ options.AddForeignKeep(keep, true);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("dzsave", options, filename);
+ }
+
+ ///
+ /// Save image to dz buffer.
+ ///
+ ///
+ ///
+ /// byte[] buffer = in.DzsaveBuffer(imagename: string, layout: Enums.ForeignDzLayout, suffix: string, overlap: int, tileSize: int, centre: bool, depth: Enums.ForeignDzDepth, angle: Enums.Angle, container: Enums.ForeignDzContainer, compression: int, regionShrink: Enums.RegionShrink, skipBlanks: int, id: string, q: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Image name.
+ /// Directory layout.
+ /// Filename suffix for tiles.
+ /// Tile overlap in pixels.
+ /// Tile size in pixels.
+ /// Center image in tile.
+ /// Pyramid depth.
+ /// Rotate image during save.
+ /// Pyramid container type.
+ /// ZIP deflate compression level.
+ /// Method to shrink regions.
+ /// Skip tiles which are nearly equal to the background.
+ /// Resource ID.
+ /// Q factor.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ /// An array of bytes.
+ public byte[] DzsaveBuffer(string imagename = null, Enums.ForeignDzLayout? layout = null, string suffix = null, int? overlap = null, int? tileSize = null, bool? centre = null, Enums.ForeignDzDepth? depth = null, Enums.Angle? angle = null, Enums.ForeignDzContainer? container = null, int? compression = null, Enums.RegionShrink? regionShrink = null, int? skipBlanks = null, string id = null, int? q = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(NetVips.AtLeastLibvips(8, 15) ? nameof(imagename) : "basename", imagename);
+ options.AddIfPresent(nameof(layout), layout);
+ options.AddIfPresent(nameof(suffix), suffix);
+ options.AddIfPresent(nameof(overlap), overlap);
+ options.AddIfPresent("tile_size", tileSize);
+ options.AddIfPresent(nameof(centre), centre);
+ options.AddIfPresent(nameof(depth), depth);
+ options.AddIfPresent(nameof(angle), angle);
+ options.AddIfPresent(nameof(container), container);
+ options.AddIfPresent(nameof(compression), compression);
+ options.AddIfPresent("region_shrink", regionShrink);
+ options.AddIfPresent("skip_blanks", skipBlanks);
+ options.AddIfPresent(nameof(id), id);
+ options.AddIfPresent("Q", q);
+ options.AddForeignKeep(keep, true);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ return this.Call("dzsave_buffer", options) as byte[];
+ }
+
+ ///
+ /// Save image to deepzoom target.
+ ///
+ ///
+ ///
+ /// in.DzsaveTarget(target, imagename: string, layout: Enums.ForeignDzLayout, suffix: string, overlap: int, tileSize: int, centre: bool, depth: Enums.ForeignDzDepth, angle: Enums.Angle, container: Enums.ForeignDzContainer, compression: int, regionShrink: Enums.RegionShrink, skipBlanks: int, id: string, q: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Target to save to.
+ /// Image name.
+ /// Directory layout.
+ /// Filename suffix for tiles.
+ /// Tile overlap in pixels.
+ /// Tile size in pixels.
+ /// Center image in tile.
+ /// Pyramid depth.
+ /// Rotate image during save.
+ /// Pyramid container type.
+ /// ZIP deflate compression level.
+ /// Method to shrink regions.
+ /// Skip tiles which are nearly equal to the background.
+ /// Resource ID.
+ /// Q factor.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void DzsaveTarget(Target target, string imagename = null, Enums.ForeignDzLayout? layout = null, string suffix = null, int? overlap = null, int? tileSize = null, bool? centre = null, Enums.ForeignDzDepth? depth = null, Enums.Angle? angle = null, Enums.ForeignDzContainer? container = null, int? compression = null, Enums.RegionShrink? regionShrink = null, int? skipBlanks = null, string id = null, int? q = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(NetVips.AtLeastLibvips(8, 15) ? nameof(imagename) : "basename", imagename);
+ options.AddIfPresent(nameof(layout), layout);
+ options.AddIfPresent(nameof(suffix), suffix);
+ options.AddIfPresent(nameof(overlap), overlap);
+ options.AddIfPresent("tile_size", tileSize);
+ options.AddIfPresent(nameof(centre), centre);
+ options.AddIfPresent(nameof(depth), depth);
+ options.AddIfPresent(nameof(angle), angle);
+ options.AddIfPresent(nameof(container), container);
+ options.AddIfPresent(nameof(compression), compression);
+ options.AddIfPresent("region_shrink", regionShrink);
+ options.AddIfPresent("skip_blanks", skipBlanks);
+ options.AddIfPresent(nameof(id), id);
+ options.AddIfPresent("Q", q);
+ options.AddForeignKeep(keep, true);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("dzsave_target", options, target);
+ }
+
+ ///
+ /// Save image to deepzoom stream.
+ ///
+ ///
+ ///
+ /// in.DzsaveStream(stream, imagename: string, layout: Enums.ForeignDzLayout, suffix: string, overlap: int, tileSize: int, centre: bool, depth: Enums.ForeignDzDepth, angle: Enums.Angle, container: Enums.ForeignDzContainer, compression: int, regionShrink: Enums.RegionShrink, skipBlanks: int, id: string, q: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Stream to save to.
+ /// Image name.
+ /// Directory layout.
+ /// Filename suffix for tiles.
+ /// Tile overlap in pixels.
+ /// Tile size in pixels.
+ /// Center image in tile.
+ /// Pyramid depth.
+ /// Rotate image during save.
+ /// Pyramid container type.
+ /// ZIP deflate compression level.
+ /// Method to shrink regions.
+ /// Skip tiles which are nearly equal to the background.
+ /// Resource ID.
+ /// Q factor.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void DzsaveStream(Stream stream, string imagename = null, Enums.ForeignDzLayout? layout = null, string suffix = null, int? overlap = null, int? tileSize = null, bool? centre = null, Enums.ForeignDzDepth? depth = null, Enums.Angle? angle = null, Enums.ForeignDzContainer? container = null, int? compression = null, Enums.RegionShrink? regionShrink = null, int? skipBlanks = null, string id = null, int? q = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ DzsaveTarget(target, imagename, layout, suffix, overlap, tileSize, centre, depth, angle, container, compression, regionShrink, skipBlanks, id, q, keep, background, pageHeight, profile);
+ }
+
+ ///
+ /// Embed an image in a larger image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Embed(x, y, width, height, extend: Enums.Extend, background: double[]);
+ ///
+ ///
+ /// Left edge of input in output.
+ /// Top edge of input in output.
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// How to generate the extra pixels.
+ /// Color for background pixels.
+ /// A new .
+ public Image Embed(int x, int y, int width, int height, Enums.Extend? extend = null, double[] background = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(extend), extend);
+ options.AddIfPresent(nameof(background), background);
+
+ return this.Call("embed", options, x, y, width, height) as Image;
+ }
+
+ ///
+ /// Extract an area from an image.
+ ///
+ ///
+ ///
+ /// using Image @out = input.ExtractArea(left, top, width, height);
+ ///
+ ///
+ /// Left edge of extract area.
+ /// Top edge of extract area.
+ /// Width of extract area.
+ /// Height of extract area.
+ /// A new .
+ public Image ExtractArea(int left, int top, int width, int height)
+ {
+ return this.Call("extract_area", left, top, width, height) as Image;
+ }
+
+ ///
+ /// Extract band from an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.ExtractBand(band, n: int);
+ ///
+ ///
+ /// Band to extract.
+ /// Number of bands to extract.
+ /// A new .
+ public Image ExtractBand(int band, int? n = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(n), n);
+
+ return this.Call("extract_band", options, band) as Image;
+ }
+
+ ///
+ /// Make an image showing the eye's spatial response.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Eye(width, height, uchar: bool, factor: double);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Output an unsigned char image.
+ /// Maximum spatial frequency.
+ /// A new .
+ public static Image Eye(int width, int height, bool? uchar = null, double? factor = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(uchar), uchar);
+ options.AddIfPresent(nameof(factor), factor);
+
+ return Operation.Call("eye", options, width, height) as Image;
+ }
+
+ ///
+ /// False-color an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Falsecolour();
+ ///
+ ///
+ /// A new .
+ public Image Falsecolour()
+ {
+ return this.Call("falsecolour") as Image;
+ }
+
+ ///
+ /// Fast correlation.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Fastcor(@ref);
+ ///
+ ///
+ /// Input reference image.
+ /// A new .
+ public Image Fastcor(Image @ref)
+ {
+ return this.Call("fastcor", @ref) as Image;
+ }
+
+ ///
+ /// Fill image zeros with nearest non-zero pixel.
+ ///
+ ///
+ ///
+ /// using Image @out = in.FillNearest();
+ ///
+ ///
+ /// A new .
+ public Image FillNearest()
+ {
+ return this.Call("fill_nearest") as Image;
+ }
+
+ ///
+ /// Fill image zeros with nearest non-zero pixel.
+ ///
+ ///
+ ///
+ /// using Image @out = in.FillNearest(out var distance);
+ ///
+ ///
+ /// Distance to nearest non-zero pixel.
+ /// A new .
+ public Image FillNearest(out Image distance)
+ {
+ var optionalOutput = new VOption
+ {
+ {"distance", true}
+ };
+
+ var results = this.Call("fill_nearest", optionalOutput) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ distance = opts?["distance"] as Image;
+
+ return finalResult;
+ }
+
+ ///
+ /// Search an image for non-edge areas.
+ ///
+ ///
+ ///
+ /// var output = in.FindTrim(threshold: double, background: double[], lineArt: bool);
+ ///
+ ///
+ /// Object threshold.
+ /// Color for background pixels.
+ /// Enable line art mode.
+ /// An array of objects.
+ public object[] FindTrim(double? threshold = null, double[] background = null, bool? lineArt = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(threshold), threshold);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("line_art", lineArt);
+
+ return this.Call("find_trim", options) as object[];
+ }
+
+ ///
+ /// Load a FITS image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Fitsload(filename, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Fitsload(string filename, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("fitsload", options, filename) as Image;
+ }
+
+ ///
+ /// Load a FITS image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Fitsload(filename, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Fitsload(string filename, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("fitsload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load FITS from a source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.FitsloadSource(source, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image FitsloadSource(Source source, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("fitsload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load FITS from a stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.FitsloadStream(stream, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image FitsloadStream(Stream stream, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = FitsloadSource(source, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load FITS from a source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.FitsloadSource(source, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image FitsloadSource(Source source, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("fitsload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load FITS from a stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.FitsloadStream(stream, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image FitsloadStream(Stream stream, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = FitsloadSource(source, out flags, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Save image to fits file.
+ ///
+ ///
+ ///
+ /// in.Fitssave(filename, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Fitssave(string filename, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("fitssave", options, filename);
+ }
+
+ ///
+ /// Flatten alpha out of an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Flatten(background: double[], maxAlpha: double);
+ ///
+ ///
+ /// Background value.
+ /// Maximum value of alpha channel.
+ /// A new .
+ public Image Flatten(double[] background = null, double? maxAlpha = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("max_alpha", maxAlpha);
+
+ return this.Call("flatten", options) as Image;
+ }
+
+ ///
+ /// Flip an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Flip(direction);
+ ///
+ ///
+ /// Direction to flip image.
+ /// A new .
+ public Image Flip(Enums.Direction direction)
+ {
+ return this.Call("flip", direction) as Image;
+ }
+
+ ///
+ /// Transform float RGB to Radiance coding.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Float2rad();
+ ///
+ ///
+ /// A new .
+ public Image Float2rad()
+ {
+ return this.Call("float2rad") as Image;
+ }
+
+ ///
+ /// Make a fractal surface.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Fractsurf(width, height, fractalDimension);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Fractal dimension.
+ /// A new .
+ public static Image Fractsurf(int width, int height, double fractalDimension)
+ {
+ return Operation.Call("fractsurf", width, height, fractalDimension) as Image;
+ }
+
+ ///
+ /// Frequency-domain filtering.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Freqmult(mask);
+ ///
+ ///
+ /// Input mask image.
+ /// A new .
+ public Image Freqmult(Image mask)
+ {
+ return this.Call("freqmult", mask) as Image;
+ }
+
+ ///
+ /// Forward FFT.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Fwfft();
+ ///
+ ///
+ /// A new .
+ public Image Fwfft()
+ {
+ return this.Call("fwfft") as Image;
+ }
+
+ ///
+ /// Gamma an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Gamma(exponent: double);
+ ///
+ ///
+ /// Gamma factor.
+ /// A new .
+ public Image Gamma(double? exponent = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(exponent), exponent);
+
+ return this.Call("gamma", options) as Image;
+ }
+
+ ///
+ /// Gaussian blur.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Gaussblur(sigma, minAmpl: double, precision: Enums.Precision);
+ ///
+ ///
+ /// Sigma of Gaussian.
+ /// Minimum amplitude of Gaussian.
+ /// Convolve with this precision.
+ /// A new .
+ public Image Gaussblur(double sigma, double? minAmpl = null, Enums.Precision? precision = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("min_ampl", minAmpl);
+ options.AddIfPresent(nameof(precision), precision);
+
+ return this.Call("gaussblur", options, sigma) as Image;
+ }
+
+ ///
+ /// Make a gaussian image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Gaussmat(sigma, minAmpl, separable: bool, precision: Enums.Precision);
+ ///
+ ///
+ /// Sigma of Gaussian.
+ /// Minimum amplitude of Gaussian.
+ /// Generate separable Gaussian.
+ /// Generate with this precision.
+ /// A new .
+ public static Image Gaussmat(double sigma, double minAmpl, bool? separable = null, Enums.Precision? precision = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(separable), separable);
+ options.AddIfPresent(nameof(precision), precision);
+
+ return Operation.Call("gaussmat", options, sigma, minAmpl) as Image;
+ }
+
+ ///
+ /// Make a gaussnoise image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Gaussnoise(width, height, sigma: double, mean: double, seed: int);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Standard deviation of pixels in generated image.
+ /// Mean of pixels in generated image.
+ /// Random number seed.
+ /// A new .
+ public static Image Gaussnoise(int width, int height, double? sigma = null, double? mean = null, int? seed = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(sigma), sigma);
+ options.AddIfPresent(nameof(mean), mean);
+ options.AddIfPresent(nameof(seed), seed);
+
+ return Operation.Call("gaussnoise", options, width, height) as Image;
+ }
+
+ ///
+ /// Read a point from an image.
+ ///
+ ///
+ ///
+ /// double[] outArray = in.Getpoint(x, y, unpackComplex: bool);
+ ///
+ ///
+ /// Point to read.
+ /// Point to read.
+ /// Complex pixels should be unpacked.
+ /// An array of doubles.
+ public double[] Getpoint(int x, int y, bool? unpackComplex = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("unpack_complex", unpackComplex);
+
+ return this.Call("getpoint", options, x, y) as double[];
+ }
+
+ ///
+ /// Load GIF with libnsgif.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Gifload(filename, n: int, page: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Number of pages to load, -1 for all.
+ /// First page to load.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Gifload(string filename, int? n = null, int? page = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("gifload", options, filename) as Image;
+ }
+
+ ///
+ /// Load GIF with libnsgif.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Gifload(filename, out var flags, n: int, page: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Number of pages to load, -1 for all.
+ /// First page to load.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Gifload(string filename, out Enums.ForeignFlags flags, int? n = null, int? page = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("gifload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load GIF with libnsgif.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.GifloadBuffer(buffer, n: int, page: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Number of pages to load, -1 for all.
+ /// First page to load.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image GifloadBuffer(byte[] buffer, int? n = null, int? page = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("gifload_buffer", options, buffer) as Image;
+ }
+
+ ///
+ /// Load GIF with libnsgif.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.GifloadBuffer(buffer, out var flags, n: int, page: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Flags for this file.
+ /// Number of pages to load, -1 for all.
+ /// First page to load.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image GifloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, int? n = null, int? page = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("gifload_buffer", options, buffer) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load gif from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.GifloadSource(source, n: int, page: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Number of pages to load, -1 for all.
+ /// First page to load.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image GifloadSource(Source source, int? n = null, int? page = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("gifload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load gif from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.GifloadStream(stream, n: int, page: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Number of pages to load, -1 for all.
+ /// First page to load.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image GifloadStream(Stream stream, int? n = null, int? page = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = GifloadSource(source, n, page, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load gif from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.GifloadSource(source, out var flags, n: int, page: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// Number of pages to load, -1 for all.
+ /// First page to load.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image GifloadSource(Source source, out Enums.ForeignFlags flags, int? n = null, int? page = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("gifload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load gif from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.GifloadStream(stream, out var flags, n: int, page: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// Number of pages to load, -1 for all.
+ /// First page to load.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image GifloadStream(Stream stream, out Enums.ForeignFlags flags, int? n = null, int? page = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = GifloadSource(source, out flags, n, page, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Save as gif.
+ ///
+ ///
+ ///
+ /// in.Gifsave(filename, dither: double, effort: int, bitdepth: int, interframeMaxerror: double, reuse: bool, interpaletteMaxerror: double, interlace: bool, keepDuplicateFrames: bool, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Amount of dithering.
+ /// Quantisation effort.
+ /// Number of bits per pixel.
+ /// Maximum inter-frame error for transparency.
+ /// Reuse palette from input.
+ /// Maximum inter-palette error for palette reusage.
+ /// Generate an interlaced (progressive) GIF.
+ /// Keep duplicate frames in the output instead of combining them.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Gifsave(string filename, double? dither = null, int? effort = null, int? bitdepth = null, double? interframeMaxerror = null, bool? reuse = null, double? interpaletteMaxerror = null, bool? interlace = null, bool? keepDuplicateFrames = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(dither), dither);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddIfPresent("interframe_maxerror", interframeMaxerror);
+ options.AddIfPresent(nameof(reuse), reuse);
+ options.AddIfPresent("interpalette_maxerror", interpaletteMaxerror);
+ options.AddIfPresent(nameof(interlace), interlace);
+ options.AddIfPresent("keep_duplicate_frames", keepDuplicateFrames);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("gifsave", options, filename);
+ }
+
+ ///
+ /// Save as gif.
+ ///
+ ///
+ ///
+ /// byte[] buffer = in.GifsaveBuffer(dither: double, effort: int, bitdepth: int, interframeMaxerror: double, reuse: bool, interpaletteMaxerror: double, interlace: bool, keepDuplicateFrames: bool, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Amount of dithering.
+ /// Quantisation effort.
+ /// Number of bits per pixel.
+ /// Maximum inter-frame error for transparency.
+ /// Reuse palette from input.
+ /// Maximum inter-palette error for palette reusage.
+ /// Generate an interlaced (progressive) GIF.
+ /// Keep duplicate frames in the output instead of combining them.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ /// An array of bytes.
+ public byte[] GifsaveBuffer(double? dither = null, int? effort = null, int? bitdepth = null, double? interframeMaxerror = null, bool? reuse = null, double? interpaletteMaxerror = null, bool? interlace = null, bool? keepDuplicateFrames = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(dither), dither);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddIfPresent("interframe_maxerror", interframeMaxerror);
+ options.AddIfPresent(nameof(reuse), reuse);
+ options.AddIfPresent("interpalette_maxerror", interpaletteMaxerror);
+ options.AddIfPresent(nameof(interlace), interlace);
+ options.AddIfPresent("keep_duplicate_frames", keepDuplicateFrames);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ return this.Call("gifsave_buffer", options) as byte[];
+ }
+
+ ///
+ /// Save as gif.
+ ///
+ ///
+ ///
+ /// in.GifsaveTarget(target, dither: double, effort: int, bitdepth: int, interframeMaxerror: double, reuse: bool, interpaletteMaxerror: double, interlace: bool, keepDuplicateFrames: bool, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Target to save to.
+ /// Amount of dithering.
+ /// Quantisation effort.
+ /// Number of bits per pixel.
+ /// Maximum inter-frame error for transparency.
+ /// Reuse palette from input.
+ /// Maximum inter-palette error for palette reusage.
+ /// Generate an interlaced (progressive) GIF.
+ /// Keep duplicate frames in the output instead of combining them.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void GifsaveTarget(Target target, double? dither = null, int? effort = null, int? bitdepth = null, double? interframeMaxerror = null, bool? reuse = null, double? interpaletteMaxerror = null, bool? interlace = null, bool? keepDuplicateFrames = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(dither), dither);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddIfPresent("interframe_maxerror", interframeMaxerror);
+ options.AddIfPresent(nameof(reuse), reuse);
+ options.AddIfPresent("interpalette_maxerror", interpaletteMaxerror);
+ options.AddIfPresent(nameof(interlace), interlace);
+ options.AddIfPresent("keep_duplicate_frames", keepDuplicateFrames);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("gifsave_target", options, target);
+ }
+
+ ///
+ /// Save as gif.
+ ///
+ ///
+ ///
+ /// in.GifsaveStream(stream, dither: double, effort: int, bitdepth: int, interframeMaxerror: double, reuse: bool, interpaletteMaxerror: double, interlace: bool, keepDuplicateFrames: bool, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Stream to save to.
+ /// Amount of dithering.
+ /// Quantisation effort.
+ /// Number of bits per pixel.
+ /// Maximum inter-frame error for transparency.
+ /// Reuse palette from input.
+ /// Maximum inter-palette error for palette reusage.
+ /// Generate an interlaced (progressive) GIF.
+ /// Keep duplicate frames in the output instead of combining them.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void GifsaveStream(Stream stream, double? dither = null, int? effort = null, int? bitdepth = null, double? interframeMaxerror = null, bool? reuse = null, double? interpaletteMaxerror = null, bool? interlace = null, bool? keepDuplicateFrames = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ GifsaveTarget(target, dither, effort, bitdepth, interframeMaxerror, reuse, interpaletteMaxerror, interlace, keepDuplicateFrames, keep, background, pageHeight, profile);
+ }
+
+ ///
+ /// Global balance an image mosaic.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Globalbalance(gamma: double, intOutput: bool);
+ ///
+ ///
+ /// Image gamma.
+ /// Integer output.
+ /// A new .
+ public Image Globalbalance(double? gamma = null, bool? intOutput = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(gamma), gamma);
+ options.AddIfPresent("int_output", intOutput);
+
+ return this.Call("globalbalance", options) as Image;
+ }
+
+ ///
+ /// Place an image within a larger image with a certain gravity.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Gravity(direction, width, height, extend: Enums.Extend, background: double[]);
+ ///
+ ///
+ /// Direction to place image within width/height.
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// How to generate the extra pixels.
+ /// Color for background pixels.
+ /// A new .
+ public Image Gravity(Enums.CompassDirection direction, int width, int height, Enums.Extend? extend = null, double[] background = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(extend), extend);
+ options.AddIfPresent(nameof(background), background);
+
+ return this.Call("gravity", options, direction, width, height) as Image;
+ }
+
+ ///
+ /// Make a grey ramp image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Grey(width, height, uchar: bool);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Output an unsigned char image.
+ /// A new .
+ public static Image Grey(int width, int height, bool? uchar = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(uchar), uchar);
+
+ return Operation.Call("grey", options, width, height) as Image;
+ }
+
+ ///
+ /// Grid an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Grid(tileHeight, across, down);
+ ///
+ ///
+ /// Chop into tiles this high.
+ /// Number of tiles across.
+ /// Number of tiles down.
+ /// A new .
+ public Image Grid(int tileHeight, int across, int down)
+ {
+ return this.Call("grid", tileHeight, across, down) as Image;
+ }
+
+ ///
+ /// Load a HEIF image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Heifload(filename, page: int, n: int, thumbnail: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Fetch thumbnail image.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Heifload(string filename, int? page = null, int? n = null, bool? thumbnail = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(thumbnail), thumbnail);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("heifload", options, filename) as Image;
+ }
+
+ ///
+ /// Load a HEIF image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Heifload(filename, out var flags, page: int, n: int, thumbnail: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Fetch thumbnail image.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Heifload(string filename, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? thumbnail = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(thumbnail), thumbnail);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("heifload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load a HEIF image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.HeifloadBuffer(buffer, page: int, n: int, thumbnail: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Fetch thumbnail image.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image HeifloadBuffer(byte[] buffer, int? page = null, int? n = null, bool? thumbnail = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(thumbnail), thumbnail);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("heifload_buffer", options, buffer) as Image;
+ }
+
+ ///
+ /// Load a HEIF image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.HeifloadBuffer(buffer, out var flags, page: int, n: int, thumbnail: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Fetch thumbnail image.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image HeifloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? thumbnail = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(thumbnail), thumbnail);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("heifload_buffer", options, buffer) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load a HEIF image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.HeifloadSource(source, page: int, n: int, thumbnail: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Fetch thumbnail image.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image HeifloadSource(Source source, int? page = null, int? n = null, bool? thumbnail = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(thumbnail), thumbnail);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("heifload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load a HEIF image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.HeifloadStream(stream, page: int, n: int, thumbnail: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Fetch thumbnail image.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image HeifloadStream(Stream stream, int? page = null, int? n = null, bool? thumbnail = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = HeifloadSource(source, page, n, thumbnail, unlimited, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load a HEIF image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.HeifloadSource(source, out var flags, page: int, n: int, thumbnail: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Fetch thumbnail image.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image HeifloadSource(Source source, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? thumbnail = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(thumbnail), thumbnail);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("heifload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load a HEIF image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.HeifloadStream(stream, out var flags, page: int, n: int, thumbnail: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Fetch thumbnail image.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image HeifloadStream(Stream stream, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? thumbnail = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = HeifloadSource(source, out flags, page, n, thumbnail, unlimited, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Save image in HEIF format.
+ ///
+ ///
+ ///
+ /// in.Heifsave(filename, q: int, bitdepth: int, lossless: bool, compression: Enums.ForeignHeifCompression, effort: int, subsampleMode: Enums.ForeignSubsample, encoder: Enums.ForeignHeifEncoder, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Q factor.
+ /// Number of bits per pixel.
+ /// Enable lossless compression.
+ /// Compression format.
+ /// CPU effort.
+ /// Select chroma subsample operation mode.
+ /// Select encoder to use.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Heifsave(string filename, int? q = null, int? bitdepth = null, bool? lossless = null, Enums.ForeignHeifCompression? compression = null, int? effort = null, Enums.ForeignSubsample? subsampleMode = null, Enums.ForeignHeifEncoder? encoder = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent(nameof(compression), compression);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddIfPresent("subsample_mode", subsampleMode);
+ options.AddIfPresent(nameof(encoder), encoder);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("heifsave", options, filename);
+ }
+
+ ///
+ /// Save image in HEIF format.
+ ///
+ ///
+ ///
+ /// byte[] buffer = in.HeifsaveBuffer(q: int, bitdepth: int, lossless: bool, compression: Enums.ForeignHeifCompression, effort: int, subsampleMode: Enums.ForeignSubsample, encoder: Enums.ForeignHeifEncoder, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Q factor.
+ /// Number of bits per pixel.
+ /// Enable lossless compression.
+ /// Compression format.
+ /// CPU effort.
+ /// Select chroma subsample operation mode.
+ /// Select encoder to use.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ /// An array of bytes.
+ public byte[] HeifsaveBuffer(int? q = null, int? bitdepth = null, bool? lossless = null, Enums.ForeignHeifCompression? compression = null, int? effort = null, Enums.ForeignSubsample? subsampleMode = null, Enums.ForeignHeifEncoder? encoder = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent(nameof(compression), compression);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddIfPresent("subsample_mode", subsampleMode);
+ options.AddIfPresent(nameof(encoder), encoder);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ return this.Call("heifsave_buffer", options) as byte[];
+ }
+
+ ///
+ /// Save image in HEIF format.
+ ///
+ ///
+ ///
+ /// in.HeifsaveTarget(target, q: int, bitdepth: int, lossless: bool, compression: Enums.ForeignHeifCompression, effort: int, subsampleMode: Enums.ForeignSubsample, encoder: Enums.ForeignHeifEncoder, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Target to save to.
+ /// Q factor.
+ /// Number of bits per pixel.
+ /// Enable lossless compression.
+ /// Compression format.
+ /// CPU effort.
+ /// Select chroma subsample operation mode.
+ /// Select encoder to use.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void HeifsaveTarget(Target target, int? q = null, int? bitdepth = null, bool? lossless = null, Enums.ForeignHeifCompression? compression = null, int? effort = null, Enums.ForeignSubsample? subsampleMode = null, Enums.ForeignHeifEncoder? encoder = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent(nameof(compression), compression);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddIfPresent("subsample_mode", subsampleMode);
+ options.AddIfPresent(nameof(encoder), encoder);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("heifsave_target", options, target);
+ }
+
+ ///
+ /// Save image in HEIF format.
+ ///
+ ///
+ ///
+ /// in.HeifsaveStream(stream, q: int, bitdepth: int, lossless: bool, compression: Enums.ForeignHeifCompression, effort: int, subsampleMode: Enums.ForeignSubsample, encoder: Enums.ForeignHeifEncoder, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Stream to save to.
+ /// Q factor.
+ /// Number of bits per pixel.
+ /// Enable lossless compression.
+ /// Compression format.
+ /// CPU effort.
+ /// Select chroma subsample operation mode.
+ /// Select encoder to use.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void HeifsaveStream(Stream stream, int? q = null, int? bitdepth = null, bool? lossless = null, Enums.ForeignHeifCompression? compression = null, int? effort = null, Enums.ForeignSubsample? subsampleMode = null, Enums.ForeignHeifEncoder? encoder = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ HeifsaveTarget(target, q, bitdepth, lossless, compression, effort, subsampleMode, encoder, keep, background, pageHeight, profile);
+ }
+
+ ///
+ /// Form cumulative histogram.
+ ///
+ ///
+ ///
+ /// using Image @out = in.HistCum();
+ ///
+ ///
+ /// A new .
+ public Image HistCum()
+ {
+ return this.Call("hist_cum") as Image;
+ }
+
+ ///
+ /// Estimate image entropy.
+ ///
+ ///
+ ///
+ /// double @out = in.HistEntropy();
+ ///
+ ///
+ /// A double.
+ public double HistEntropy()
+ {
+ return this.Call("hist_entropy") is double result ? result : 0d;
+ }
+
+ ///
+ /// Histogram equalisation.
+ ///
+ ///
+ ///
+ /// using Image @out = in.HistEqual(band: int);
+ ///
+ ///
+ /// Equalise with this band.
+ /// A new .
+ public Image HistEqual(int? band = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(band), band);
+
+ return this.Call("hist_equal", options) as Image;
+ }
+
+ ///
+ /// Find image histogram.
+ ///
+ ///
+ ///
+ /// using Image @out = in.HistFind(band: int);
+ ///
+ ///
+ /// Find histogram of band.
+ /// A new .
+ public Image HistFind(int? band = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(band), band);
+
+ return this.Call("hist_find", options) as Image;
+ }
+
+ ///
+ /// Find indexed image histogram.
+ ///
+ ///
+ ///
+ /// using Image @out = in.HistFindIndexed(index, combine: Enums.Combine);
+ ///
+ ///
+ /// Index image.
+ /// Combine bins like this.
+ /// A new .
+ public Image HistFindIndexed(Image index, Enums.Combine? combine = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(combine), combine);
+
+ return this.Call("hist_find_indexed", options, index) as Image;
+ }
+
+ ///
+ /// Find n-dimensional image histogram.
+ ///
+ ///
+ ///
+ /// using Image @out = in.HistFindNdim(bins: int);
+ ///
+ ///
+ /// Number of bins in each dimension.
+ /// A new .
+ public Image HistFindNdim(int? bins = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(bins), bins);
+
+ return this.Call("hist_find_ndim", options) as Image;
+ }
+
+ ///
+ /// Test for monotonicity.
+ ///
+ ///
+ ///
+ /// bool monotonic = in.HistIsmonotonic();
+ ///
+ ///
+ /// A bool.
+ public bool HistIsmonotonic()
+ {
+ return this.Call("hist_ismonotonic") is bool result && result;
+ }
+
+ ///
+ /// Local histogram equalisation.
+ ///
+ ///
+ ///
+ /// using Image @out = in.HistLocal(width, height, maxSlope: int);
+ ///
+ ///
+ /// Window width in pixels.
+ /// Window height in pixels.
+ /// Maximum slope (CLAHE).
+ /// A new .
+ public Image HistLocal(int width, int height, int? maxSlope = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("max_slope", maxSlope);
+
+ return this.Call("hist_local", options, width, height) as Image;
+ }
+
+ ///
+ /// Match two histograms.
+ ///
+ ///
+ ///
+ /// using Image @out = in.HistMatch(@ref);
+ ///
+ ///
+ /// Reference histogram.
+ /// A new .
+ public Image HistMatch(Image @ref)
+ {
+ return this.Call("hist_match", @ref) as Image;
+ }
+
+ ///
+ /// Normalise histogram.
+ ///
+ ///
+ ///
+ /// using Image @out = in.HistNorm();
+ ///
+ ///
+ /// A new .
+ public Image HistNorm()
+ {
+ return this.Call("hist_norm") as Image;
+ }
+
+ ///
+ /// Plot histogram.
+ ///
+ ///
+ ///
+ /// using Image @out = in.HistPlot();
+ ///
+ ///
+ /// A new .
+ public Image HistPlot()
+ {
+ return this.Call("hist_plot") as Image;
+ }
+
+ ///
+ /// Find hough circle transform.
+ ///
+ ///
+ ///
+ /// using Image @out = in.HoughCircle(scale: int, minRadius: int, maxRadius: int);
+ ///
+ ///
+ /// Scale down dimensions by this factor.
+ /// Smallest radius to search for.
+ /// Largest radius to search for.
+ /// A new .
+ public Image HoughCircle(int? scale = null, int? minRadius = null, int? maxRadius = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent("min_radius", minRadius);
+ options.AddIfPresent("max_radius", maxRadius);
+
+ return this.Call("hough_circle", options) as Image;
+ }
+
+ ///
+ /// Find hough line transform.
+ ///
+ ///
+ ///
+ /// using Image @out = in.HoughLine(width: int, height: int);
+ ///
+ ///
+ /// Horizontal size of parameter space.
+ /// Vertical size of parameter space.
+ /// A new .
+ public Image HoughLine(int? width = null, int? height = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(width), width);
+ options.AddIfPresent(nameof(height), height);
+
+ return this.Call("hough_line", options) as Image;
+ }
+
+ ///
+ /// Transform HSV to sRGB.
+ ///
+ ///
+ ///
+ /// using Image @out = in.HSV2sRGB();
+ ///
+ ///
+ /// A new .
+ public Image HSV2sRGB()
+ {
+ return this.Call("HSV2sRGB") as Image;
+ }
+
+ ///
+ /// Output to device with ICC profile.
+ ///
+ ///
+ ///
+ /// using Image @out = in.IccExport(pcs: Enums.PCS, intent: Enums.Intent, blackPointCompensation: bool, outputProfile: string, depth: int);
+ ///
+ ///
+ /// Set Profile Connection Space.
+ /// Rendering intent.
+ /// Enable black point compensation.
+ /// Filename to load output profile from.
+ /// Output device space depth in bits.
+ /// A new .
+ public Image IccExport(Enums.PCS? pcs = null, Enums.Intent? intent = null, bool? blackPointCompensation = null, string outputProfile = null, int? depth = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(pcs), pcs);
+ options.AddIfPresent(nameof(intent), intent);
+ options.AddIfPresent("black_point_compensation", blackPointCompensation);
+ options.AddIfPresent("output_profile", outputProfile);
+ options.AddIfPresent(nameof(depth), depth);
+
+ return this.Call("icc_export", options) as Image;
+ }
+
+ ///
+ /// Import from device with ICC profile.
+ ///
+ ///
+ ///
+ /// using Image @out = in.IccImport(pcs: Enums.PCS, intent: Enums.Intent, blackPointCompensation: bool, embedded: bool, inputProfile: string);
+ ///
+ ///
+ /// Set Profile Connection Space.
+ /// Rendering intent.
+ /// Enable black point compensation.
+ /// Use embedded input profile, if available.
+ /// Filename to load input profile from.
+ /// A new .
+ public Image IccImport(Enums.PCS? pcs = null, Enums.Intent? intent = null, bool? blackPointCompensation = null, bool? embedded = null, string inputProfile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(pcs), pcs);
+ options.AddIfPresent(nameof(intent), intent);
+ options.AddIfPresent("black_point_compensation", blackPointCompensation);
+ options.AddIfPresent(nameof(embedded), embedded);
+ options.AddIfPresent("input_profile", inputProfile);
+
+ return this.Call("icc_import", options) as Image;
+ }
+
+ ///
+ /// Transform between devices with ICC profiles.
+ ///
+ ///
+ ///
+ /// using Image @out = in.IccTransform(outputProfile, pcs: Enums.PCS, intent: Enums.Intent, blackPointCompensation: bool, embedded: bool, inputProfile: string, depth: int);
+ ///
+ ///
+ /// Filename to load output profile from.
+ /// Set Profile Connection Space.
+ /// Rendering intent.
+ /// Enable black point compensation.
+ /// Use embedded input profile, if available.
+ /// Filename to load input profile from.
+ /// Output device space depth in bits.
+ /// A new .
+ public Image IccTransform(string outputProfile, Enums.PCS? pcs = null, Enums.Intent? intent = null, bool? blackPointCompensation = null, bool? embedded = null, string inputProfile = null, int? depth = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(pcs), pcs);
+ options.AddIfPresent(nameof(intent), intent);
+ options.AddIfPresent("black_point_compensation", blackPointCompensation);
+ options.AddIfPresent(nameof(embedded), embedded);
+ options.AddIfPresent("input_profile", inputProfile);
+ options.AddIfPresent(nameof(depth), depth);
+
+ return this.Call("icc_transform", options, outputProfile) as Image;
+ }
+
+ ///
+ /// Make a 1D image where pixel values are indexes.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Identity(bands: int, @ushort: bool, size: int);
+ ///
+ ///
+ /// Number of bands in LUT.
+ /// Create a 16-bit LUT.
+ /// Size of 16-bit LUT.
+ /// A new .
+ public static Image Identity(int? bands = null, bool? @ushort = null, int? size = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(bands), bands);
+ options.AddIfPresent("ushort", @ushort);
+ options.AddIfPresent(nameof(size), size);
+
+ return Operation.Call("identity", options) as Image;
+ }
+
+ ///
+ /// Insert image @sub into @main at @x, @y.
+ ///
+ ///
+ ///
+ /// using Image @out = main.Insert(sub, x, y, expand: bool, background: double[]);
+ ///
+ ///
+ /// Sub-image to insert into main image.
+ /// Left edge of sub in main.
+ /// Top edge of sub in main.
+ /// Expand output to hold all of both inputs.
+ /// Color for new pixels.
+ /// A new .
+ public Image Insert(Image sub, int x, int y, bool? expand = null, double[] background = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(expand), expand);
+ options.AddIfPresent(nameof(background), background);
+
+ return this.Call("insert", options, sub, x, y) as Image;
+ }
+
+ ///
+ /// Invert an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Invert();
+ ///
+ ///
+ /// A new .
+ public Image Invert()
+ {
+ return this.Call("invert") as Image;
+ }
+
+ ///
+ /// Build an inverted look-up table.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Invertlut(size: int);
+ ///
+ ///
+ /// LUT size to generate.
+ /// A new .
+ public Image Invertlut(int? size = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(size), size);
+
+ return this.Call("invertlut", options) as Image;
+ }
+
+ ///
+ /// Inverse FFT.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Invfft(real: bool);
+ ///
+ ///
+ /// Output only the real part of the transform.
+ /// A new .
+ public Image Invfft(bool? real = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(real), real);
+
+ return this.Call("invfft", options) as Image;
+ }
+
+ ///
+ /// Join a pair of images.
+ ///
+ ///
+ ///
+ /// using Image @out = in1.Join(in2, direction, expand: bool, shim: int, background: double[], align: Enums.Align);
+ ///
+ ///
+ /// Second input image.
+ /// Join left-right or up-down.
+ /// Expand output to hold all of both inputs.
+ /// Pixels between images.
+ /// Colour for new pixels.
+ /// Align on the low, centre or high coordinate edge.
+ /// A new .
+ public Image Join(Image in2, Enums.Direction direction, bool? expand = null, int? shim = null, double[] background = null, Enums.Align? align = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(expand), expand);
+ options.AddIfPresent(nameof(shim), shim);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent(nameof(align), align);
+
+ return this.Call("join", options, in2, direction) as Image;
+ }
+
+ ///
+ /// Load JPEG2000 image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Jp2kload(filename, page: int, oneshot: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Load this page from the image.
+ /// Load images a frame at a time.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Jp2kload(string filename, int? page = null, bool? oneshot = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(oneshot), oneshot);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("jp2kload", options, filename) as Image;
+ }
+
+ ///
+ /// Load JPEG2000 image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Jp2kload(filename, out var flags, page: int, oneshot: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Load this page from the image.
+ /// Load images a frame at a time.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Jp2kload(string filename, out Enums.ForeignFlags flags, int? page = null, bool? oneshot = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(oneshot), oneshot);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("jp2kload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load JPEG2000 image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Jp2kloadBuffer(buffer, page: int, oneshot: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Load this page from the image.
+ /// Load images a frame at a time.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image Jp2kloadBuffer(byte[] buffer, int? page = null, bool? oneshot = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(oneshot), oneshot);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("jp2kload_buffer", options, buffer) as Image;
+ }
+
+ ///
+ /// Load JPEG2000 image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Jp2kloadBuffer(buffer, out var flags, page: int, oneshot: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Flags for this file.
+ /// Load this page from the image.
+ /// Load images a frame at a time.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image Jp2kloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, int? page = null, bool? oneshot = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(oneshot), oneshot);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("jp2kload_buffer", options, buffer) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load JPEG2000 image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Jp2kloadSource(source, page: int, oneshot: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Load this page from the image.
+ /// Load images a frame at a time.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image Jp2kloadSource(Source source, int? page = null, bool? oneshot = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(oneshot), oneshot);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("jp2kload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load JPEG2000 image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Jp2kloadStream(stream, page: int, oneshot: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Load this page from the image.
+ /// Load images a frame at a time.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image Jp2kloadStream(Stream stream, int? page = null, bool? oneshot = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = Jp2kloadSource(source, page, oneshot, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load JPEG2000 image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Jp2kloadSource(source, out var flags, page: int, oneshot: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// Load this page from the image.
+ /// Load images a frame at a time.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image Jp2kloadSource(Source source, out Enums.ForeignFlags flags, int? page = null, bool? oneshot = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(oneshot), oneshot);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("jp2kload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load JPEG2000 image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Jp2kloadStream(stream, out var flags, page: int, oneshot: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// Load this page from the image.
+ /// Load images a frame at a time.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image Jp2kloadStream(Stream stream, out Enums.ForeignFlags flags, int? page = null, bool? oneshot = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = Jp2kloadSource(source, out flags, page, oneshot, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Save image in JPEG2000 format.
+ ///
+ ///
+ ///
+ /// in.Jp2ksave(filename, tileWidth: int, tileHeight: int, lossless: bool, q: int, subsampleMode: Enums.ForeignSubsample, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Tile width in pixels.
+ /// Tile height in pixels.
+ /// Enable lossless compression.
+ /// Q factor.
+ /// Select chroma subsample operation mode.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Jp2ksave(string filename, int? tileWidth = null, int? tileHeight = null, bool? lossless = null, int? q = null, Enums.ForeignSubsample? subsampleMode = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("tile_width", tileWidth);
+ options.AddIfPresent("tile_height", tileHeight);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent("subsample_mode", subsampleMode);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("jp2ksave", options, filename);
+ }
+
+ ///
+ /// Save image in JPEG2000 format.
+ ///
+ ///
+ ///
+ /// byte[] buffer = in.Jp2ksaveBuffer(tileWidth: int, tileHeight: int, lossless: bool, q: int, subsampleMode: Enums.ForeignSubsample, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Tile width in pixels.
+ /// Tile height in pixels.
+ /// Enable lossless compression.
+ /// Q factor.
+ /// Select chroma subsample operation mode.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ /// An array of bytes.
+ public byte[] Jp2ksaveBuffer(int? tileWidth = null, int? tileHeight = null, bool? lossless = null, int? q = null, Enums.ForeignSubsample? subsampleMode = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("tile_width", tileWidth);
+ options.AddIfPresent("tile_height", tileHeight);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent("subsample_mode", subsampleMode);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ return this.Call("jp2ksave_buffer", options) as byte[];
+ }
+
+ ///
+ /// Save image in JPEG2000 format.
+ ///
+ ///
+ ///
+ /// in.Jp2ksaveTarget(target, tileWidth: int, tileHeight: int, lossless: bool, q: int, subsampleMode: Enums.ForeignSubsample, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Target to save to.
+ /// Tile width in pixels.
+ /// Tile height in pixels.
+ /// Enable lossless compression.
+ /// Q factor.
+ /// Select chroma subsample operation mode.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Jp2ksaveTarget(Target target, int? tileWidth = null, int? tileHeight = null, bool? lossless = null, int? q = null, Enums.ForeignSubsample? subsampleMode = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("tile_width", tileWidth);
+ options.AddIfPresent("tile_height", tileHeight);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent("subsample_mode", subsampleMode);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("jp2ksave_target", options, target);
+ }
+
+ ///
+ /// Save image in JPEG2000 format.
+ ///
+ ///
+ ///
+ /// in.Jp2ksaveStream(stream, tileWidth: int, tileHeight: int, lossless: bool, q: int, subsampleMode: Enums.ForeignSubsample, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Stream to save to.
+ /// Tile width in pixels.
+ /// Tile height in pixels.
+ /// Enable lossless compression.
+ /// Q factor.
+ /// Select chroma subsample operation mode.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Jp2ksaveStream(Stream stream, int? tileWidth = null, int? tileHeight = null, bool? lossless = null, int? q = null, Enums.ForeignSubsample? subsampleMode = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ Jp2ksaveTarget(target, tileWidth, tileHeight, lossless, q, subsampleMode, keep, background, pageHeight, profile);
+ }
+
+ ///
+ /// Load jpeg from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Jpegload(filename, shrink: int, autorotate: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Shrink factor on load.
+ /// Rotate image using exif orientation.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Jpegload(string filename, int? shrink = null, bool? autorotate = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(shrink), shrink);
+ options.AddIfPresent(nameof(autorotate), autorotate);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("jpegload", options, filename) as Image;
+ }
+
+ ///
+ /// Load jpeg from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Jpegload(filename, out var flags, shrink: int, autorotate: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Shrink factor on load.
+ /// Rotate image using exif orientation.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Jpegload(string filename, out Enums.ForeignFlags flags, int? shrink = null, bool? autorotate = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(shrink), shrink);
+ options.AddIfPresent(nameof(autorotate), autorotate);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("jpegload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load jpeg from buffer.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.JpegloadBuffer(buffer, shrink: int, autorotate: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Shrink factor on load.
+ /// Rotate image using exif orientation.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image JpegloadBuffer(byte[] buffer, int? shrink = null, bool? autorotate = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(shrink), shrink);
+ options.AddIfPresent(nameof(autorotate), autorotate);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("jpegload_buffer", options, buffer) as Image;
+ }
+
+ ///
+ /// Load jpeg from buffer.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.JpegloadBuffer(buffer, out var flags, shrink: int, autorotate: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Flags for this file.
+ /// Shrink factor on load.
+ /// Rotate image using exif orientation.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image JpegloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, int? shrink = null, bool? autorotate = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(shrink), shrink);
+ options.AddIfPresent(nameof(autorotate), autorotate);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("jpegload_buffer", options, buffer) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load image from jpeg source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.JpegloadSource(source, shrink: int, autorotate: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Shrink factor on load.
+ /// Rotate image using exif orientation.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image JpegloadSource(Source source, int? shrink = null, bool? autorotate = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(shrink), shrink);
+ options.AddIfPresent(nameof(autorotate), autorotate);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("jpegload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load image from jpeg stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.JpegloadStream(stream, shrink: int, autorotate: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Shrink factor on load.
+ /// Rotate image using exif orientation.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image JpegloadStream(Stream stream, int? shrink = null, bool? autorotate = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = JpegloadSource(source, shrink, autorotate, unlimited, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load image from jpeg source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.JpegloadSource(source, out var flags, shrink: int, autorotate: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// Shrink factor on load.
+ /// Rotate image using exif orientation.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image JpegloadSource(Source source, out Enums.ForeignFlags flags, int? shrink = null, bool? autorotate = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(shrink), shrink);
+ options.AddIfPresent(nameof(autorotate), autorotate);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("jpegload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load image from jpeg stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.JpegloadStream(stream, out var flags, shrink: int, autorotate: bool, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// Shrink factor on load.
+ /// Rotate image using exif orientation.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image JpegloadStream(Stream stream, out Enums.ForeignFlags flags, int? shrink = null, bool? autorotate = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = JpegloadSource(source, out flags, shrink, autorotate, unlimited, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Save image to jpeg file.
+ ///
+ ///
+ ///
+ /// in.Jpegsave(filename, q: int, optimizeCoding: bool, interlace: bool, trellisQuant: bool, overshootDeringing: bool, optimizeScans: bool, quantTable: int, subsampleMode: Enums.ForeignSubsample, restartInterval: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Q factor.
+ /// Compute optimal Huffman coding tables.
+ /// Generate an interlaced (progressive) jpeg.
+ /// Apply trellis quantisation to each 8x8 block.
+ /// Apply overshooting to samples with extreme values.
+ /// Split spectrum of DCT coefficients into separate scans.
+ /// Use predefined quantization table with given index.
+ /// Select chroma subsample operation mode.
+ /// Add restart markers every specified number of mcu.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Jpegsave(string filename, int? q = null, bool? optimizeCoding = null, bool? interlace = null, bool? trellisQuant = null, bool? overshootDeringing = null, bool? optimizeScans = null, int? quantTable = null, Enums.ForeignSubsample? subsampleMode = null, int? restartInterval = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent("optimize_coding", optimizeCoding);
+ options.AddIfPresent(nameof(interlace), interlace);
+ options.AddIfPresent("trellis_quant", trellisQuant);
+ options.AddIfPresent("overshoot_deringing", overshootDeringing);
+ options.AddIfPresent("optimize_scans", optimizeScans);
+ options.AddIfPresent("quant_table", quantTable);
+ options.AddIfPresent("subsample_mode", subsampleMode);
+ options.AddIfPresent("restart_interval", restartInterval);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("jpegsave", options, filename);
+ }
+
+ ///
+ /// Save image to jpeg buffer.
+ ///
+ ///
+ ///
+ /// byte[] buffer = in.JpegsaveBuffer(q: int, optimizeCoding: bool, interlace: bool, trellisQuant: bool, overshootDeringing: bool, optimizeScans: bool, quantTable: int, subsampleMode: Enums.ForeignSubsample, restartInterval: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Q factor.
+ /// Compute optimal Huffman coding tables.
+ /// Generate an interlaced (progressive) jpeg.
+ /// Apply trellis quantisation to each 8x8 block.
+ /// Apply overshooting to samples with extreme values.
+ /// Split spectrum of DCT coefficients into separate scans.
+ /// Use predefined quantization table with given index.
+ /// Select chroma subsample operation mode.
+ /// Add restart markers every specified number of mcu.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ /// An array of bytes.
+ public byte[] JpegsaveBuffer(int? q = null, bool? optimizeCoding = null, bool? interlace = null, bool? trellisQuant = null, bool? overshootDeringing = null, bool? optimizeScans = null, int? quantTable = null, Enums.ForeignSubsample? subsampleMode = null, int? restartInterval = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent("optimize_coding", optimizeCoding);
+ options.AddIfPresent(nameof(interlace), interlace);
+ options.AddIfPresent("trellis_quant", trellisQuant);
+ options.AddIfPresent("overshoot_deringing", overshootDeringing);
+ options.AddIfPresent("optimize_scans", optimizeScans);
+ options.AddIfPresent("quant_table", quantTable);
+ options.AddIfPresent("subsample_mode", subsampleMode);
+ options.AddIfPresent("restart_interval", restartInterval);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ return this.Call("jpegsave_buffer", options) as byte[];
+ }
+
+ ///
+ /// Save image to jpeg mime.
+ ///
+ ///
+ ///
+ /// in.JpegsaveMime(q: int, optimizeCoding: bool, interlace: bool, trellisQuant: bool, overshootDeringing: bool, optimizeScans: bool, quantTable: int, subsampleMode: Enums.ForeignSubsample, restartInterval: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Q factor.
+ /// Compute optimal Huffman coding tables.
+ /// Generate an interlaced (progressive) jpeg.
+ /// Apply trellis quantisation to each 8x8 block.
+ /// Apply overshooting to samples with extreme values.
+ /// Split spectrum of DCT coefficients into separate scans.
+ /// Use predefined quantization table with given index.
+ /// Select chroma subsample operation mode.
+ /// Add restart markers every specified number of mcu.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void JpegsaveMime(int? q = null, bool? optimizeCoding = null, bool? interlace = null, bool? trellisQuant = null, bool? overshootDeringing = null, bool? optimizeScans = null, int? quantTable = null, Enums.ForeignSubsample? subsampleMode = null, int? restartInterval = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent("optimize_coding", optimizeCoding);
+ options.AddIfPresent(nameof(interlace), interlace);
+ options.AddIfPresent("trellis_quant", trellisQuant);
+ options.AddIfPresent("overshoot_deringing", overshootDeringing);
+ options.AddIfPresent("optimize_scans", optimizeScans);
+ options.AddIfPresent("quant_table", quantTable);
+ options.AddIfPresent("subsample_mode", subsampleMode);
+ options.AddIfPresent("restart_interval", restartInterval);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("jpegsave_mime", options);
+ }
+
+ ///
+ /// Save image to jpeg target.
+ ///
+ ///
+ ///
+ /// in.JpegsaveTarget(target, q: int, optimizeCoding: bool, interlace: bool, trellisQuant: bool, overshootDeringing: bool, optimizeScans: bool, quantTable: int, subsampleMode: Enums.ForeignSubsample, restartInterval: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Target to save to.
+ /// Q factor.
+ /// Compute optimal Huffman coding tables.
+ /// Generate an interlaced (progressive) jpeg.
+ /// Apply trellis quantisation to each 8x8 block.
+ /// Apply overshooting to samples with extreme values.
+ /// Split spectrum of DCT coefficients into separate scans.
+ /// Use predefined quantization table with given index.
+ /// Select chroma subsample operation mode.
+ /// Add restart markers every specified number of mcu.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void JpegsaveTarget(Target target, int? q = null, bool? optimizeCoding = null, bool? interlace = null, bool? trellisQuant = null, bool? overshootDeringing = null, bool? optimizeScans = null, int? quantTable = null, Enums.ForeignSubsample? subsampleMode = null, int? restartInterval = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent("optimize_coding", optimizeCoding);
+ options.AddIfPresent(nameof(interlace), interlace);
+ options.AddIfPresent("trellis_quant", trellisQuant);
+ options.AddIfPresent("overshoot_deringing", overshootDeringing);
+ options.AddIfPresent("optimize_scans", optimizeScans);
+ options.AddIfPresent("quant_table", quantTable);
+ options.AddIfPresent("subsample_mode", subsampleMode);
+ options.AddIfPresent("restart_interval", restartInterval);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("jpegsave_target", options, target);
+ }
+
+ ///
+ /// Save image to jpeg stream.
+ ///
+ ///
+ ///
+ /// in.JpegsaveStream(stream, q: int, optimizeCoding: bool, interlace: bool, trellisQuant: bool, overshootDeringing: bool, optimizeScans: bool, quantTable: int, subsampleMode: Enums.ForeignSubsample, restartInterval: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Stream to save to.
+ /// Q factor.
+ /// Compute optimal Huffman coding tables.
+ /// Generate an interlaced (progressive) jpeg.
+ /// Apply trellis quantisation to each 8x8 block.
+ /// Apply overshooting to samples with extreme values.
+ /// Split spectrum of DCT coefficients into separate scans.
+ /// Use predefined quantization table with given index.
+ /// Select chroma subsample operation mode.
+ /// Add restart markers every specified number of mcu.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void JpegsaveStream(Stream stream, int? q = null, bool? optimizeCoding = null, bool? interlace = null, bool? trellisQuant = null, bool? overshootDeringing = null, bool? optimizeScans = null, int? quantTable = null, Enums.ForeignSubsample? subsampleMode = null, int? restartInterval = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ JpegsaveTarget(target, q, optimizeCoding, interlace, trellisQuant, overshootDeringing, optimizeScans, quantTable, subsampleMode, restartInterval, keep, background, pageHeight, profile);
+ }
+
+ ///
+ /// Load JPEG-XL image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Jxlload(filename, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Jxlload(string filename, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("jxlload", options, filename) as Image;
+ }
+
+ ///
+ /// Load JPEG-XL image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Jxlload(filename, out var flags, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Jxlload(string filename, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("jxlload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load JPEG-XL image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.JxlloadBuffer(buffer, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image JxlloadBuffer(byte[] buffer, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("jxlload_buffer", options, buffer) as Image;
+ }
+
+ ///
+ /// Load JPEG-XL image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.JxlloadBuffer(buffer, out var flags, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image JxlloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("jxlload_buffer", options, buffer) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load JPEG-XL image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.JxlloadSource(source, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image JxlloadSource(Source source, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("jxlload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load JPEG-XL image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.JxlloadStream(stream, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image JxlloadStream(Stream stream, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = JxlloadSource(source, page, n, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load JPEG-XL image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.JxlloadSource(source, out var flags, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image JxlloadSource(Source source, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("jxlload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load JPEG-XL image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.JxlloadStream(stream, out var flags, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image JxlloadStream(Stream stream, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = JxlloadSource(source, out flags, page, n, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Save image in JPEG-XL format.
+ ///
+ ///
+ ///
+ /// in.Jxlsave(filename, tier: int, distance: double, effort: int, lossless: bool, q: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Decode speed tier.
+ /// Target butteraugli distance.
+ /// Encoding effort.
+ /// Enable lossless compression.
+ /// Quality factor.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Jxlsave(string filename, int? tier = null, double? distance = null, int? effort = null, bool? lossless = null, int? q = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(tier), tier);
+ options.AddIfPresent(nameof(distance), distance);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent("Q", q);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("jxlsave", options, filename);
+ }
+
+ ///
+ /// Save image in JPEG-XL format.
+ ///
+ ///
+ ///
+ /// byte[] buffer = in.JxlsaveBuffer(tier: int, distance: double, effort: int, lossless: bool, q: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Decode speed tier.
+ /// Target butteraugli distance.
+ /// Encoding effort.
+ /// Enable lossless compression.
+ /// Quality factor.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ /// An array of bytes.
+ public byte[] JxlsaveBuffer(int? tier = null, double? distance = null, int? effort = null, bool? lossless = null, int? q = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(tier), tier);
+ options.AddIfPresent(nameof(distance), distance);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent("Q", q);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ return this.Call("jxlsave_buffer", options) as byte[];
+ }
+
+ ///
+ /// Save image in JPEG-XL format.
+ ///
+ ///
+ ///
+ /// in.JxlsaveTarget(target, tier: int, distance: double, effort: int, lossless: bool, q: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Target to save to.
+ /// Decode speed tier.
+ /// Target butteraugli distance.
+ /// Encoding effort.
+ /// Enable lossless compression.
+ /// Quality factor.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void JxlsaveTarget(Target target, int? tier = null, double? distance = null, int? effort = null, bool? lossless = null, int? q = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(tier), tier);
+ options.AddIfPresent(nameof(distance), distance);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent("Q", q);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("jxlsave_target", options, target);
+ }
+
+ ///
+ /// Save image in JPEG-XL format.
+ ///
+ ///
+ ///
+ /// in.JxlsaveStream(stream, tier: int, distance: double, effort: int, lossless: bool, q: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Stream to save to.
+ /// Decode speed tier.
+ /// Target butteraugli distance.
+ /// Encoding effort.
+ /// Enable lossless compression.
+ /// Quality factor.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void JxlsaveStream(Stream stream, int? tier = null, double? distance = null, int? effort = null, bool? lossless = null, int? q = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ JxlsaveTarget(target, tier, distance, effort, lossless, q, keep, background, pageHeight, profile);
+ }
+
+ ///
+ /// Transform float Lab to LabQ coding.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Lab2LabQ();
+ ///
+ ///
+ /// A new .
+ public Image Lab2LabQ()
+ {
+ return this.Call("Lab2LabQ") as Image;
+ }
+
+ ///
+ /// Transform float Lab to signed short.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Lab2LabS();
+ ///
+ ///
+ /// A new .
+ public Image Lab2LabS()
+ {
+ return this.Call("Lab2LabS") as Image;
+ }
+
+ ///
+ /// Transform Lab to LCh.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Lab2LCh();
+ ///
+ ///
+ /// A new .
+ public Image Lab2LCh()
+ {
+ return this.Call("Lab2LCh") as Image;
+ }
+
+ ///
+ /// Transform CIELAB to XYZ.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Lab2XYZ(temp: double[]);
+ ///
+ ///
+ /// Color temperature.
+ /// A new .
+ public Image Lab2XYZ(double[] temp = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(temp), temp);
+
+ return this.Call("Lab2XYZ", options) as Image;
+ }
+
+ ///
+ /// Label regions in an image.
+ ///
+ ///
+ ///
+ /// using Image mask = in.Labelregions();
+ ///
+ ///
+ /// A new .
+ public Image Labelregions()
+ {
+ return this.Call("labelregions") as Image;
+ }
+
+ ///
+ /// Label regions in an image.
+ ///
+ ///
+ ///
+ /// using Image mask = in.Labelregions(out var segments);
+ ///
+ ///
+ /// Number of discrete contiguous regions.
+ /// A new .
+ public Image Labelregions(out int segments)
+ {
+ var optionalOutput = new VOption
+ {
+ {"segments", true}
+ };
+
+ var results = this.Call("labelregions", optionalOutput) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ segments = opts?["segments"] is int out1 ? out1 : 0;
+
+ return finalResult;
+ }
+
+ ///
+ /// Unpack a LabQ image to float Lab.
+ ///
+ ///
+ ///
+ /// using Image @out = in.LabQ2Lab();
+ ///
+ ///
+ /// A new .
+ public Image LabQ2Lab()
+ {
+ return this.Call("LabQ2Lab") as Image;
+ }
+
+ ///
+ /// Unpack a LabQ image to short Lab.
+ ///
+ ///
+ ///
+ /// using Image @out = in.LabQ2LabS();
+ ///
+ ///
+ /// A new .
+ public Image LabQ2LabS()
+ {
+ return this.Call("LabQ2LabS") as Image;
+ }
+
+ ///
+ /// Convert a LabQ image to sRGB.
+ ///
+ ///
+ ///
+ /// using Image @out = in.LabQ2sRGB();
+ ///
+ ///
+ /// A new .
+ public Image LabQ2sRGB()
+ {
+ return this.Call("LabQ2sRGB") as Image;
+ }
+
+ ///
+ /// Transform signed short Lab to float.
+ ///
+ ///
+ ///
+ /// using Image @out = in.LabS2Lab();
+ ///
+ ///
+ /// A new .
+ public Image LabS2Lab()
+ {
+ return this.Call("LabS2Lab") as Image;
+ }
+
+ ///
+ /// Transform short Lab to LabQ coding.
+ ///
+ ///
+ ///
+ /// using Image @out = in.LabS2LabQ();
+ ///
+ ///
+ /// A new .
+ public Image LabS2LabQ()
+ {
+ return this.Call("LabS2LabQ") as Image;
+ }
+
+ ///
+ /// Transform LCh to CMC.
+ ///
+ ///
+ ///
+ /// using Image @out = in.LCh2CMC();
+ ///
+ ///
+ /// A new .
+ public Image LCh2CMC()
+ {
+ return this.Call("LCh2CMC") as Image;
+ }
+
+ ///
+ /// Transform LCh to Lab.
+ ///
+ ///
+ ///
+ /// using Image @out = in.LCh2Lab();
+ ///
+ ///
+ /// A new .
+ public Image LCh2Lab()
+ {
+ return this.Call("LCh2Lab") as Image;
+ }
+
+ ///
+ /// Calculate (a * in + b).
+ ///
+ ///
+ ///
+ /// using Image @out = in.Linear(a, b, uchar: bool);
+ ///
+ ///
+ /// Multiply by this.
+ /// Add this.
+ /// Output should be uchar.
+ /// A new .
+ public Image Linear(double[] a, double[] b, bool? uchar = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(uchar), uchar);
+
+ return this.Call("linear", options, a, b) as Image;
+ }
+
+ ///
+ /// Cache an image as a set of lines.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Linecache(tileHeight: int, access: Enums.Access, threaded: bool, persistent: bool);
+ ///
+ ///
+ /// Tile height in pixels.
+ /// Expected access pattern.
+ /// Allow threaded access.
+ /// Keep cache between evaluations.
+ /// A new .
+ public Image Linecache(int? tileHeight = null, Enums.Access? access = null, bool? threaded = null, bool? persistent = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("tile_height", tileHeight);
+ options.AddIfPresent(nameof(access), access);
+ options.AddIfPresent(nameof(threaded), threaded);
+ options.AddIfPresent(nameof(persistent), persistent);
+
+ return this.Call("linecache", options) as Image;
+ }
+
+ ///
+ /// Make a Laplacian of Gaussian image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Logmat(sigma, minAmpl, separable: bool, precision: Enums.Precision);
+ ///
+ ///
+ /// Radius of Gaussian.
+ /// Minimum amplitude of Gaussian.
+ /// Generate separable Gaussian.
+ /// Generate with this precision.
+ /// A new .
+ public static Image Logmat(double sigma, double minAmpl, bool? separable = null, Enums.Precision? precision = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(separable), separable);
+ options.AddIfPresent(nameof(precision), precision);
+
+ return Operation.Call("logmat", options, sigma, minAmpl) as Image;
+ }
+
+ ///
+ /// Load file with ImageMagick.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Magickload(filename, density: string, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Canvas resolution for rendering vector formats like SVG.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Magickload(string filename, string density = null, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(density), density);
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("magickload", options, filename) as Image;
+ }
+
+ ///
+ /// Load file with ImageMagick.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Magickload(filename, out var flags, density: string, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Canvas resolution for rendering vector formats like SVG.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Magickload(string filename, out Enums.ForeignFlags flags, string density = null, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(density), density);
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("magickload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load buffer with ImageMagick.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MagickloadBuffer(buffer, density: string, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Canvas resolution for rendering vector formats like SVG.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image MagickloadBuffer(byte[] buffer, string density = null, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(density), density);
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("magickload_buffer", options, buffer) as Image;
+ }
+
+ ///
+ /// Load buffer with ImageMagick.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MagickloadBuffer(buffer, out var flags, density: string, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Flags for this file.
+ /// Canvas resolution for rendering vector formats like SVG.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image MagickloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, string density = null, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(density), density);
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("magickload_buffer", options, buffer) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Save file with ImageMagick.
+ ///
+ ///
+ ///
+ /// in.Magicksave(filename, format: string, quality: int, optimizeGifFrames: bool, optimizeGifTransparency: bool, bitdepth: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Format to save in.
+ /// Quality to use.
+ /// Apply GIF frames optimization.
+ /// Apply GIF transparency optimization.
+ /// Number of bits per pixel.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Magicksave(string filename, string format = null, int? quality = null, bool? optimizeGifFrames = null, bool? optimizeGifTransparency = null, int? bitdepth = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(format), format);
+ options.AddIfPresent(nameof(quality), quality);
+ options.AddIfPresent("optimize_gif_frames", optimizeGifFrames);
+ options.AddIfPresent("optimize_gif_transparency", optimizeGifTransparency);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("magicksave", options, filename);
+ }
+
+ ///
+ /// Save image to magick buffer.
+ ///
+ ///
+ ///
+ /// byte[] buffer = in.MagicksaveBuffer(format: string, quality: int, optimizeGifFrames: bool, optimizeGifTransparency: bool, bitdepth: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Format to save in.
+ /// Quality to use.
+ /// Apply GIF frames optimization.
+ /// Apply GIF transparency optimization.
+ /// Number of bits per pixel.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ /// An array of bytes.
+ public byte[] MagicksaveBuffer(string format = null, int? quality = null, bool? optimizeGifFrames = null, bool? optimizeGifTransparency = null, int? bitdepth = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(format), format);
+ options.AddIfPresent(nameof(quality), quality);
+ options.AddIfPresent("optimize_gif_frames", optimizeGifFrames);
+ options.AddIfPresent("optimize_gif_transparency", optimizeGifTransparency);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ return this.Call("magicksave_buffer", options) as byte[];
+ }
+
+ ///
+ /// Resample with a map image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Mapim(index, interpolate: GObject, background: double[], premultiplied: bool, extend: Enums.Extend);
+ ///
+ ///
+ /// Index pixels with this.
+ /// Interpolate pixels with this.
+ /// Background value.
+ /// Images have premultiplied alpha.
+ /// How to generate the extra pixels.
+ /// A new .
+ public Image Mapim(Image index, GObject interpolate = null, double[] background = null, bool? premultiplied = null, Enums.Extend? extend = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(interpolate), interpolate);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent(nameof(premultiplied), premultiplied);
+ options.AddIfPresent(nameof(extend), extend);
+
+ return this.Call("mapim", options, index) as Image;
+ }
+
+ ///
+ /// Map an image though a lut.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Maplut(lut, band: int);
+ ///
+ ///
+ /// Look-up table image.
+ /// Apply one-band lut to this band of in.
+ /// A new .
+ public Image Maplut(Image lut, int? band = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(band), band);
+
+ return this.Call("maplut", options, lut) as Image;
+ }
+
+ ///
+ /// Make a butterworth filter.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MaskButterworth(width, height, order, frequencyCutoff, amplitudeCutoff, uchar: bool, nodc: bool, reject: bool, optical: bool);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Filter order.
+ /// Frequency cutoff.
+ /// Amplitude cutoff.
+ /// Output an unsigned char image.
+ /// Remove DC component.
+ /// Invert the sense of the filter.
+ /// Rotate quadrants to optical space.
+ /// A new .
+ public static Image MaskButterworth(int width, int height, double order, double frequencyCutoff, double amplitudeCutoff, bool? uchar = null, bool? nodc = null, bool? reject = null, bool? optical = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(uchar), uchar);
+ options.AddIfPresent(nameof(nodc), nodc);
+ options.AddIfPresent(nameof(reject), reject);
+ options.AddIfPresent(nameof(optical), optical);
+
+ return Operation.Call("mask_butterworth", options, width, height, order, frequencyCutoff, amplitudeCutoff) as Image;
+ }
+
+ ///
+ /// Make a butterworth_band filter.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MaskButterworthBand(width, height, order, frequencyCutoffX, frequencyCutoffY, radius, amplitudeCutoff, uchar: bool, nodc: bool, reject: bool, optical: bool);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Filter order.
+ /// Frequency cutoff x.
+ /// Frequency cutoff y.
+ /// Radius of circle.
+ /// Amplitude cutoff.
+ /// Output an unsigned char image.
+ /// Remove DC component.
+ /// Invert the sense of the filter.
+ /// Rotate quadrants to optical space.
+ /// A new .
+ public static Image MaskButterworthBand(int width, int height, double order, double frequencyCutoffX, double frequencyCutoffY, double radius, double amplitudeCutoff, bool? uchar = null, bool? nodc = null, bool? reject = null, bool? optical = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(uchar), uchar);
+ options.AddIfPresent(nameof(nodc), nodc);
+ options.AddIfPresent(nameof(reject), reject);
+ options.AddIfPresent(nameof(optical), optical);
+
+ return Operation.Call("mask_butterworth_band", options, width, height, order, frequencyCutoffX, frequencyCutoffY, radius, amplitudeCutoff) as Image;
+ }
+
+ ///
+ /// Make a butterworth ring filter.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MaskButterworthRing(width, height, order, frequencyCutoff, amplitudeCutoff, ringwidth, uchar: bool, nodc: bool, reject: bool, optical: bool);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Filter order.
+ /// Frequency cutoff.
+ /// Amplitude cutoff.
+ /// Ringwidth.
+ /// Output an unsigned char image.
+ /// Remove DC component.
+ /// Invert the sense of the filter.
+ /// Rotate quadrants to optical space.
+ /// A new .
+ public static Image MaskButterworthRing(int width, int height, double order, double frequencyCutoff, double amplitudeCutoff, double ringwidth, bool? uchar = null, bool? nodc = null, bool? reject = null, bool? optical = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(uchar), uchar);
+ options.AddIfPresent(nameof(nodc), nodc);
+ options.AddIfPresent(nameof(reject), reject);
+ options.AddIfPresent(nameof(optical), optical);
+
+ return Operation.Call("mask_butterworth_ring", options, width, height, order, frequencyCutoff, amplitudeCutoff, ringwidth) as Image;
+ }
+
+ ///
+ /// Make fractal filter.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MaskFractal(width, height, fractalDimension, uchar: bool, nodc: bool, reject: bool, optical: bool);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Fractal dimension.
+ /// Output an unsigned char image.
+ /// Remove DC component.
+ /// Invert the sense of the filter.
+ /// Rotate quadrants to optical space.
+ /// A new .
+ public static Image MaskFractal(int width, int height, double fractalDimension, bool? uchar = null, bool? nodc = null, bool? reject = null, bool? optical = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(uchar), uchar);
+ options.AddIfPresent(nameof(nodc), nodc);
+ options.AddIfPresent(nameof(reject), reject);
+ options.AddIfPresent(nameof(optical), optical);
+
+ return Operation.Call("mask_fractal", options, width, height, fractalDimension) as Image;
+ }
+
+ ///
+ /// Make a gaussian filter.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MaskGaussian(width, height, frequencyCutoff, amplitudeCutoff, uchar: bool, nodc: bool, reject: bool, optical: bool);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Frequency cutoff.
+ /// Amplitude cutoff.
+ /// Output an unsigned char image.
+ /// Remove DC component.
+ /// Invert the sense of the filter.
+ /// Rotate quadrants to optical space.
+ /// A new .
+ public static Image MaskGaussian(int width, int height, double frequencyCutoff, double amplitudeCutoff, bool? uchar = null, bool? nodc = null, bool? reject = null, bool? optical = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(uchar), uchar);
+ options.AddIfPresent(nameof(nodc), nodc);
+ options.AddIfPresent(nameof(reject), reject);
+ options.AddIfPresent(nameof(optical), optical);
+
+ return Operation.Call("mask_gaussian", options, width, height, frequencyCutoff, amplitudeCutoff) as Image;
+ }
+
+ ///
+ /// Make a gaussian filter.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MaskGaussianBand(width, height, frequencyCutoffX, frequencyCutoffY, radius, amplitudeCutoff, uchar: bool, nodc: bool, reject: bool, optical: bool);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Frequency cutoff x.
+ /// Frequency cutoff y.
+ /// Radius of circle.
+ /// Amplitude cutoff.
+ /// Output an unsigned char image.
+ /// Remove DC component.
+ /// Invert the sense of the filter.
+ /// Rotate quadrants to optical space.
+ /// A new .
+ public static Image MaskGaussianBand(int width, int height, double frequencyCutoffX, double frequencyCutoffY, double radius, double amplitudeCutoff, bool? uchar = null, bool? nodc = null, bool? reject = null, bool? optical = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(uchar), uchar);
+ options.AddIfPresent(nameof(nodc), nodc);
+ options.AddIfPresent(nameof(reject), reject);
+ options.AddIfPresent(nameof(optical), optical);
+
+ return Operation.Call("mask_gaussian_band", options, width, height, frequencyCutoffX, frequencyCutoffY, radius, amplitudeCutoff) as Image;
+ }
+
+ ///
+ /// Make a gaussian ring filter.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MaskGaussianRing(width, height, frequencyCutoff, amplitudeCutoff, ringwidth, uchar: bool, nodc: bool, reject: bool, optical: bool);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Frequency cutoff.
+ /// Amplitude cutoff.
+ /// Ringwidth.
+ /// Output an unsigned char image.
+ /// Remove DC component.
+ /// Invert the sense of the filter.
+ /// Rotate quadrants to optical space.
+ /// A new .
+ public static Image MaskGaussianRing(int width, int height, double frequencyCutoff, double amplitudeCutoff, double ringwidth, bool? uchar = null, bool? nodc = null, bool? reject = null, bool? optical = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(uchar), uchar);
+ options.AddIfPresent(nameof(nodc), nodc);
+ options.AddIfPresent(nameof(reject), reject);
+ options.AddIfPresent(nameof(optical), optical);
+
+ return Operation.Call("mask_gaussian_ring", options, width, height, frequencyCutoff, amplitudeCutoff, ringwidth) as Image;
+ }
+
+ ///
+ /// Make an ideal filter.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MaskIdeal(width, height, frequencyCutoff, uchar: bool, nodc: bool, reject: bool, optical: bool);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Frequency cutoff.
+ /// Output an unsigned char image.
+ /// Remove DC component.
+ /// Invert the sense of the filter.
+ /// Rotate quadrants to optical space.
+ /// A new .
+ public static Image MaskIdeal(int width, int height, double frequencyCutoff, bool? uchar = null, bool? nodc = null, bool? reject = null, bool? optical = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(uchar), uchar);
+ options.AddIfPresent(nameof(nodc), nodc);
+ options.AddIfPresent(nameof(reject), reject);
+ options.AddIfPresent(nameof(optical), optical);
+
+ return Operation.Call("mask_ideal", options, width, height, frequencyCutoff) as Image;
+ }
+
+ ///
+ /// Make an ideal band filter.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MaskIdealBand(width, height, frequencyCutoffX, frequencyCutoffY, radius, uchar: bool, nodc: bool, reject: bool, optical: bool);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Frequency cutoff x.
+ /// Frequency cutoff y.
+ /// Radius of circle.
+ /// Output an unsigned char image.
+ /// Remove DC component.
+ /// Invert the sense of the filter.
+ /// Rotate quadrants to optical space.
+ /// A new .
+ public static Image MaskIdealBand(int width, int height, double frequencyCutoffX, double frequencyCutoffY, double radius, bool? uchar = null, bool? nodc = null, bool? reject = null, bool? optical = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(uchar), uchar);
+ options.AddIfPresent(nameof(nodc), nodc);
+ options.AddIfPresent(nameof(reject), reject);
+ options.AddIfPresent(nameof(optical), optical);
+
+ return Operation.Call("mask_ideal_band", options, width, height, frequencyCutoffX, frequencyCutoffY, radius) as Image;
+ }
+
+ ///
+ /// Make an ideal ring filter.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MaskIdealRing(width, height, frequencyCutoff, ringwidth, uchar: bool, nodc: bool, reject: bool, optical: bool);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Frequency cutoff.
+ /// Ringwidth.
+ /// Output an unsigned char image.
+ /// Remove DC component.
+ /// Invert the sense of the filter.
+ /// Rotate quadrants to optical space.
+ /// A new .
+ public static Image MaskIdealRing(int width, int height, double frequencyCutoff, double ringwidth, bool? uchar = null, bool? nodc = null, bool? reject = null, bool? optical = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(uchar), uchar);
+ options.AddIfPresent(nameof(nodc), nodc);
+ options.AddIfPresent(nameof(reject), reject);
+ options.AddIfPresent(nameof(optical), optical);
+
+ return Operation.Call("mask_ideal_ring", options, width, height, frequencyCutoff, ringwidth) as Image;
+ }
+
+ ///
+ /// First-order match of two images.
+ ///
+ ///
+ ///
+ /// using Image @out = ref.Match(sec, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2, hwindow: int, harea: int, search: bool, interpolate: GObject);
+ ///
+ ///
+ /// Secondary image.
+ /// Position of first reference tie-point.
+ /// Position of first reference tie-point.
+ /// Position of first secondary tie-point.
+ /// Position of first secondary tie-point.
+ /// Position of second reference tie-point.
+ /// Position of second reference tie-point.
+ /// Position of second secondary tie-point.
+ /// Position of second secondary tie-point.
+ /// Half window size.
+ /// Half area size.
+ /// Search to improve tie-points.
+ /// Interpolate pixels with this.
+ /// A new .
+ public Image Match(Image sec, int xr1, int yr1, int xs1, int ys1, int xr2, int yr2, int xs2, int ys2, int? hwindow = null, int? harea = null, bool? search = null, GObject interpolate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(hwindow), hwindow);
+ options.AddIfPresent(nameof(harea), harea);
+ options.AddIfPresent(nameof(search), search);
+ options.AddIfPresent(nameof(interpolate), interpolate);
+
+ return this.Call("match", options, sec, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2) as Image;
+ }
+
+ ///
+ /// Apply a math operation to an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Math(math);
+ ///
+ ///
+ /// Math to perform.
+ /// A new .
+ public Image Math(Enums.OperationMath math)
+ {
+ return this.Call("math", math) as Image;
+ }
+
+ ///
+ /// Binary math operations.
+ ///
+ ///
+ ///
+ /// using Image @out = left.Math2(right, math2);
+ ///
+ ///
+ /// Right-hand image argument.
+ /// Math to perform.
+ /// A new .
+ public Image Math2(Image right, Enums.OperationMath2 math2)
+ {
+ return this.Call("math2", right, math2) as Image;
+ }
+
+ ///
+ /// Binary math operations with a constant.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Math2Const(math2, c);
+ ///
+ ///
+ /// Math to perform.
+ /// Array of constants.
+ /// A new .
+ public Image Math2Const(Enums.OperationMath2 math2, double[] c)
+ {
+ return this.Call("math2_const", math2, c) as Image;
+ }
+
+ ///
+ /// Load mat from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Matload(filename, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Matload(string filename, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("matload", options, filename) as Image;
+ }
+
+ ///
+ /// Load mat from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Matload(filename, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Matload(string filename, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("matload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Invert a matrix.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Matrixinvert();
+ ///
+ ///
+ /// A new .
+ public Image Matrixinvert()
+ {
+ return this.Call("matrixinvert") as Image;
+ }
+
+ ///
+ /// Load matrix.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Matrixload(filename, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Matrixload(string filename, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("matrixload", options, filename) as Image;
+ }
+
+ ///
+ /// Load matrix.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Matrixload(filename, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Matrixload(string filename, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("matrixload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load matrix.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MatrixloadSource(source, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image MatrixloadSource(Source source, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("matrixload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load matrix.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MatrixloadStream(stream, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image MatrixloadStream(Stream stream, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = MatrixloadSource(source, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load matrix.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MatrixloadSource(source, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image MatrixloadSource(Source source, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("matrixload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load matrix.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.MatrixloadStream(stream, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image MatrixloadStream(Stream stream, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = MatrixloadSource(source, out flags, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Multiply two matrices.
+ ///
+ ///
+ ///
+ /// using Image @out = left.Matrixmultiply(right);
+ ///
+ ///
+ /// Second matrix to multiply.
+ /// A new .
+ public Image Matrixmultiply(Image right)
+ {
+ return this.Call("matrixmultiply", right) as Image;
+ }
+
+ ///
+ /// Print matrix.
+ ///
+ ///
+ ///
+ /// in.Matrixprint(keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Matrixprint(Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("matrixprint", options);
+ }
+
+ ///
+ /// Save image to matrix.
+ ///
+ ///
+ ///
+ /// in.Matrixsave(filename, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Matrixsave(string filename, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("matrixsave", options, filename);
+ }
+
+ ///
+ /// Save image to matrix.
+ ///
+ ///
+ ///
+ /// in.MatrixsaveTarget(target, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Target to save to.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void MatrixsaveTarget(Target target, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("matrixsave_target", options, target);
+ }
+
+ ///
+ /// Save image to matrix.
+ ///
+ ///
+ ///
+ /// in.MatrixsaveStream(stream, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Stream to save to.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void MatrixsaveStream(Stream stream, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ MatrixsaveTarget(target, keep, background, pageHeight, profile);
+ }
+
+ ///
+ /// Find image maximum.
+ ///
+ ///
+ ///
+ /// double @out = in.Max(size: int);
+ ///
+ ///
+ /// Number of maximum values to find.
+ /// A double.
+ public double Max(int? size = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(size), size);
+
+ return this.Call("max", options) is double result ? result : 0d;
+ }
+
+ ///
+ /// Find image maximum.
+ ///
+ ///
+ ///
+ /// double @out = in.Max(out var x, size: int);
+ ///
+ ///
+ /// Horizontal position of maximum.
+ /// Number of maximum values to find.
+ /// A double.
+ public double Max(out int x, int? size = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(size), size);
+
+ options.Add("x", true);
+
+ var results = this.Call("max", options) as object[];
+ var finalResult = results?[0] is double result ? result : 0d;
+ var opts = results?[1] as VOption;
+ x = opts?["x"] is int out1 ? out1 : 0;
+
+ return finalResult;
+ }
+
+ ///
+ /// Find image maximum.
+ ///
+ ///
+ ///
+ /// double @out = in.Max(out var x, out var y, size: int);
+ ///
+ ///
+ /// Horizontal position of maximum.
+ /// Vertical position of maximum.
+ /// Number of maximum values to find.
+ /// A double.
+ public double Max(out int x, out int y, int? size = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(size), size);
+
+ options.Add("x", true);
+ options.Add("y", true);
+
+ var results = this.Call("max", options) as object[];
+ var finalResult = results?[0] is double result ? result : 0d;
+ var opts = results?[1] as VOption;
+ x = opts?["x"] is int out1 ? out1 : 0;
+ y = opts?["y"] is int out2 ? out2 : 0;
+
+ return finalResult;
+ }
+
+ ///
+ /// Find image maximum.
+ ///
+ ///
+ ///
+ /// double @out = in.Max(out var x, out var y, out var outArray, size: int);
+ ///
+ ///
+ /// Horizontal position of maximum.
+ /// Vertical position of maximum.
+ /// Array of output values.
+ /// Number of maximum values to find.
+ /// A double.
+ public double Max(out int x, out int y, out double[] outArray, int? size = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(size), size);
+
+ options.Add("x", true);
+ options.Add("y", true);
+ options.Add("out_array", true);
+
+ var results = this.Call("max", options) as object[];
+ var finalResult = results?[0] is double result ? result : 0d;
+ var opts = results?[1] as VOption;
+ x = opts?["x"] is int out1 ? out1 : 0;
+ y = opts?["y"] is int out2 ? out2 : 0;
+ outArray = opts?["out_array"] as double[];
+
+ return finalResult;
+ }
+
+ ///
+ /// Find image maximum.
+ ///
+ ///
+ ///
+ /// double @out = in.Max(out var x, out var y, out var outArray, out var xArray, size: int);
+ ///
+ ///
+ /// Horizontal position of maximum.
+ /// Vertical position of maximum.
+ /// Array of output values.
+ /// Array of horizontal positions.
+ /// Number of maximum values to find.
+ /// A double.
+ public double Max(out int x, out int y, out double[] outArray, out int[] xArray, int? size = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(size), size);
+
+ options.Add("x", true);
+ options.Add("y", true);
+ options.Add("out_array", true);
+ options.Add("x_array", true);
+
+ var results = this.Call("max", options) as object[];
+ var finalResult = results?[0] is double result ? result : 0d;
+ var opts = results?[1] as VOption;
+ x = opts?["x"] is int out1 ? out1 : 0;
+ y = opts?["y"] is int out2 ? out2 : 0;
+ outArray = opts?["out_array"] as double[];
+ xArray = opts?["x_array"] as int[];
+
+ return finalResult;
+ }
+
+ ///
+ /// Find image maximum.
+ ///
+ ///
+ ///
+ /// double @out = in.Max(out var x, out var y, out var outArray, out var xArray, out var yArray, size: int);
+ ///
+ ///
+ /// Horizontal position of maximum.
+ /// Vertical position of maximum.
+ /// Array of output values.
+ /// Array of horizontal positions.
+ /// Array of vertical positions.
+ /// Number of maximum values to find.
+ /// A double.
+ public double Max(out int x, out int y, out double[] outArray, out int[] xArray, out int[] yArray, int? size = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(size), size);
+
+ options.Add("x", true);
+ options.Add("y", true);
+ options.Add("out_array", true);
+ options.Add("x_array", true);
+ options.Add("y_array", true);
+
+ var results = this.Call("max", options) as object[];
+ var finalResult = results?[0] is double result ? result : 0d;
+ var opts = results?[1] as VOption;
+ x = opts?["x"] is int out1 ? out1 : 0;
+ y = opts?["y"] is int out2 ? out2 : 0;
+ outArray = opts?["out_array"] as double[];
+ xArray = opts?["x_array"] as int[];
+ yArray = opts?["y_array"] as int[];
+
+ return finalResult;
+ }
+
+ ///
+ /// Maximum of a pair of images.
+ ///
+ ///
+ ///
+ /// using Image @out = left.Maxpair(right);
+ ///
+ ///
+ /// Right-hand image argument.
+ /// A new .
+ public Image Maxpair(Image right)
+ {
+ return this.Call("maxpair", right) as Image;
+ }
+
+ ///
+ /// Measure a set of patches on a color chart.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Measure(h, v, left: int, top: int, width: int, height: int);
+ ///
+ ///
+ /// Number of patches across chart.
+ /// Number of patches down chart.
+ /// Left edge of extract area.
+ /// Top edge of extract area.
+ /// Width of extract area.
+ /// Height of extract area.
+ /// A new .
+ public Image Measure(int h, int v, int? left = null, int? top = null, int? width = null, int? height = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(left), left);
+ options.AddIfPresent(nameof(top), top);
+ options.AddIfPresent(nameof(width), width);
+ options.AddIfPresent(nameof(height), height);
+
+ return this.Call("measure", options, h, v) as Image;
+ }
+
+ ///
+ /// Merge two images.
+ ///
+ ///
+ ///
+ /// using Image @out = ref.Merge(sec, direction, dx, dy, mblend: int);
+ ///
+ ///
+ /// Secondary image.
+ /// Horizontal or vertical merge.
+ /// Horizontal displacement from sec to ref.
+ /// Vertical displacement from sec to ref.
+ /// Maximum blend size.
+ /// A new .
+ public Image Merge(Image sec, Enums.Direction direction, int dx, int dy, int? mblend = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(mblend), mblend);
+
+ return this.Call("merge", options, sec, direction, dx, dy) as Image;
+ }
+
+ ///
+ /// Find image minimum.
+ ///
+ ///
+ ///
+ /// double @out = in.Min(size: int);
+ ///
+ ///
+ /// Number of minimum values to find.
+ /// A double.
+ public double Min(int? size = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(size), size);
+
+ return this.Call("min", options) is double result ? result : 0d;
+ }
+
+ ///
+ /// Find image minimum.
+ ///
+ ///
+ ///
+ /// double @out = in.Min(out var x, size: int);
+ ///
+ ///
+ /// Horizontal position of minimum.
+ /// Number of minimum values to find.
+ /// A double.
+ public double Min(out int x, int? size = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(size), size);
+
+ options.Add("x", true);
+
+ var results = this.Call("min", options) as object[];
+ var finalResult = results?[0] is double result ? result : 0d;
+ var opts = results?[1] as VOption;
+ x = opts?["x"] is int out1 ? out1 : 0;
+
+ return finalResult;
+ }
+
+ ///
+ /// Find image minimum.
+ ///
+ ///
+ ///
+ /// double @out = in.Min(out var x, out var y, size: int);
+ ///
+ ///
+ /// Horizontal position of minimum.
+ /// Vertical position of minimum.
+ /// Number of minimum values to find.
+ /// A double.
+ public double Min(out int x, out int y, int? size = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(size), size);
+
+ options.Add("x", true);
+ options.Add("y", true);
+
+ var results = this.Call("min", options) as object[];
+ var finalResult = results?[0] is double result ? result : 0d;
+ var opts = results?[1] as VOption;
+ x = opts?["x"] is int out1 ? out1 : 0;
+ y = opts?["y"] is int out2 ? out2 : 0;
+
+ return finalResult;
+ }
+
+ ///
+ /// Find image minimum.
+ ///
+ ///
+ ///
+ /// double @out = in.Min(out var x, out var y, out var outArray, size: int);
+ ///
+ ///
+ /// Horizontal position of minimum.
+ /// Vertical position of minimum.
+ /// Array of output values.
+ /// Number of minimum values to find.
+ /// A double.
+ public double Min(out int x, out int y, out double[] outArray, int? size = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(size), size);
+
+ options.Add("x", true);
+ options.Add("y", true);
+ options.Add("out_array", true);
+
+ var results = this.Call("min", options) as object[];
+ var finalResult = results?[0] is double result ? result : 0d;
+ var opts = results?[1] as VOption;
+ x = opts?["x"] is int out1 ? out1 : 0;
+ y = opts?["y"] is int out2 ? out2 : 0;
+ outArray = opts?["out_array"] as double[];
+
+ return finalResult;
+ }
+
+ ///
+ /// Find image minimum.
+ ///
+ ///
+ ///
+ /// double @out = in.Min(out var x, out var y, out var outArray, out var xArray, size: int);
+ ///
+ ///
+ /// Horizontal position of minimum.
+ /// Vertical position of minimum.
+ /// Array of output values.
+ /// Array of horizontal positions.
+ /// Number of minimum values to find.
+ /// A double.
+ public double Min(out int x, out int y, out double[] outArray, out int[] xArray, int? size = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(size), size);
+
+ options.Add("x", true);
+ options.Add("y", true);
+ options.Add("out_array", true);
+ options.Add("x_array", true);
+
+ var results = this.Call("min", options) as object[];
+ var finalResult = results?[0] is double result ? result : 0d;
+ var opts = results?[1] as VOption;
+ x = opts?["x"] is int out1 ? out1 : 0;
+ y = opts?["y"] is int out2 ? out2 : 0;
+ outArray = opts?["out_array"] as double[];
+ xArray = opts?["x_array"] as int[];
+
+ return finalResult;
+ }
+
+ ///
+ /// Find image minimum.
+ ///
+ ///
+ ///
+ /// double @out = in.Min(out var x, out var y, out var outArray, out var xArray, out var yArray, size: int);
+ ///
+ ///
+ /// Horizontal position of minimum.
+ /// Vertical position of minimum.
+ /// Array of output values.
+ /// Array of horizontal positions.
+ /// Array of vertical positions.
+ /// Number of minimum values to find.
+ /// A double.
+ public double Min(out int x, out int y, out double[] outArray, out int[] xArray, out int[] yArray, int? size = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(size), size);
+
+ options.Add("x", true);
+ options.Add("y", true);
+ options.Add("out_array", true);
+ options.Add("x_array", true);
+ options.Add("y_array", true);
+
+ var results = this.Call("min", options) as object[];
+ var finalResult = results?[0] is double result ? result : 0d;
+ var opts = results?[1] as VOption;
+ x = opts?["x"] is int out1 ? out1 : 0;
+ y = opts?["y"] is int out2 ? out2 : 0;
+ outArray = opts?["out_array"] as double[];
+ xArray = opts?["x_array"] as int[];
+ yArray = opts?["y_array"] as int[];
+
+ return finalResult;
+ }
+
+ ///
+ /// Minimum of a pair of images.
+ ///
+ ///
+ ///
+ /// using Image @out = left.Minpair(right);
+ ///
+ ///
+ /// Right-hand image argument.
+ /// A new .
+ public Image Minpair(Image right)
+ {
+ return this.Call("minpair", right) as Image;
+ }
+
+ ///
+ /// Morphology operation.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Morph(mask, morph);
+ ///
+ ///
+ /// Input matrix image.
+ /// Morphological operation to perform.
+ /// A new .
+ public Image Morph(Image mask, Enums.OperationMorphology morph)
+ {
+ return this.Call("morph", mask, morph) as Image;
+ }
+
+ ///
+ /// Mosaic two images.
+ ///
+ ///
+ ///
+ /// using Image @out = ref.Mosaic(sec, direction, xref, yref, xsec, ysec, hwindow: int, harea: int, mblend: int, bandno: int);
+ ///
+ ///
+ /// Secondary image.
+ /// Horizontal or vertical mosaic.
+ /// Position of reference tie-point.
+ /// Position of reference tie-point.
+ /// Position of secondary tie-point.
+ /// Position of secondary tie-point.
+ /// Half window size.
+ /// Half area size.
+ /// Maximum blend size.
+ /// Band to search for features on.
+ /// A new .
+ public Image Mosaic(Image sec, Enums.Direction direction, int xref, int yref, int xsec, int ysec, int? hwindow = null, int? harea = null, int? mblend = null, int? bandno = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(hwindow), hwindow);
+ options.AddIfPresent(nameof(harea), harea);
+ options.AddIfPresent(nameof(mblend), mblend);
+ options.AddIfPresent(nameof(bandno), bandno);
+
+ return this.Call("mosaic", options, sec, direction, xref, yref, xsec, ysec) as Image;
+ }
+
+ ///
+ /// Mosaic two images.
+ ///
+ ///
+ ///
+ /// using Image @out = ref.Mosaic(sec, direction, xref, yref, xsec, ysec, out var dx0, hwindow: int, harea: int, mblend: int, bandno: int);
+ ///
+ ///
+ /// Secondary image.
+ /// Horizontal or vertical mosaic.
+ /// Position of reference tie-point.
+ /// Position of reference tie-point.
+ /// Position of secondary tie-point.
+ /// Position of secondary tie-point.
+ /// Detected integer offset.
+ /// Half window size.
+ /// Half area size.
+ /// Maximum blend size.
+ /// Band to search for features on.
+ /// A new .
+ public Image Mosaic(Image sec, Enums.Direction direction, int xref, int yref, int xsec, int ysec, out int dx0, int? hwindow = null, int? harea = null, int? mblend = null, int? bandno = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(hwindow), hwindow);
+ options.AddIfPresent(nameof(harea), harea);
+ options.AddIfPresent(nameof(mblend), mblend);
+ options.AddIfPresent(nameof(bandno), bandno);
+
+ options.Add("dx0", true);
+
+ var results = this.Call("mosaic", options, sec, direction, xref, yref, xsec, ysec) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ dx0 = opts?["dx0"] is int out1 ? out1 : 0;
+
+ return finalResult;
+ }
+
+ ///
+ /// Mosaic two images.
+ ///
+ ///
+ ///
+ /// using Image @out = ref.Mosaic(sec, direction, xref, yref, xsec, ysec, out var dx0, out var dy0, hwindow: int, harea: int, mblend: int, bandno: int);
+ ///
+ ///
+ /// Secondary image.
+ /// Horizontal or vertical mosaic.
+ /// Position of reference tie-point.
+ /// Position of reference tie-point.
+ /// Position of secondary tie-point.
+ /// Position of secondary tie-point.
+ /// Detected integer offset.
+ /// Detected integer offset.
+ /// Half window size.
+ /// Half area size.
+ /// Maximum blend size.
+ /// Band to search for features on.
+ /// A new .
+ public Image Mosaic(Image sec, Enums.Direction direction, int xref, int yref, int xsec, int ysec, out int dx0, out int dy0, int? hwindow = null, int? harea = null, int? mblend = null, int? bandno = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(hwindow), hwindow);
+ options.AddIfPresent(nameof(harea), harea);
+ options.AddIfPresent(nameof(mblend), mblend);
+ options.AddIfPresent(nameof(bandno), bandno);
+
+ options.Add("dx0", true);
+ options.Add("dy0", true);
+
+ var results = this.Call("mosaic", options, sec, direction, xref, yref, xsec, ysec) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ dx0 = opts?["dx0"] is int out1 ? out1 : 0;
+ dy0 = opts?["dy0"] is int out2 ? out2 : 0;
+
+ return finalResult;
+ }
+
+ ///
+ /// Mosaic two images.
+ ///
+ ///
+ ///
+ /// using Image @out = ref.Mosaic(sec, direction, xref, yref, xsec, ysec, out var dx0, out var dy0, out var scale1, hwindow: int, harea: int, mblend: int, bandno: int);
+ ///
+ ///
+ /// Secondary image.
+ /// Horizontal or vertical mosaic.
+ /// Position of reference tie-point.
+ /// Position of reference tie-point.
+ /// Position of secondary tie-point.
+ /// Position of secondary tie-point.
+ /// Detected integer offset.
+ /// Detected integer offset.
+ /// Detected scale.
+ /// Half window size.
+ /// Half area size.
+ /// Maximum blend size.
+ /// Band to search for features on.
+ /// A new .
+ public Image Mosaic(Image sec, Enums.Direction direction, int xref, int yref, int xsec, int ysec, out int dx0, out int dy0, out double scale1, int? hwindow = null, int? harea = null, int? mblend = null, int? bandno = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(hwindow), hwindow);
+ options.AddIfPresent(nameof(harea), harea);
+ options.AddIfPresent(nameof(mblend), mblend);
+ options.AddIfPresent(nameof(bandno), bandno);
+
+ options.Add("dx0", true);
+ options.Add("dy0", true);
+ options.Add("scale1", true);
+
+ var results = this.Call("mosaic", options, sec, direction, xref, yref, xsec, ysec) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ dx0 = opts?["dx0"] is int out1 ? out1 : 0;
+ dy0 = opts?["dy0"] is int out2 ? out2 : 0;
+ scale1 = opts?["scale1"] is double out3 ? out3 : 0d;
+
+ return finalResult;
+ }
+
+ ///
+ /// Mosaic two images.
+ ///
+ ///
+ ///
+ /// using Image @out = ref.Mosaic(sec, direction, xref, yref, xsec, ysec, out var dx0, out var dy0, out var scale1, out var angle1, hwindow: int, harea: int, mblend: int, bandno: int);
+ ///
+ ///
+ /// Secondary image.
+ /// Horizontal or vertical mosaic.
+ /// Position of reference tie-point.
+ /// Position of reference tie-point.
+ /// Position of secondary tie-point.
+ /// Position of secondary tie-point.
+ /// Detected integer offset.
+ /// Detected integer offset.
+ /// Detected scale.
+ /// Detected rotation.
+ /// Half window size.
+ /// Half area size.
+ /// Maximum blend size.
+ /// Band to search for features on.
+ /// A new .
+ public Image Mosaic(Image sec, Enums.Direction direction, int xref, int yref, int xsec, int ysec, out int dx0, out int dy0, out double scale1, out double angle1, int? hwindow = null, int? harea = null, int? mblend = null, int? bandno = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(hwindow), hwindow);
+ options.AddIfPresent(nameof(harea), harea);
+ options.AddIfPresent(nameof(mblend), mblend);
+ options.AddIfPresent(nameof(bandno), bandno);
+
+ options.Add("dx0", true);
+ options.Add("dy0", true);
+ options.Add("scale1", true);
+ options.Add("angle1", true);
+
+ var results = this.Call("mosaic", options, sec, direction, xref, yref, xsec, ysec) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ dx0 = opts?["dx0"] is int out1 ? out1 : 0;
+ dy0 = opts?["dy0"] is int out2 ? out2 : 0;
+ scale1 = opts?["scale1"] is double out3 ? out3 : 0d;
+ angle1 = opts?["angle1"] is double out4 ? out4 : 0d;
+
+ return finalResult;
+ }
+
+ ///
+ /// Mosaic two images.
+ ///
+ ///
+ ///
+ /// using Image @out = ref.Mosaic(sec, direction, xref, yref, xsec, ysec, out var dx0, out var dy0, out var scale1, out var angle1, out var dy1, hwindow: int, harea: int, mblend: int, bandno: int);
+ ///
+ ///
+ /// Secondary image.
+ /// Horizontal or vertical mosaic.
+ /// Position of reference tie-point.
+ /// Position of reference tie-point.
+ /// Position of secondary tie-point.
+ /// Position of secondary tie-point.
+ /// Detected integer offset.
+ /// Detected integer offset.
+ /// Detected scale.
+ /// Detected rotation.
+ /// Detected first-order displacement.
+ /// Half window size.
+ /// Half area size.
+ /// Maximum blend size.
+ /// Band to search for features on.
+ /// A new .
+ public Image Mosaic(Image sec, Enums.Direction direction, int xref, int yref, int xsec, int ysec, out int dx0, out int dy0, out double scale1, out double angle1, out double dy1, int? hwindow = null, int? harea = null, int? mblend = null, int? bandno = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(hwindow), hwindow);
+ options.AddIfPresent(nameof(harea), harea);
+ options.AddIfPresent(nameof(mblend), mblend);
+ options.AddIfPresent(nameof(bandno), bandno);
+
+ options.Add("dx0", true);
+ options.Add("dy0", true);
+ options.Add("scale1", true);
+ options.Add("angle1", true);
+ options.Add("dy1", true);
+
+ var results = this.Call("mosaic", options, sec, direction, xref, yref, xsec, ysec) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ dx0 = opts?["dx0"] is int out1 ? out1 : 0;
+ dy0 = opts?["dy0"] is int out2 ? out2 : 0;
+ scale1 = opts?["scale1"] is double out3 ? out3 : 0d;
+ angle1 = opts?["angle1"] is double out4 ? out4 : 0d;
+ dy1 = opts?["dy1"] is double out5 ? out5 : 0d;
+
+ return finalResult;
+ }
+
+ ///
+ /// Mosaic two images.
+ ///
+ ///
+ ///
+ /// using Image @out = ref.Mosaic(sec, direction, xref, yref, xsec, ysec, out var dx0, out var dy0, out var scale1, out var angle1, out var dy1, out var dx1, hwindow: int, harea: int, mblend: int, bandno: int);
+ ///
+ ///
+ /// Secondary image.
+ /// Horizontal or vertical mosaic.
+ /// Position of reference tie-point.
+ /// Position of reference tie-point.
+ /// Position of secondary tie-point.
+ /// Position of secondary tie-point.
+ /// Detected integer offset.
+ /// Detected integer offset.
+ /// Detected scale.
+ /// Detected rotation.
+ /// Detected first-order displacement.
+ /// Detected first-order displacement.
+ /// Half window size.
+ /// Half area size.
+ /// Maximum blend size.
+ /// Band to search for features on.
+ /// A new .
+ public Image Mosaic(Image sec, Enums.Direction direction, int xref, int yref, int xsec, int ysec, out int dx0, out int dy0, out double scale1, out double angle1, out double dy1, out double dx1, int? hwindow = null, int? harea = null, int? mblend = null, int? bandno = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(hwindow), hwindow);
+ options.AddIfPresent(nameof(harea), harea);
+ options.AddIfPresent(nameof(mblend), mblend);
+ options.AddIfPresent(nameof(bandno), bandno);
+
+ options.Add("dx0", true);
+ options.Add("dy0", true);
+ options.Add("scale1", true);
+ options.Add("angle1", true);
+ options.Add("dy1", true);
+ options.Add("dx1", true);
+
+ var results = this.Call("mosaic", options, sec, direction, xref, yref, xsec, ysec) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ dx0 = opts?["dx0"] is int out1 ? out1 : 0;
+ dy0 = opts?["dy0"] is int out2 ? out2 : 0;
+ scale1 = opts?["scale1"] is double out3 ? out3 : 0d;
+ angle1 = opts?["angle1"] is double out4 ? out4 : 0d;
+ dy1 = opts?["dy1"] is double out5 ? out5 : 0d;
+ dx1 = opts?["dx1"] is double out6 ? out6 : 0d;
+
+ return finalResult;
+ }
+
+ ///
+ /// First-order mosaic of two images.
+ ///
+ ///
+ ///
+ /// using Image @out = ref.Mosaic1(sec, direction, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2, hwindow: int, harea: int, search: bool, interpolate: GObject, mblend: int);
+ ///
+ ///
+ /// Secondary image.
+ /// Horizontal or vertical mosaic.
+ /// Position of first reference tie-point.
+ /// Position of first reference tie-point.
+ /// Position of first secondary tie-point.
+ /// Position of first secondary tie-point.
+ /// Position of second reference tie-point.
+ /// Position of second reference tie-point.
+ /// Position of second secondary tie-point.
+ /// Position of second secondary tie-point.
+ /// Half window size.
+ /// Half area size.
+ /// Search to improve tie-points.
+ /// Interpolate pixels with this.
+ /// Maximum blend size.
+ /// A new .
+ public Image Mosaic1(Image sec, Enums.Direction direction, int xr1, int yr1, int xs1, int ys1, int xr2, int yr2, int xs2, int ys2, int? hwindow = null, int? harea = null, bool? search = null, GObject interpolate = null, int? mblend = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(hwindow), hwindow);
+ options.AddIfPresent(nameof(harea), harea);
+ options.AddIfPresent(nameof(search), search);
+ options.AddIfPresent(nameof(interpolate), interpolate);
+ options.AddIfPresent(nameof(mblend), mblend);
+
+ return this.Call("mosaic1", options, sec, direction, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2) as Image;
+ }
+
+ ///
+ /// Pick most-significant byte from an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Msb(band: int);
+ ///
+ ///
+ /// Band to msb.
+ /// A new .
+ public Image Msb(int? band = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(band), band);
+
+ return this.Call("msb", options) as Image;
+ }
+
+ ///
+ /// Multiply two images.
+ ///
+ ///
+ ///
+ /// using Image @out = left.Multiply(right);
+ ///
+ ///
+ /// Right-hand image argument.
+ /// A new .
+ public Image Multiply(Image right)
+ {
+ return this.Call("multiply", right) as Image;
+ }
+
+ ///
+ /// Load NIfTI volume.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Niftiload(filename, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Niftiload(string filename, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("niftiload", options, filename) as Image;
+ }
+
+ ///
+ /// Load NIfTI volume.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Niftiload(filename, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Niftiload(string filename, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("niftiload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load NIfTI volumes.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.NiftiloadSource(source, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image NiftiloadSource(Source source, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("niftiload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load NIfTI volumes.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.NiftiloadStream(stream, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image NiftiloadStream(Stream stream, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = NiftiloadSource(source, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load NIfTI volumes.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.NiftiloadSource(source, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image NiftiloadSource(Source source, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("niftiload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load NIfTI volumes.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.NiftiloadStream(stream, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image NiftiloadStream(Stream stream, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = NiftiloadSource(source, out flags, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Save image to nifti file.
+ ///
+ ///
+ ///
+ /// in.Niftisave(filename, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Niftisave(string filename, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("niftisave", options, filename);
+ }
+
+ ///
+ /// Load an OpenEXR image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Openexrload(filename, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Openexrload(string filename, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("openexrload", options, filename) as Image;
+ }
+
+ ///
+ /// Load an OpenEXR image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Openexrload(filename, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Openexrload(string filename, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("openexrload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load file with OpenSlide.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Openslideload(filename, level: int, autocrop: bool, associated: string, attachAssociated: bool, rgb: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Load this level from the file.
+ /// Crop to image bounds.
+ /// Load this associated image.
+ /// Attach all associated images.
+ /// Output RGB (not RGBA).
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Openslideload(string filename, int? level = null, bool? autocrop = null, string associated = null, bool? attachAssociated = null, bool? rgb = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(level), level);
+ options.AddIfPresent(nameof(autocrop), autocrop);
+ options.AddIfPresent(nameof(associated), associated);
+ options.AddIfPresent("attach_associated", attachAssociated);
+ options.AddIfPresent(nameof(rgb), rgb);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("openslideload", options, filename) as Image;
+ }
+
+ ///
+ /// Load file with OpenSlide.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Openslideload(filename, out var flags, level: int, autocrop: bool, associated: string, attachAssociated: bool, rgb: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Load this level from the file.
+ /// Crop to image bounds.
+ /// Load this associated image.
+ /// Attach all associated images.
+ /// Output RGB (not RGBA).
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Openslideload(string filename, out Enums.ForeignFlags flags, int? level = null, bool? autocrop = null, string associated = null, bool? attachAssociated = null, bool? rgb = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(level), level);
+ options.AddIfPresent(nameof(autocrop), autocrop);
+ options.AddIfPresent(nameof(associated), associated);
+ options.AddIfPresent("attach_associated", attachAssociated);
+ options.AddIfPresent(nameof(rgb), rgb);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("openslideload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load source with OpenSlide.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.OpenslideloadSource(source, level: int, autocrop: bool, associated: string, attachAssociated: bool, rgb: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Load this level from the file.
+ /// Crop to image bounds.
+ /// Load this associated image.
+ /// Attach all associated images.
+ /// Output RGB (not RGBA).
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image OpenslideloadSource(Source source, int? level = null, bool? autocrop = null, string associated = null, bool? attachAssociated = null, bool? rgb = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(level), level);
+ options.AddIfPresent(nameof(autocrop), autocrop);
+ options.AddIfPresent(nameof(associated), associated);
+ options.AddIfPresent("attach_associated", attachAssociated);
+ options.AddIfPresent(nameof(rgb), rgb);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("openslideload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load stream with OpenSlide.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.OpenslideloadStream(stream, level: int, autocrop: bool, associated: string, attachAssociated: bool, rgb: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Load this level from the file.
+ /// Crop to image bounds.
+ /// Load this associated image.
+ /// Attach all associated images.
+ /// Output RGB (not RGBA).
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image OpenslideloadStream(Stream stream, int? level = null, bool? autocrop = null, string associated = null, bool? attachAssociated = null, bool? rgb = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = OpenslideloadSource(source, level, autocrop, associated, attachAssociated, rgb, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load source with OpenSlide.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.OpenslideloadSource(source, out var flags, level: int, autocrop: bool, associated: string, attachAssociated: bool, rgb: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// Load this level from the file.
+ /// Crop to image bounds.
+ /// Load this associated image.
+ /// Attach all associated images.
+ /// Output RGB (not RGBA).
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image OpenslideloadSource(Source source, out Enums.ForeignFlags flags, int? level = null, bool? autocrop = null, string associated = null, bool? attachAssociated = null, bool? rgb = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(level), level);
+ options.AddIfPresent(nameof(autocrop), autocrop);
+ options.AddIfPresent(nameof(associated), associated);
+ options.AddIfPresent("attach_associated", attachAssociated);
+ options.AddIfPresent(nameof(rgb), rgb);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("openslideload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load stream with OpenSlide.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.OpenslideloadStream(stream, out var flags, level: int, autocrop: bool, associated: string, attachAssociated: bool, rgb: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// Load this level from the file.
+ /// Crop to image bounds.
+ /// Load this associated image.
+ /// Attach all associated images.
+ /// Output RGB (not RGBA).
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image OpenslideloadStream(Stream stream, out Enums.ForeignFlags flags, int? level = null, bool? autocrop = null, string associated = null, bool? attachAssociated = null, bool? rgb = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = OpenslideloadSource(source, out flags, level, autocrop, associated, attachAssociated, rgb, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load PDF from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Pdfload(filename, page: int, n: int, dpi: double, scale: double, background: double[], password: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// DPI to render at.
+ /// Factor to scale by.
+ /// Background colour.
+ /// Password to decrypt with.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Pdfload(string filename, int? page = null, int? n = null, double? dpi = null, double? scale = null, double[] background = null, string password = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(dpi), dpi);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent(nameof(password), password);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("pdfload", options, filename) as Image;
+ }
+
+ ///
+ /// Load PDF from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Pdfload(filename, out var flags, page: int, n: int, dpi: double, scale: double, background: double[], password: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// DPI to render at.
+ /// Factor to scale by.
+ /// Background colour.
+ /// Password to decrypt with.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Pdfload(string filename, out Enums.ForeignFlags flags, int? page = null, int? n = null, double? dpi = null, double? scale = null, double[] background = null, string password = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(dpi), dpi);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent(nameof(password), password);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("pdfload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load PDF from buffer.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PdfloadBuffer(buffer, page: int, n: int, dpi: double, scale: double, background: double[], password: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// DPI to render at.
+ /// Factor to scale by.
+ /// Background colour.
+ /// Password to decrypt with.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PdfloadBuffer(byte[] buffer, int? page = null, int? n = null, double? dpi = null, double? scale = null, double[] background = null, string password = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(dpi), dpi);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent(nameof(password), password);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("pdfload_buffer", options, buffer) as Image;
+ }
+
+ ///
+ /// Load PDF from buffer.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PdfloadBuffer(buffer, out var flags, page: int, n: int, dpi: double, scale: double, background: double[], password: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// DPI to render at.
+ /// Factor to scale by.
+ /// Background colour.
+ /// Password to decrypt with.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PdfloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, int? page = null, int? n = null, double? dpi = null, double? scale = null, double[] background = null, string password = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(dpi), dpi);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent(nameof(password), password);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("pdfload_buffer", options, buffer) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load PDF from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PdfloadSource(source, page: int, n: int, dpi: double, scale: double, background: double[], password: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// DPI to render at.
+ /// Factor to scale by.
+ /// Background colour.
+ /// Password to decrypt with.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PdfloadSource(Source source, int? page = null, int? n = null, double? dpi = null, double? scale = null, double[] background = null, string password = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(dpi), dpi);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent(nameof(password), password);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("pdfload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load PDF from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PdfloadStream(stream, page: int, n: int, dpi: double, scale: double, background: double[], password: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// DPI to render at.
+ /// Factor to scale by.
+ /// Background colour.
+ /// Password to decrypt with.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PdfloadStream(Stream stream, int? page = null, int? n = null, double? dpi = null, double? scale = null, double[] background = null, string password = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = PdfloadSource(source, page, n, dpi, scale, background, password, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load PDF from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PdfloadSource(source, out var flags, page: int, n: int, dpi: double, scale: double, background: double[], password: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// DPI to render at.
+ /// Factor to scale by.
+ /// Background colour.
+ /// Password to decrypt with.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PdfloadSource(Source source, out Enums.ForeignFlags flags, int? page = null, int? n = null, double? dpi = null, double? scale = null, double[] background = null, string password = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(dpi), dpi);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent(nameof(password), password);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("pdfload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load PDF from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PdfloadStream(stream, out var flags, page: int, n: int, dpi: double, scale: double, background: double[], password: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// DPI to render at.
+ /// Factor to scale by.
+ /// Background colour.
+ /// Password to decrypt with.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PdfloadStream(Stream stream, out Enums.ForeignFlags flags, int? page = null, int? n = null, double? dpi = null, double? scale = null, double[] background = null, string password = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = PdfloadSource(source, out flags, page, n, dpi, scale, background, password, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Find threshold for percent of pixels.
+ ///
+ ///
+ ///
+ /// int threshold = in.Percent(percent);
+ ///
+ ///
+ /// Percent of pixels.
+ /// A int.
+ public int Percent(double percent)
+ {
+ return this.Call("percent", percent) is int result ? result : 0;
+ }
+
+ ///
+ /// Make a perlin noise image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Perlin(width, height, cellSize: int, uchar: bool, seed: int);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Size of Perlin cells.
+ /// Output an unsigned char image.
+ /// Random number seed.
+ /// A new .
+ public static Image Perlin(int width, int height, int? cellSize = null, bool? uchar = null, int? seed = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("cell_size", cellSize);
+ options.AddIfPresent(nameof(uchar), uchar);
+ options.AddIfPresent(nameof(seed), seed);
+
+ return Operation.Call("perlin", options, width, height) as Image;
+ }
+
+ ///
+ /// Calculate phase correlation.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Phasecor(in2);
+ ///
+ ///
+ /// Second input image.
+ /// A new .
+ public Image Phasecor(Image in2)
+ {
+ return this.Call("phasecor", in2) as Image;
+ }
+
+ ///
+ /// Load png from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Pngload(filename, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Pngload(string filename, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("pngload", options, filename) as Image;
+ }
+
+ ///
+ /// Load png from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Pngload(filename, out var flags, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Pngload(string filename, out Enums.ForeignFlags flags, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("pngload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load png from buffer.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PngloadBuffer(buffer, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PngloadBuffer(byte[] buffer, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("pngload_buffer", options, buffer) as Image;
+ }
+
+ ///
+ /// Load png from buffer.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PngloadBuffer(buffer, out var flags, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Flags for this file.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PngloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("pngload_buffer", options, buffer) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load png from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PngloadSource(source, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PngloadSource(Source source, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("pngload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load png from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PngloadStream(stream, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PngloadStream(Stream stream, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = PngloadSource(source, unlimited, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load png from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PngloadSource(source, out var flags, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PngloadSource(Source source, out Enums.ForeignFlags flags, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("pngload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load png from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PngloadStream(stream, out var flags, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PngloadStream(Stream stream, out Enums.ForeignFlags flags, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = PngloadSource(source, out flags, unlimited, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Save image to file as PNG.
+ ///
+ ///
+ ///
+ /// in.Pngsave(filename, compression: int, interlace: bool, filter: Enums.ForeignPngFilter, palette: bool, q: int, dither: double, bitdepth: int, effort: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Compression factor.
+ /// Interlace image.
+ /// libspng row filter flag(s).
+ /// Quantise to 8bpp palette.
+ /// Quantisation quality.
+ /// Amount of dithering.
+ /// Write as a 1, 2, 4, 8 or 16 bit image.
+ /// Quantisation CPU effort.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Pngsave(string filename, int? compression = null, bool? interlace = null, Enums.ForeignPngFilter? filter = null, bool? palette = null, int? q = null, double? dither = null, int? bitdepth = null, int? effort = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(compression), compression);
+ options.AddIfPresent(nameof(interlace), interlace);
+ options.AddIfPresent(nameof(filter), filter);
+ options.AddIfPresent(nameof(palette), palette);
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent(nameof(dither), dither);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("pngsave", options, filename);
+ }
+
+ ///
+ /// Save image to buffer as PNG.
+ ///
+ ///
+ ///
+ /// byte[] buffer = in.PngsaveBuffer(compression: int, interlace: bool, filter: Enums.ForeignPngFilter, palette: bool, q: int, dither: double, bitdepth: int, effort: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Compression factor.
+ /// Interlace image.
+ /// libspng row filter flag(s).
+ /// Quantise to 8bpp palette.
+ /// Quantisation quality.
+ /// Amount of dithering.
+ /// Write as a 1, 2, 4, 8 or 16 bit image.
+ /// Quantisation CPU effort.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ /// An array of bytes.
+ public byte[] PngsaveBuffer(int? compression = null, bool? interlace = null, Enums.ForeignPngFilter? filter = null, bool? palette = null, int? q = null, double? dither = null, int? bitdepth = null, int? effort = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(compression), compression);
+ options.AddIfPresent(nameof(interlace), interlace);
+ options.AddIfPresent(nameof(filter), filter);
+ options.AddIfPresent(nameof(palette), palette);
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent(nameof(dither), dither);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ return this.Call("pngsave_buffer", options) as byte[];
+ }
+
+ ///
+ /// Save image to target as PNG.
+ ///
+ ///
+ ///
+ /// in.PngsaveTarget(target, compression: int, interlace: bool, filter: Enums.ForeignPngFilter, palette: bool, q: int, dither: double, bitdepth: int, effort: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Target to save to.
+ /// Compression factor.
+ /// Interlace image.
+ /// libspng row filter flag(s).
+ /// Quantise to 8bpp palette.
+ /// Quantisation quality.
+ /// Amount of dithering.
+ /// Write as a 1, 2, 4, 8 or 16 bit image.
+ /// Quantisation CPU effort.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void PngsaveTarget(Target target, int? compression = null, bool? interlace = null, Enums.ForeignPngFilter? filter = null, bool? palette = null, int? q = null, double? dither = null, int? bitdepth = null, int? effort = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(compression), compression);
+ options.AddIfPresent(nameof(interlace), interlace);
+ options.AddIfPresent(nameof(filter), filter);
+ options.AddIfPresent(nameof(palette), palette);
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent(nameof(dither), dither);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("pngsave_target", options, target);
+ }
+
+ ///
+ /// Save image to stream as PNG.
+ ///
+ ///
+ ///
+ /// in.PngsaveStream(stream, compression: int, interlace: bool, filter: Enums.ForeignPngFilter, palette: bool, q: int, dither: double, bitdepth: int, effort: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Stream to save to.
+ /// Compression factor.
+ /// Interlace image.
+ /// libspng row filter flag(s).
+ /// Quantise to 8bpp palette.
+ /// Quantisation quality.
+ /// Amount of dithering.
+ /// Write as a 1, 2, 4, 8 or 16 bit image.
+ /// Quantisation CPU effort.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void PngsaveStream(Stream stream, int? compression = null, bool? interlace = null, Enums.ForeignPngFilter? filter = null, bool? palette = null, int? q = null, double? dither = null, int? bitdepth = null, int? effort = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ PngsaveTarget(target, compression, interlace, filter, palette, q, dither, bitdepth, effort, keep, background, pageHeight, profile);
+ }
+
+ ///
+ /// Load ppm from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Ppmload(filename, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Ppmload(string filename, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("ppmload", options, filename) as Image;
+ }
+
+ ///
+ /// Load ppm from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Ppmload(filename, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Ppmload(string filename, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("ppmload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load ppm from buffer.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PpmloadBuffer(buffer, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PpmloadBuffer(byte[] buffer, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("ppmload_buffer", options, buffer) as Image;
+ }
+
+ ///
+ /// Load ppm from buffer.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PpmloadBuffer(buffer, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PpmloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("ppmload_buffer", options, buffer) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load ppm from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PpmloadSource(source, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PpmloadSource(Source source, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("ppmload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load ppm from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PpmloadStream(stream, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PpmloadStream(Stream stream, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = PpmloadSource(source, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load ppm from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PpmloadSource(source, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PpmloadSource(Source source, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("ppmload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load ppm from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.PpmloadStream(stream, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image PpmloadStream(Stream stream, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = PpmloadSource(source, out flags, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Save image to ppm file.
+ ///
+ ///
+ ///
+ /// in.Ppmsave(filename, format: Enums.ForeignPpmFormat, ascii: bool, bitdepth: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Format to save in.
+ /// Save as ascii.
+ /// Set to 1 to write as a 1 bit image.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Ppmsave(string filename, Enums.ForeignPpmFormat? format = null, bool? ascii = null, int? bitdepth = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(format), format);
+ options.AddIfPresent(nameof(ascii), ascii);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("ppmsave", options, filename);
+ }
+
+ ///
+ /// Save to ppm.
+ ///
+ ///
+ ///
+ /// in.PpmsaveTarget(target, format: Enums.ForeignPpmFormat, ascii: bool, bitdepth: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Target to save to.
+ /// Format to save in.
+ /// Save as ascii.
+ /// Set to 1 to write as a 1 bit image.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void PpmsaveTarget(Target target, Enums.ForeignPpmFormat? format = null, bool? ascii = null, int? bitdepth = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(format), format);
+ options.AddIfPresent(nameof(ascii), ascii);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("ppmsave_target", options, target);
+ }
+
+ ///
+ /// Save to ppm.
+ ///
+ ///
+ ///
+ /// in.PpmsaveStream(stream, format: Enums.ForeignPpmFormat, ascii: bool, bitdepth: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Stream to save to.
+ /// Format to save in.
+ /// Save as ascii.
+ /// Set to 1 to write as a 1 bit image.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void PpmsaveStream(Stream stream, Enums.ForeignPpmFormat? format = null, bool? ascii = null, int? bitdepth = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ PpmsaveTarget(target, format, ascii, bitdepth, keep, background, pageHeight, profile);
+ }
+
+ ///
+ /// Premultiply image alpha.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Premultiply(maxAlpha: double);
+ ///
+ ///
+ /// Maximum value of alpha channel.
+ /// A new .
+ public Image Premultiply(double? maxAlpha = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("max_alpha", maxAlpha);
+
+ return this.Call("premultiply", options) as Image;
+ }
+
+ ///
+ /// Prewitt edge detector.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Prewitt();
+ ///
+ ///
+ /// A new .
+ public Image Prewitt()
+ {
+ return this.Call("prewitt") as Image;
+ }
+
+ ///
+ /// Find image profiles.
+ ///
+ ///
+ ///
+ /// var output = in.Profile();
+ ///
+ ///
+ /// An array of objects.
+ public object[] Profile()
+ {
+ return this.Call("profile") as object[];
+ }
+
+ ///
+ /// Load named ICC profile.
+ ///
+ ///
+ ///
+ /// byte[] profile = NetVips.Image.ProfileLoad(name);
+ ///
+ ///
+ /// Profile name.
+ /// An array of bytes.
+ public static byte[] ProfileLoad(string name)
+ {
+ return Operation.Call("profile_load", name) as byte[];
+ }
+
+ ///
+ /// Find image projections.
+ ///
+ ///
+ ///
+ /// var output = in.Project();
+ ///
+ ///
+ /// An array of objects.
+ public object[] Project()
+ {
+ return this.Call("project") as object[];
+ }
+
+ ///
+ /// Resample an image with a quadratic transform.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Quadratic(coeff, interpolate: GObject);
+ ///
+ ///
+ /// Coefficient matrix.
+ /// Interpolate values with this.
+ /// A new .
+ public Image Quadratic(Image coeff, GObject interpolate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(interpolate), interpolate);
+
+ return this.Call("quadratic", options, coeff) as Image;
+ }
+
+ ///
+ /// Unpack Radiance coding to float RGB.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Rad2float();
+ ///
+ ///
+ /// A new .
+ public Image Rad2float()
+ {
+ return this.Call("rad2float") as Image;
+ }
+
+ ///
+ /// Load a Radiance image from a file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Radload(filename, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Radload(string filename, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("radload", options, filename) as Image;
+ }
+
+ ///
+ /// Load a Radiance image from a file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Radload(filename, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Radload(string filename, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("radload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load rad from buffer.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.RadloadBuffer(buffer, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image RadloadBuffer(byte[] buffer, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("radload_buffer", options, buffer) as Image;
+ }
+
+ ///
+ /// Load rad from buffer.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.RadloadBuffer(buffer, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image RadloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("radload_buffer", options, buffer) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load rad from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.RadloadSource(source, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image RadloadSource(Source source, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("radload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load rad from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.RadloadStream(stream, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image RadloadStream(Stream stream, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = RadloadSource(source, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load rad from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.RadloadSource(source, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image RadloadSource(Source source, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("radload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load rad from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.RadloadStream(stream, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image RadloadStream(Stream stream, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = RadloadSource(source, out flags, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Save image to Radiance file.
+ ///
+ ///
+ ///
+ /// in.Radsave(filename, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Radsave(string filename, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("radsave", options, filename);
+ }
+
+ ///
+ /// Save image to Radiance buffer.
+ ///
+ ///
+ ///
+ /// byte[] buffer = in.RadsaveBuffer(keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ /// An array of bytes.
+ public byte[] RadsaveBuffer(Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ return this.Call("radsave_buffer", options) as byte[];
+ }
+
+ ///
+ /// Save image to Radiance target.
+ ///
+ ///
+ ///
+ /// in.RadsaveTarget(target, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Target to save to.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void RadsaveTarget(Target target, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("radsave_target", options, target);
+ }
+
+ ///
+ /// Save image to Radiance stream.
+ ///
+ ///
+ ///
+ /// in.RadsaveStream(stream, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Stream to save to.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void RadsaveStream(Stream stream, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ RadsaveTarget(target, keep, background, pageHeight, profile);
+ }
+
+ ///
+ /// Rank filter.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Rank(width, height, index);
+ ///
+ ///
+ /// Window width in pixels.
+ /// Window height in pixels.
+ /// Select pixel at index.
+ /// A new .
+ public Image Rank(int width, int height, int index)
+ {
+ return this.Call("rank", width, height, index) as Image;
+ }
+
+ ///
+ /// Load raw data from a file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Rawload(filename, width, height, bands, offset: ulong, format: Enums.BandFormat, interpretation: Enums.Interpretation, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Number of bands in image.
+ /// Offset in bytes from start of file.
+ /// Pixel format in image.
+ /// Pixel interpretation.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Rawload(string filename, int width, int height, int bands, ulong? offset = null, Enums.BandFormat? format = null, Enums.Interpretation? interpretation = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(offset), offset);
+ options.AddIfPresent(nameof(format), format);
+ options.AddIfPresent(nameof(interpretation), interpretation);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("rawload", options, filename, width, height, bands) as Image;
+ }
+
+ ///
+ /// Load raw data from a file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Rawload(filename, width, height, bands, out var flags, offset: ulong, format: Enums.BandFormat, interpretation: Enums.Interpretation, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Number of bands in image.
+ /// Flags for this file.
+ /// Offset in bytes from start of file.
+ /// Pixel format in image.
+ /// Pixel interpretation.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Rawload(string filename, int width, int height, int bands, out Enums.ForeignFlags flags, ulong? offset = null, Enums.BandFormat? format = null, Enums.Interpretation? interpretation = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(offset), offset);
+ options.AddIfPresent(nameof(format), format);
+ options.AddIfPresent(nameof(interpretation), interpretation);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("rawload", options, filename, width, height, bands) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Save image to raw file.
+ ///
+ ///
+ ///
+ /// in.Rawsave(filename, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Rawsave(string filename, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("rawsave", options, filename);
+ }
+
+ ///
+ /// Write raw image to buffer.
+ ///
+ ///
+ ///
+ /// byte[] buffer = in.RawsaveBuffer(keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ /// An array of bytes.
+ public byte[] RawsaveBuffer(Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ return this.Call("rawsave_buffer", options) as byte[];
+ }
+
+ ///
+ /// Write raw image to target.
+ ///
+ ///
+ ///
+ /// in.RawsaveTarget(target, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Target to save to.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void RawsaveTarget(Target target, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("rawsave_target", options, target);
+ }
+
+ ///
+ /// Write raw image to stream.
+ ///
+ ///
+ ///
+ /// in.RawsaveStream(stream, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Stream to save to.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void RawsaveStream(Stream stream, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ RawsaveTarget(target, keep, background, pageHeight, profile);
+ }
+
+ ///
+ /// Linear recombination with matrix.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Recomb(m);
+ ///
+ ///
+ /// Matrix of coefficients.
+ /// A new .
+ public Image Recomb(Image m)
+ {
+ return this.Call("recomb", m) as Image;
+ }
+
+ ///
+ /// Reduce an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Reduce(hshrink, vshrink, kernel: Enums.Kernel, gap: double);
+ ///
+ ///
+ /// Horizontal shrink factor.
+ /// Vertical shrink factor.
+ /// Resampling kernel.
+ /// Reducing gap.
+ /// A new .
+ public Image Reduce(double hshrink, double vshrink, Enums.Kernel? kernel = null, double? gap = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(kernel), kernel);
+ options.AddIfPresent(nameof(gap), gap);
+
+ return this.Call("reduce", options, hshrink, vshrink) as Image;
+ }
+
+ ///
+ /// Shrink an image horizontally.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Reduceh(hshrink, kernel: Enums.Kernel, gap: double);
+ ///
+ ///
+ /// Horizontal shrink factor.
+ /// Resampling kernel.
+ /// Reducing gap.
+ /// A new .
+ public Image Reduceh(double hshrink, Enums.Kernel? kernel = null, double? gap = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(kernel), kernel);
+ options.AddIfPresent(nameof(gap), gap);
+
+ return this.Call("reduceh", options, hshrink) as Image;
+ }
+
+ ///
+ /// Shrink an image vertically.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Reducev(vshrink, kernel: Enums.Kernel, gap: double);
+ ///
+ ///
+ /// Vertical shrink factor.
+ /// Resampling kernel.
+ /// Reducing gap.
+ /// A new .
+ public Image Reducev(double vshrink, Enums.Kernel? kernel = null, double? gap = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(kernel), kernel);
+ options.AddIfPresent(nameof(gap), gap);
+
+ return this.Call("reducev", options, vshrink) as Image;
+ }
+
+ ///
+ /// Relational operation on two images.
+ ///
+ ///
+ ///
+ /// using Image @out = left.Relational(right, relational);
+ ///
+ ///
+ /// Right-hand image argument.
+ /// Relational to perform.
+ /// A new .
+ public Image Relational(Image right, Enums.OperationRelational relational)
+ {
+ return this.Call("relational", right, relational) as Image;
+ }
+
+ ///
+ /// Relational operations against a constant.
+ ///
+ ///
+ ///
+ /// using Image @out = in.RelationalConst(relational, c);
+ ///
+ ///
+ /// Relational to perform.
+ /// Array of constants.
+ /// A new .
+ public Image RelationalConst(Enums.OperationRelational relational, double[] c)
+ {
+ return this.Call("relational_const", relational, c) as Image;
+ }
+
+ ///
+ /// Remainder after integer division of two images.
+ ///
+ ///
+ ///
+ /// using Image @out = left.Remainder(right);
+ ///
+ ///
+ /// Right-hand image argument.
+ /// A new .
+ public Image Remainder(Image right)
+ {
+ return this.Call("remainder", right) as Image;
+ }
+
+ ///
+ /// Remainder after integer division of an image and a constant.
+ ///
+ ///
+ ///
+ /// using Image @out = in.RemainderConst(c);
+ ///
+ ///
+ /// Array of constants.
+ /// A new .
+ public Image RemainderConst(double[] c)
+ {
+ return this.Call("remainder_const", c) as Image;
+ }
+
+ ///
+ /// Rebuild an mosaiced image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Remosaic(oldStr, newStr);
+ ///
+ ///
+ /// Search for this string.
+ /// And swap for this string.
+ /// A new .
+ public Image Remosaic(string oldStr, string newStr)
+ {
+ return this.Call("remosaic", oldStr, newStr) as Image;
+ }
+
+ ///
+ /// Replicate an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Replicate(across, down);
+ ///
+ ///
+ /// Repeat this many times horizontally.
+ /// Repeat this many times vertically.
+ /// A new .
+ public Image Replicate(int across, int down)
+ {
+ return this.Call("replicate", across, down) as Image;
+ }
+
+ ///
+ /// Resize an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Resize(scale, kernel: Enums.Kernel, gap: double, vscale: double);
+ ///
+ ///
+ /// Scale image by this factor.
+ /// Resampling kernel.
+ /// Reducing gap.
+ /// Vertical scale image by this factor.
+ /// A new .
+ public Image Resize(double scale, Enums.Kernel? kernel = null, double? gap = null, double? vscale = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(kernel), kernel);
+ options.AddIfPresent(nameof(gap), gap);
+ options.AddIfPresent(nameof(vscale), vscale);
+
+ return this.Call("resize", options, scale) as Image;
+ }
+
+ ///
+ /// Rotate an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Rot(angle);
+ ///
+ ///
+ /// Angle to rotate image.
+ /// A new .
+ public Image Rot(Enums.Angle angle)
+ {
+ return this.Call("rot", angle) as Image;
+ }
+
+ ///
+ /// Rotate an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Rot45(angle: Enums.Angle45);
+ ///
+ ///
+ /// Angle to rotate image.
+ /// A new .
+ public Image Rot45(Enums.Angle45? angle = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(angle), angle);
+
+ return this.Call("rot45", options) as Image;
+ }
+
+ ///
+ /// Rotate an image by a number of degrees.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Rotate(angle, interpolate: GObject, background: double[], odx: double, ody: double, idx: double, idy: double);
+ ///
+ ///
+ /// Rotate clockwise by this many degrees.
+ /// Interpolate pixels with this.
+ /// Background value.
+ /// Horizontal output displacement.
+ /// Vertical output displacement.
+ /// Horizontal input displacement.
+ /// Vertical input displacement.
+ /// A new .
+ public Image Rotate(double angle, GObject interpolate = null, double[] background = null, double? odx = null, double? ody = null, double? idx = null, double? idy = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(interpolate), interpolate);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent(nameof(odx), odx);
+ options.AddIfPresent(nameof(ody), ody);
+ options.AddIfPresent(nameof(idx), idx);
+ options.AddIfPresent(nameof(idy), idy);
+
+ return this.Call("rotate", options, angle) as Image;
+ }
+
+ ///
+ /// Perform a round function on an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Round(round);
+ ///
+ ///
+ /// Rounding operation to perform.
+ /// A new .
+ public Image Round(Enums.OperationRound round)
+ {
+ return this.Call("round", round) as Image;
+ }
+
+ ///
+ /// Scharr edge detector.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Scharr();
+ ///
+ ///
+ /// A new .
+ public Image Scharr()
+ {
+ return this.Call("scharr") as Image;
+ }
+
+ ///
+ /// Convert scRGB to BW.
+ ///
+ ///
+ ///
+ /// using Image @out = in.ScRGB2BW(depth: int);
+ ///
+ ///
+ /// Output device space depth in bits.
+ /// A new .
+ public Image ScRGB2BW(int? depth = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(depth), depth);
+
+ return this.Call("scRGB2BW", options) as Image;
+ }
+
+ ///
+ /// Convert scRGB to sRGB.
+ ///
+ ///
+ ///
+ /// using Image @out = in.ScRGB2sRGB(depth: int);
+ ///
+ ///
+ /// Output device space depth in bits.
+ /// A new .
+ public Image ScRGB2sRGB(int? depth = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(depth), depth);
+
+ return this.Call("scRGB2sRGB", options) as Image;
+ }
+
+ ///
+ /// Transform scRGB to XYZ.
+ ///
+ ///
+ ///
+ /// using Image @out = in.ScRGB2XYZ();
+ ///
+ ///
+ /// A new .
+ public Image ScRGB2XYZ()
+ {
+ return this.Call("scRGB2XYZ") as Image;
+ }
+
+ ///
+ /// Create an SDF image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Sdf(width, height, shape, r: double, a: double[], b: double[], corners: double[]);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// SDF shape to create.
+ /// Radius.
+ /// Point a.
+ /// Point b.
+ /// Corner radii.
+ /// A new .
+ public static Image Sdf(int width, int height, Enums.SdfShape shape, double? r = null, double[] a = null, double[] b = null, double[] corners = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(r), r);
+ options.AddIfPresent(nameof(a), a);
+ options.AddIfPresent(nameof(b), b);
+ options.AddIfPresent(nameof(corners), corners);
+
+ return Operation.Call("sdf", options, width, height, shape) as Image;
+ }
+
+ ///
+ /// Check sequential access.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Sequential(tileHeight: int);
+ ///
+ ///
+ /// Tile height in pixels.
+ /// A new .
+ public Image Sequential(int? tileHeight = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("tile_height", tileHeight);
+
+ return this.Call("sequential", options) as Image;
+ }
+
+ ///
+ /// Unsharp masking for print.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Sharpen(sigma: double, x1: double, y2: double, y3: double, m1: double, m2: double);
+ ///
+ ///
+ /// Sigma of Gaussian.
+ /// Flat/jaggy threshold.
+ /// Maximum brightening.
+ /// Maximum darkening.
+ /// Slope for flat areas.
+ /// Slope for jaggy areas.
+ /// A new .
+ public Image Sharpen(double? sigma = null, double? x1 = null, double? y2 = null, double? y3 = null, double? m1 = null, double? m2 = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(sigma), sigma);
+ options.AddIfPresent(nameof(x1), x1);
+ options.AddIfPresent(nameof(y2), y2);
+ options.AddIfPresent(nameof(y3), y3);
+ options.AddIfPresent(nameof(m1), m1);
+ options.AddIfPresent(nameof(m2), m2);
+
+ return this.Call("sharpen", options) as Image;
+ }
+
+ ///
+ /// Shrink an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Shrink(hshrink, vshrink, ceil: bool);
+ ///
+ ///
+ /// Horizontal shrink factor.
+ /// Vertical shrink factor.
+ /// Round-up output dimensions.
+ /// A new .
+ public Image Shrink(double hshrink, double vshrink, bool? ceil = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(ceil), ceil);
+
+ return this.Call("shrink", options, hshrink, vshrink) as Image;
+ }
+
+ ///
+ /// Shrink an image horizontally.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Shrinkh(hshrink, ceil: bool);
+ ///
+ ///
+ /// Horizontal shrink factor.
+ /// Round-up output dimensions.
+ /// A new .
+ public Image Shrinkh(int hshrink, bool? ceil = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(ceil), ceil);
+
+ return this.Call("shrinkh", options, hshrink) as Image;
+ }
+
+ ///
+ /// Shrink an image vertically.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Shrinkv(vshrink, ceil: bool);
+ ///
+ ///
+ /// Vertical shrink factor.
+ /// Round-up output dimensions.
+ /// A new .
+ public Image Shrinkv(int vshrink, bool? ceil = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(ceil), ceil);
+
+ return this.Call("shrinkv", options, vshrink) as Image;
+ }
+
+ ///
+ /// Unit vector of pixel.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Sign();
+ ///
+ ///
+ /// A new .
+ public Image Sign()
+ {
+ return this.Call("sign") as Image;
+ }
+
+ ///
+ /// Similarity transform of an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Similarity(scale: double, angle: double, interpolate: GObject, background: double[], odx: double, ody: double, idx: double, idy: double);
+ ///
+ ///
+ /// Scale by this factor.
+ /// Rotate clockwise by this many degrees.
+ /// Interpolate pixels with this.
+ /// Background value.
+ /// Horizontal output displacement.
+ /// Vertical output displacement.
+ /// Horizontal input displacement.
+ /// Vertical input displacement.
+ /// A new .
+ public Image Similarity(double? scale = null, double? angle = null, GObject interpolate = null, double[] background = null, double? odx = null, double? ody = null, double? idx = null, double? idy = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(angle), angle);
+ options.AddIfPresent(nameof(interpolate), interpolate);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent(nameof(odx), odx);
+ options.AddIfPresent(nameof(ody), ody);
+ options.AddIfPresent(nameof(idx), idx);
+ options.AddIfPresent(nameof(idy), idy);
+
+ return this.Call("similarity", options) as Image;
+ }
+
+ ///
+ /// Make a 2D sine wave.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Sines(width, height, uchar: bool, hfreq: double, vfreq: double);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Output an unsigned char image.
+ /// Horizontal spatial frequency.
+ /// Vertical spatial frequency.
+ /// A new .
+ public static Image Sines(int width, int height, bool? uchar = null, double? hfreq = null, double? vfreq = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(uchar), uchar);
+ options.AddIfPresent(nameof(hfreq), hfreq);
+ options.AddIfPresent(nameof(vfreq), vfreq);
+
+ return Operation.Call("sines", options, width, height) as Image;
+ }
+
+ ///
+ /// Extract an area from an image.
+ ///
+ ///
+ ///
+ /// using Image @out = input.Smartcrop(width, height, interesting: Enums.Interesting, premultiplied: bool);
+ ///
+ ///
+ /// Width of extract area.
+ /// Height of extract area.
+ /// How to measure interestingness.
+ /// Input image already has premultiplied alpha.
+ /// A new .
+ public Image Smartcrop(int width, int height, Enums.Interesting? interesting = null, bool? premultiplied = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(interesting), interesting);
+ options.AddIfPresent(nameof(premultiplied), premultiplied);
+
+ return this.Call("smartcrop", options, width, height) as Image;
+ }
+
+ ///
+ /// Extract an area from an image.
+ ///
+ ///
+ ///
+ /// using Image @out = input.Smartcrop(width, height, out var attentionX, interesting: Enums.Interesting, premultiplied: bool);
+ ///
+ ///
+ /// Width of extract area.
+ /// Height of extract area.
+ /// Horizontal position of attention centre.
+ /// How to measure interestingness.
+ /// Input image already has premultiplied alpha.
+ /// A new .
+ public Image Smartcrop(int width, int height, out int attentionX, Enums.Interesting? interesting = null, bool? premultiplied = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(interesting), interesting);
+ options.AddIfPresent(nameof(premultiplied), premultiplied);
+
+ options.Add("attention_x", true);
+
+ var results = this.Call("smartcrop", options, width, height) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ attentionX = opts?["attention_x"] is int out1 ? out1 : 0;
+
+ return finalResult;
+ }
+
+ ///
+ /// Extract an area from an image.
+ ///
+ ///
+ ///
+ /// using Image @out = input.Smartcrop(width, height, out var attentionX, out var attentionY, interesting: Enums.Interesting, premultiplied: bool);
+ ///
+ ///
+ /// Width of extract area.
+ /// Height of extract area.
+ /// Horizontal position of attention centre.
+ /// Vertical position of attention centre.
+ /// How to measure interestingness.
+ /// Input image already has premultiplied alpha.
+ /// A new .
+ public Image Smartcrop(int width, int height, out int attentionX, out int attentionY, Enums.Interesting? interesting = null, bool? premultiplied = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(interesting), interesting);
+ options.AddIfPresent(nameof(premultiplied), premultiplied);
+
+ options.Add("attention_x", true);
+ options.Add("attention_y", true);
+
+ var results = this.Call("smartcrop", options, width, height) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ attentionX = opts?["attention_x"] is int out1 ? out1 : 0;
+ attentionY = opts?["attention_y"] is int out2 ? out2 : 0;
+
+ return finalResult;
+ }
+
+ ///
+ /// Sobel edge detector.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Sobel();
+ ///
+ ///
+ /// A new .
+ public Image Sobel()
+ {
+ return this.Call("sobel") as Image;
+ }
+
+ ///
+ /// Spatial correlation.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Spcor(@ref);
+ ///
+ ///
+ /// Input reference image.
+ /// A new .
+ public Image Spcor(Image @ref)
+ {
+ return this.Call("spcor", @ref) as Image;
+ }
+
+ ///
+ /// Make displayable power spectrum.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Spectrum();
+ ///
+ ///
+ /// A new .
+ public Image Spectrum()
+ {
+ return this.Call("spectrum") as Image;
+ }
+
+ ///
+ /// Transform sRGB to HSV.
+ ///
+ ///
+ ///
+ /// using Image @out = in.SRGB2HSV();
+ ///
+ ///
+ /// A new .
+ public Image SRGB2HSV()
+ {
+ return this.Call("sRGB2HSV") as Image;
+ }
+
+ ///
+ /// Convert an sRGB image to scRGB.
+ ///
+ ///
+ ///
+ /// using Image @out = in.SRGB2scRGB();
+ ///
+ ///
+ /// A new .
+ public Image SRGB2scRGB()
+ {
+ return this.Call("sRGB2scRGB") as Image;
+ }
+
+ ///
+ /// Find many image stats.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Stats();
+ ///
+ ///
+ /// A new .
+ public Image Stats()
+ {
+ return this.Call("stats") as Image;
+ }
+
+ ///
+ /// Statistical difference.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Stdif(width, height, s0: double, b: double, m0: double, a: double);
+ ///
+ ///
+ /// Window width in pixels.
+ /// Window height in pixels.
+ /// New deviation.
+ /// Weight of new deviation.
+ /// New mean.
+ /// Weight of new mean.
+ /// A new .
+ public Image Stdif(int width, int height, double? s0 = null, double? b = null, double? m0 = null, double? a = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(s0), s0);
+ options.AddIfPresent(nameof(b), b);
+ options.AddIfPresent(nameof(m0), m0);
+ options.AddIfPresent(nameof(a), a);
+
+ return this.Call("stdif", options, width, height) as Image;
+ }
+
+ ///
+ /// Subsample an image.
+ ///
+ ///
+ ///
+ /// using Image @out = input.Subsample(xfac, yfac, point: bool);
+ ///
+ ///
+ /// Horizontal subsample factor.
+ /// Vertical subsample factor.
+ /// Point sample.
+ /// A new .
+ public Image Subsample(int xfac, int yfac, bool? point = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(point), point);
+
+ return this.Call("subsample", options, xfac, yfac) as Image;
+ }
+
+ ///
+ /// Subtract two images.
+ ///
+ ///
+ ///
+ /// using Image @out = left.Subtract(right);
+ ///
+ ///
+ /// Right-hand image argument.
+ /// A new .
+ public Image Subtract(Image right)
+ {
+ return this.Call("subtract", right) as Image;
+ }
+
+ ///
+ /// Sum an array of images.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Sum(@in);
+ ///
+ ///
+ /// Array of input images.
+ /// A new .
+ public static Image Sum(params Image[] @in)
+ {
+ return Operation.Call("sum", new object[] { @in }) as Image;
+ }
+
+ ///
+ /// Load SVG with rsvg.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Svgload(filename, dpi: double, scale: double, unlimited: bool, stylesheet: string, highBitdepth: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Render at this DPI.
+ /// Scale output by this factor.
+ /// Allow SVG of any size.
+ /// Custom CSS.
+ /// Enable scRGB 128-bit output (32-bit per channel).
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Svgload(string filename, double? dpi = null, double? scale = null, bool? unlimited = null, string stylesheet = null, bool? highBitdepth = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(dpi), dpi);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(stylesheet), stylesheet);
+ options.AddIfPresent("high_bitdepth", highBitdepth);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("svgload", options, filename) as Image;
+ }
+
+ ///
+ /// Load SVG with rsvg.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Svgload(filename, out var flags, dpi: double, scale: double, unlimited: bool, stylesheet: string, highBitdepth: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Render at this DPI.
+ /// Scale output by this factor.
+ /// Allow SVG of any size.
+ /// Custom CSS.
+ /// Enable scRGB 128-bit output (32-bit per channel).
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Svgload(string filename, out Enums.ForeignFlags flags, double? dpi = null, double? scale = null, bool? unlimited = null, string stylesheet = null, bool? highBitdepth = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(dpi), dpi);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(stylesheet), stylesheet);
+ options.AddIfPresent("high_bitdepth", highBitdepth);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("svgload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load SVG with rsvg.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.SvgloadBuffer(buffer, dpi: double, scale: double, unlimited: bool, stylesheet: string, highBitdepth: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Render at this DPI.
+ /// Scale output by this factor.
+ /// Allow SVG of any size.
+ /// Custom CSS.
+ /// Enable scRGB 128-bit output (32-bit per channel).
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image SvgloadBuffer(byte[] buffer, double? dpi = null, double? scale = null, bool? unlimited = null, string stylesheet = null, bool? highBitdepth = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(dpi), dpi);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(stylesheet), stylesheet);
+ options.AddIfPresent("high_bitdepth", highBitdepth);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("svgload_buffer", options, buffer) as Image;
+ }
+
+ ///
+ /// Load SVG with rsvg.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.SvgloadBuffer(buffer, out var flags, dpi: double, scale: double, unlimited: bool, stylesheet: string, highBitdepth: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Flags for this file.
+ /// Render at this DPI.
+ /// Scale output by this factor.
+ /// Allow SVG of any size.
+ /// Custom CSS.
+ /// Enable scRGB 128-bit output (32-bit per channel).
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image SvgloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, double? dpi = null, double? scale = null, bool? unlimited = null, string stylesheet = null, bool? highBitdepth = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(dpi), dpi);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(stylesheet), stylesheet);
+ options.AddIfPresent("high_bitdepth", highBitdepth);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("svgload_buffer", options, buffer) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load svg from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.SvgloadSource(source, dpi: double, scale: double, unlimited: bool, stylesheet: string, highBitdepth: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Render at this DPI.
+ /// Scale output by this factor.
+ /// Allow SVG of any size.
+ /// Custom CSS.
+ /// Enable scRGB 128-bit output (32-bit per channel).
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image SvgloadSource(Source source, double? dpi = null, double? scale = null, bool? unlimited = null, string stylesheet = null, bool? highBitdepth = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(dpi), dpi);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(stylesheet), stylesheet);
+ options.AddIfPresent("high_bitdepth", highBitdepth);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("svgload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load svg from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.SvgloadStream(stream, dpi: double, scale: double, unlimited: bool, stylesheet: string, highBitdepth: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Render at this DPI.
+ /// Scale output by this factor.
+ /// Allow SVG of any size.
+ /// Custom CSS.
+ /// Enable scRGB 128-bit output (32-bit per channel).
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image SvgloadStream(Stream stream, double? dpi = null, double? scale = null, bool? unlimited = null, string stylesheet = null, bool? highBitdepth = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = SvgloadSource(source, dpi, scale, unlimited, stylesheet, highBitdepth, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load svg from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.SvgloadSource(source, out var flags, dpi: double, scale: double, unlimited: bool, stylesheet: string, highBitdepth: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// Render at this DPI.
+ /// Scale output by this factor.
+ /// Allow SVG of any size.
+ /// Custom CSS.
+ /// Enable scRGB 128-bit output (32-bit per channel).
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image SvgloadSource(Source source, out Enums.ForeignFlags flags, double? dpi = null, double? scale = null, bool? unlimited = null, string stylesheet = null, bool? highBitdepth = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(dpi), dpi);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(stylesheet), stylesheet);
+ options.AddIfPresent("high_bitdepth", highBitdepth);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("svgload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load svg from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.SvgloadStream(stream, out var flags, dpi: double, scale: double, unlimited: bool, stylesheet: string, highBitdepth: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// Render at this DPI.
+ /// Scale output by this factor.
+ /// Allow SVG of any size.
+ /// Custom CSS.
+ /// Enable scRGB 128-bit output (32-bit per channel).
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image SvgloadStream(Stream stream, out Enums.ForeignFlags flags, double? dpi = null, double? scale = null, bool? unlimited = null, string stylesheet = null, bool? highBitdepth = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = SvgloadSource(source, out flags, dpi, scale, unlimited, stylesheet, highBitdepth, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Find the index of the first non-zero pixel in tests.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Switch(tests);
+ ///
+ ///
+ /// Table of images to test.
+ /// A new .
+ public static Image Switch(params Image[] tests)
+ {
+ return Operation.Call("switch", new object[] { tests }) as Image;
+ }
+
+ ///
+ /// Run an external command.
+ ///
+ ///
+ ///
+ /// NetVips.Image.System(cmdFormat, @in: Image[], outFormat: string, inFormat: string);
+ ///
+ ///
+ /// Command to run.
+ /// Array of input images.
+ /// Format for output filename.
+ /// Format for input filename.
+ public static void System(string cmdFormat, Image[] @in = null, string outFormat = null, string inFormat = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("in", @in);
+ options.AddIfPresent("out_format", outFormat);
+ options.AddIfPresent("in_format", inFormat);
+
+ Operation.Call("system", options, cmdFormat);
+ }
+
+ ///
+ /// Run an external command.
+ ///
+ ///
+ ///
+ /// NetVips.Image.System(cmdFormat, out var @out, @in: Image[], outFormat: string, inFormat: string);
+ ///
+ ///
+ /// Command to run.
+ /// Output image.
+ /// Array of input images.
+ /// Format for output filename.
+ /// Format for input filename.
+ public static void System(string cmdFormat, out Image @out, Image[] @in = null, string outFormat = null, string inFormat = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("in", @in);
+ options.AddIfPresent("out_format", outFormat);
+ options.AddIfPresent("in_format", inFormat);
+
+ options.Add("out", true);
+
+ var results = Operation.Call("system", options, cmdFormat) as object[];
+
+ var opts = results?[1] as VOption;
+ @out = opts?["out"] as Image;
+ }
+
+ ///
+ /// Run an external command.
+ ///
+ ///
+ ///
+ /// NetVips.Image.System(cmdFormat, out var @out, out var log, @in: Image[], outFormat: string, inFormat: string);
+ ///
+ ///
+ /// Command to run.
+ /// Output image.
+ /// Command log.
+ /// Array of input images.
+ /// Format for output filename.
+ /// Format for input filename.
+ public static void System(string cmdFormat, out Image @out, out string log, Image[] @in = null, string outFormat = null, string inFormat = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("in", @in);
+ options.AddIfPresent("out_format", outFormat);
+ options.AddIfPresent("in_format", inFormat);
+
+ options.Add("out", true);
+ options.Add("log", true);
+
+ var results = Operation.Call("system", options, cmdFormat) as object[];
+
+ var opts = results?[1] as VOption;
+ @out = opts?["out"] as Image;
+ log = opts?["log"] is string out2 ? out2 : null;
+ }
+
+ ///
+ /// Make a text image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Text(text, font: string, width: int, height: int, align: Enums.Align, justify: bool, dpi: int, spacing: int, fontfile: string, rgba: bool, wrap: Enums.TextWrap);
+ ///
+ ///
+ /// Text to render.
+ /// Font to render with.
+ /// Maximum image width in pixels.
+ /// Maximum image height in pixels.
+ /// Align on the low, centre or high edge.
+ /// Justify lines.
+ /// DPI to render at.
+ /// Line spacing.
+ /// Load this font file.
+ /// Enable RGBA output.
+ /// Wrap lines on word or character boundaries.
+ /// A new .
+ public static Image Text(string text, string font = null, int? width = null, int? height = null, Enums.Align? align = null, bool? justify = null, int? dpi = null, int? spacing = null, string fontfile = null, bool? rgba = null, Enums.TextWrap? wrap = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(font), font);
+ options.AddIfPresent(nameof(width), width);
+ options.AddIfPresent(nameof(height), height);
+ options.AddIfPresent(nameof(align), align);
+ options.AddIfPresent(nameof(justify), justify);
+ options.AddIfPresent(nameof(dpi), dpi);
+ options.AddIfPresent(nameof(spacing), spacing);
+ options.AddIfPresent(nameof(fontfile), fontfile);
+ options.AddIfPresent(nameof(rgba), rgba);
+ options.AddIfPresent(nameof(wrap), wrap);
+
+ return Operation.Call("text", options, text) as Image;
+ }
+
+ ///
+ /// Make a text image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Text(text, out var autofitDpi, font: string, width: int, height: int, align: Enums.Align, justify: bool, dpi: int, spacing: int, fontfile: string, rgba: bool, wrap: Enums.TextWrap);
+ ///
+ ///
+ /// Text to render.
+ /// DPI selected by autofit.
+ /// Font to render with.
+ /// Maximum image width in pixels.
+ /// Maximum image height in pixels.
+ /// Align on the low, centre or high edge.
+ /// Justify lines.
+ /// DPI to render at.
+ /// Line spacing.
+ /// Load this font file.
+ /// Enable RGBA output.
+ /// Wrap lines on word or character boundaries.
+ /// A new .
+ public static Image Text(string text, out int autofitDpi, string font = null, int? width = null, int? height = null, Enums.Align? align = null, bool? justify = null, int? dpi = null, int? spacing = null, string fontfile = null, bool? rgba = null, Enums.TextWrap? wrap = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(font), font);
+ options.AddIfPresent(nameof(width), width);
+ options.AddIfPresent(nameof(height), height);
+ options.AddIfPresent(nameof(align), align);
+ options.AddIfPresent(nameof(justify), justify);
+ options.AddIfPresent(nameof(dpi), dpi);
+ options.AddIfPresent(nameof(spacing), spacing);
+ options.AddIfPresent(nameof(fontfile), fontfile);
+ options.AddIfPresent(nameof(rgba), rgba);
+ options.AddIfPresent(nameof(wrap), wrap);
+
+ options.Add("autofit_dpi", true);
+
+ var results = Operation.Call("text", options, text) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ autofitDpi = opts?["autofit_dpi"] is int out1 ? out1 : 0;
+
+ return finalResult;
+ }
+
+ ///
+ /// Generate thumbnail from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Thumbnail(filename, width, height: int, size: Enums.Size, noRotate: bool, crop: Enums.Interesting, linear: bool, inputProfile: string, outputProfile: string, intent: Enums.Intent, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Filename to read from.
+ /// Size to this width.
+ /// Size to this height.
+ /// Only upsize, only downsize, or both.
+ /// Don't use orientation tags to rotate image upright.
+ /// Reduce to fill target rectangle, then crop.
+ /// Reduce in linear light.
+ /// Fallback input profile.
+ /// Fallback output profile.
+ /// Rendering intent.
+ /// Error level to fail on.
+ /// A new .
+ public static Image Thumbnail(string filename, int width, int? height = null, Enums.Size? size = null, bool? noRotate = null, Enums.Interesting? crop = null, bool? linear = null, string inputProfile = null, string outputProfile = null, Enums.Intent? intent = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(height), height);
+ options.AddIfPresent(nameof(size), size);
+ options.AddIfPresent("no_rotate", noRotate);
+ options.AddIfPresent(nameof(crop), crop);
+ options.AddIfPresent(nameof(linear), linear);
+ options.AddIfPresent("input_profile", inputProfile);
+ options.AddIfPresent("output_profile", outputProfile);
+ options.AddIfPresent(nameof(intent), intent);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("thumbnail", options, filename, width) as Image;
+ }
+
+ ///
+ /// Generate thumbnail from buffer.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.ThumbnailBuffer(buffer, width, optionString: string, height: int, size: Enums.Size, noRotate: bool, crop: Enums.Interesting, linear: bool, inputProfile: string, outputProfile: string, intent: Enums.Intent, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Size to this width.
+ /// Options that are passed on to the underlying loader.
+ /// Size to this height.
+ /// Only upsize, only downsize, or both.
+ /// Don't use orientation tags to rotate image upright.
+ /// Reduce to fill target rectangle, then crop.
+ /// Reduce in linear light.
+ /// Fallback input profile.
+ /// Fallback output profile.
+ /// Rendering intent.
+ /// Error level to fail on.
+ /// A new .
+ public static Image ThumbnailBuffer(byte[] buffer, int width, string optionString = null, int? height = null, Enums.Size? size = null, bool? noRotate = null, Enums.Interesting? crop = null, bool? linear = null, string inputProfile = null, string outputProfile = null, Enums.Intent? intent = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("option_string", optionString);
+ options.AddIfPresent(nameof(height), height);
+ options.AddIfPresent(nameof(size), size);
+ options.AddIfPresent("no_rotate", noRotate);
+ options.AddIfPresent(nameof(crop), crop);
+ options.AddIfPresent(nameof(linear), linear);
+ options.AddIfPresent("input_profile", inputProfile);
+ options.AddIfPresent("output_profile", outputProfile);
+ options.AddIfPresent(nameof(intent), intent);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("thumbnail_buffer", options, buffer, width) as Image;
+ }
+
+ ///
+ /// Generate thumbnail from image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.ThumbnailImage(width, height: int, size: Enums.Size, noRotate: bool, crop: Enums.Interesting, linear: bool, inputProfile: string, outputProfile: string, intent: Enums.Intent, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Size to this width.
+ /// Size to this height.
+ /// Only upsize, only downsize, or both.
+ /// Don't use orientation tags to rotate image upright.
+ /// Reduce to fill target rectangle, then crop.
+ /// Reduce in linear light.
+ /// Fallback input profile.
+ /// Fallback output profile.
+ /// Rendering intent.
+ /// Error level to fail on.
+ /// A new .
+ public Image ThumbnailImage(int width, int? height = null, Enums.Size? size = null, bool? noRotate = null, Enums.Interesting? crop = null, bool? linear = null, string inputProfile = null, string outputProfile = null, Enums.Intent? intent = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(height), height);
+ options.AddIfPresent(nameof(size), size);
+ options.AddIfPresent("no_rotate", noRotate);
+ options.AddIfPresent(nameof(crop), crop);
+ options.AddIfPresent(nameof(linear), linear);
+ options.AddIfPresent("input_profile", inputProfile);
+ options.AddIfPresent("output_profile", outputProfile);
+ options.AddIfPresent(nameof(intent), intent);
+ options.AddFailOn(failOn);
+
+ return this.Call("thumbnail_image", options, width) as Image;
+ }
+
+ ///
+ /// Generate thumbnail from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.ThumbnailSource(source, width, optionString: string, height: int, size: Enums.Size, noRotate: bool, crop: Enums.Interesting, linear: bool, inputProfile: string, outputProfile: string, intent: Enums.Intent, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Size to this width.
+ /// Options that are passed on to the underlying loader.
+ /// Size to this height.
+ /// Only upsize, only downsize, or both.
+ /// Don't use orientation tags to rotate image upright.
+ /// Reduce to fill target rectangle, then crop.
+ /// Reduce in linear light.
+ /// Fallback input profile.
+ /// Fallback output profile.
+ /// Rendering intent.
+ /// Error level to fail on.
+ /// A new .
+ public static Image ThumbnailSource(Source source, int width, string optionString = null, int? height = null, Enums.Size? size = null, bool? noRotate = null, Enums.Interesting? crop = null, bool? linear = null, string inputProfile = null, string outputProfile = null, Enums.Intent? intent = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("option_string", optionString);
+ options.AddIfPresent(nameof(height), height);
+ options.AddIfPresent(nameof(size), size);
+ options.AddIfPresent("no_rotate", noRotate);
+ options.AddIfPresent(nameof(crop), crop);
+ options.AddIfPresent(nameof(linear), linear);
+ options.AddIfPresent("input_profile", inputProfile);
+ options.AddIfPresent("output_profile", outputProfile);
+ options.AddIfPresent(nameof(intent), intent);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("thumbnail_source", options, source, width) as Image;
+ }
+
+ ///
+ /// Generate thumbnail from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.ThumbnailStream(stream, width, optionString: string, height: int, size: Enums.Size, noRotate: bool, crop: Enums.Interesting, linear: bool, inputProfile: string, outputProfile: string, intent: Enums.Intent, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Size to this width.
+ /// Options that are passed on to the underlying loader.
+ /// Size to this height.
+ /// Only upsize, only downsize, or both.
+ /// Don't use orientation tags to rotate image upright.
+ /// Reduce to fill target rectangle, then crop.
+ /// Reduce in linear light.
+ /// Fallback input profile.
+ /// Fallback output profile.
+ /// Rendering intent.
+ /// Error level to fail on.
+ /// A new .
+ public static Image ThumbnailStream(Stream stream, int width, string optionString = null, int? height = null, Enums.Size? size = null, bool? noRotate = null, Enums.Interesting? crop = null, bool? linear = null, string inputProfile = null, string outputProfile = null, Enums.Intent? intent = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = ThumbnailSource(source, width, optionString, height, size, noRotate, crop, linear, inputProfile, outputProfile, intent, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load tiff from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Tiffload(filename, page: int, n: int, autorotate: bool, subifd: int, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Rotate image using orientation tag.
+ /// Subifd index.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Tiffload(string filename, int? page = null, int? n = null, bool? autorotate = null, int? subifd = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(autorotate), autorotate);
+ options.AddIfPresent(nameof(subifd), subifd);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("tiffload", options, filename) as Image;
+ }
+
+ ///
+ /// Load tiff from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Tiffload(filename, out var flags, page: int, n: int, autorotate: bool, subifd: int, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Rotate image using orientation tag.
+ /// Subifd index.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Tiffload(string filename, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? autorotate = null, int? subifd = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(autorotate), autorotate);
+ options.AddIfPresent(nameof(subifd), subifd);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("tiffload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load tiff from buffer.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.TiffloadBuffer(buffer, page: int, n: int, autorotate: bool, subifd: int, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Rotate image using orientation tag.
+ /// Subifd index.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image TiffloadBuffer(byte[] buffer, int? page = null, int? n = null, bool? autorotate = null, int? subifd = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(autorotate), autorotate);
+ options.AddIfPresent(nameof(subifd), subifd);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("tiffload_buffer", options, buffer) as Image;
+ }
+
+ ///
+ /// Load tiff from buffer.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.TiffloadBuffer(buffer, out var flags, page: int, n: int, autorotate: bool, subifd: int, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Rotate image using orientation tag.
+ /// Subifd index.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image TiffloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? autorotate = null, int? subifd = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(autorotate), autorotate);
+ options.AddIfPresent(nameof(subifd), subifd);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("tiffload_buffer", options, buffer) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load tiff from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.TiffloadSource(source, page: int, n: int, autorotate: bool, subifd: int, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Rotate image using orientation tag.
+ /// Subifd index.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image TiffloadSource(Source source, int? page = null, int? n = null, bool? autorotate = null, int? subifd = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(autorotate), autorotate);
+ options.AddIfPresent(nameof(subifd), subifd);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("tiffload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load tiff from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.TiffloadStream(stream, page: int, n: int, autorotate: bool, subifd: int, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Rotate image using orientation tag.
+ /// Subifd index.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image TiffloadStream(Stream stream, int? page = null, int? n = null, bool? autorotate = null, int? subifd = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = TiffloadSource(source, page, n, autorotate, subifd, unlimited, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load tiff from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.TiffloadSource(source, out var flags, page: int, n: int, autorotate: bool, subifd: int, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Rotate image using orientation tag.
+ /// Subifd index.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image TiffloadSource(Source source, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? autorotate = null, int? subifd = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(autorotate), autorotate);
+ options.AddIfPresent(nameof(subifd), subifd);
+ options.AddIfPresent(nameof(unlimited), unlimited);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("tiffload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load tiff from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.TiffloadStream(stream, out var flags, page: int, n: int, autorotate: bool, subifd: int, unlimited: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Rotate image using orientation tag.
+ /// Subifd index.
+ /// Remove all denial of service limits.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image TiffloadStream(Stream stream, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? autorotate = null, int? subifd = null, bool? unlimited = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = TiffloadSource(source, out flags, page, n, autorotate, subifd, unlimited, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Save image to tiff file.
+ ///
+ ///
+ ///
+ /// in.Tiffsave(filename, compression: Enums.ForeignTiffCompression, q: int, predictor: Enums.ForeignTiffPredictor, tile: bool, tileWidth: int, tileHeight: int, pyramid: bool, miniswhite: bool, bitdepth: int, resunit: Enums.ForeignTiffResunit, xres: double, yres: double, bigtiff: bool, properties: bool, regionShrink: Enums.RegionShrink, level: int, lossless: bool, depth: Enums.ForeignDzDepth, subifd: bool, premultiply: bool, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Compression for this file.
+ /// Q factor.
+ /// Compression prediction.
+ /// Write a tiled tiff.
+ /// Tile width in pixels.
+ /// Tile height in pixels.
+ /// Write a pyramidal tiff.
+ /// Use 0 for white in 1-bit images.
+ /// Write as a 1, 2, 4 or 8 bit image.
+ /// Resolution unit.
+ /// Horizontal resolution in pixels/mm.
+ /// Vertical resolution in pixels/mm.
+ /// Write a bigtiff image.
+ /// Write a properties document to IMAGEDESCRIPTION.
+ /// Method to shrink regions.
+ /// Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level.
+ /// Enable WEBP lossless mode.
+ /// Pyramid depth.
+ /// Save pyr layers as sub-IFDs.
+ /// Save with premultiplied alpha.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Tiffsave(string filename, Enums.ForeignTiffCompression? compression = null, int? q = null, Enums.ForeignTiffPredictor? predictor = null, bool? tile = null, int? tileWidth = null, int? tileHeight = null, bool? pyramid = null, bool? miniswhite = null, int? bitdepth = null, Enums.ForeignTiffResunit? resunit = null, double? xres = null, double? yres = null, bool? bigtiff = null, bool? properties = null, Enums.RegionShrink? regionShrink = null, int? level = null, bool? lossless = null, Enums.ForeignDzDepth? depth = null, bool? subifd = null, bool? premultiply = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(compression), compression);
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent(nameof(predictor), predictor);
+ options.AddIfPresent(nameof(tile), tile);
+ options.AddIfPresent("tile_width", tileWidth);
+ options.AddIfPresent("tile_height", tileHeight);
+ options.AddIfPresent(nameof(pyramid), pyramid);
+ options.AddIfPresent(nameof(miniswhite), miniswhite);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddIfPresent(nameof(resunit), resunit);
+ options.AddIfPresent(nameof(xres), xres);
+ options.AddIfPresent(nameof(yres), yres);
+ options.AddIfPresent(nameof(bigtiff), bigtiff);
+ options.AddIfPresent(nameof(properties), properties);
+ options.AddIfPresent("region_shrink", regionShrink);
+ options.AddIfPresent(nameof(level), level);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent(nameof(depth), depth);
+ options.AddIfPresent(nameof(subifd), subifd);
+ options.AddIfPresent(nameof(premultiply), premultiply);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("tiffsave", options, filename);
+ }
+
+ ///
+ /// Save image to tiff buffer.
+ ///
+ ///
+ ///
+ /// byte[] buffer = in.TiffsaveBuffer(compression: Enums.ForeignTiffCompression, q: int, predictor: Enums.ForeignTiffPredictor, tile: bool, tileWidth: int, tileHeight: int, pyramid: bool, miniswhite: bool, bitdepth: int, resunit: Enums.ForeignTiffResunit, xres: double, yres: double, bigtiff: bool, properties: bool, regionShrink: Enums.RegionShrink, level: int, lossless: bool, depth: Enums.ForeignDzDepth, subifd: bool, premultiply: bool, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Compression for this file.
+ /// Q factor.
+ /// Compression prediction.
+ /// Write a tiled tiff.
+ /// Tile width in pixels.
+ /// Tile height in pixels.
+ /// Write a pyramidal tiff.
+ /// Use 0 for white in 1-bit images.
+ /// Write as a 1, 2, 4 or 8 bit image.
+ /// Resolution unit.
+ /// Horizontal resolution in pixels/mm.
+ /// Vertical resolution in pixels/mm.
+ /// Write a bigtiff image.
+ /// Write a properties document to IMAGEDESCRIPTION.
+ /// Method to shrink regions.
+ /// Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level.
+ /// Enable WEBP lossless mode.
+ /// Pyramid depth.
+ /// Save pyr layers as sub-IFDs.
+ /// Save with premultiplied alpha.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ /// An array of bytes.
+ public byte[] TiffsaveBuffer(Enums.ForeignTiffCompression? compression = null, int? q = null, Enums.ForeignTiffPredictor? predictor = null, bool? tile = null, int? tileWidth = null, int? tileHeight = null, bool? pyramid = null, bool? miniswhite = null, int? bitdepth = null, Enums.ForeignTiffResunit? resunit = null, double? xres = null, double? yres = null, bool? bigtiff = null, bool? properties = null, Enums.RegionShrink? regionShrink = null, int? level = null, bool? lossless = null, Enums.ForeignDzDepth? depth = null, bool? subifd = null, bool? premultiply = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(compression), compression);
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent(nameof(predictor), predictor);
+ options.AddIfPresent(nameof(tile), tile);
+ options.AddIfPresent("tile_width", tileWidth);
+ options.AddIfPresent("tile_height", tileHeight);
+ options.AddIfPresent(nameof(pyramid), pyramid);
+ options.AddIfPresent(nameof(miniswhite), miniswhite);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddIfPresent(nameof(resunit), resunit);
+ options.AddIfPresent(nameof(xres), xres);
+ options.AddIfPresent(nameof(yres), yres);
+ options.AddIfPresent(nameof(bigtiff), bigtiff);
+ options.AddIfPresent(nameof(properties), properties);
+ options.AddIfPresent("region_shrink", regionShrink);
+ options.AddIfPresent(nameof(level), level);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent(nameof(depth), depth);
+ options.AddIfPresent(nameof(subifd), subifd);
+ options.AddIfPresent(nameof(premultiply), premultiply);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ return this.Call("tiffsave_buffer", options) as byte[];
+ }
+
+ ///
+ /// Save image to tiff target.
+ ///
+ ///
+ ///
+ /// in.TiffsaveTarget(target, compression: Enums.ForeignTiffCompression, q: int, predictor: Enums.ForeignTiffPredictor, tile: bool, tileWidth: int, tileHeight: int, pyramid: bool, miniswhite: bool, bitdepth: int, resunit: Enums.ForeignTiffResunit, xres: double, yres: double, bigtiff: bool, properties: bool, regionShrink: Enums.RegionShrink, level: int, lossless: bool, depth: Enums.ForeignDzDepth, subifd: bool, premultiply: bool, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Target to save to.
+ /// Compression for this file.
+ /// Q factor.
+ /// Compression prediction.
+ /// Write a tiled tiff.
+ /// Tile width in pixels.
+ /// Tile height in pixels.
+ /// Write a pyramidal tiff.
+ /// Use 0 for white in 1-bit images.
+ /// Write as a 1, 2, 4 or 8 bit image.
+ /// Resolution unit.
+ /// Horizontal resolution in pixels/mm.
+ /// Vertical resolution in pixels/mm.
+ /// Write a bigtiff image.
+ /// Write a properties document to IMAGEDESCRIPTION.
+ /// Method to shrink regions.
+ /// Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level.
+ /// Enable WEBP lossless mode.
+ /// Pyramid depth.
+ /// Save pyr layers as sub-IFDs.
+ /// Save with premultiplied alpha.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void TiffsaveTarget(Target target, Enums.ForeignTiffCompression? compression = null, int? q = null, Enums.ForeignTiffPredictor? predictor = null, bool? tile = null, int? tileWidth = null, int? tileHeight = null, bool? pyramid = null, bool? miniswhite = null, int? bitdepth = null, Enums.ForeignTiffResunit? resunit = null, double? xres = null, double? yres = null, bool? bigtiff = null, bool? properties = null, Enums.RegionShrink? regionShrink = null, int? level = null, bool? lossless = null, Enums.ForeignDzDepth? depth = null, bool? subifd = null, bool? premultiply = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(compression), compression);
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent(nameof(predictor), predictor);
+ options.AddIfPresent(nameof(tile), tile);
+ options.AddIfPresent("tile_width", tileWidth);
+ options.AddIfPresent("tile_height", tileHeight);
+ options.AddIfPresent(nameof(pyramid), pyramid);
+ options.AddIfPresent(nameof(miniswhite), miniswhite);
+ options.AddIfPresent(nameof(bitdepth), bitdepth);
+ options.AddIfPresent(nameof(resunit), resunit);
+ options.AddIfPresent(nameof(xres), xres);
+ options.AddIfPresent(nameof(yres), yres);
+ options.AddIfPresent(nameof(bigtiff), bigtiff);
+ options.AddIfPresent(nameof(properties), properties);
+ options.AddIfPresent("region_shrink", regionShrink);
+ options.AddIfPresent(nameof(level), level);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent(nameof(depth), depth);
+ options.AddIfPresent(nameof(subifd), subifd);
+ options.AddIfPresent(nameof(premultiply), premultiply);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("tiffsave_target", options, target);
+ }
+
+ ///
+ /// Save image to tiff stream.
+ ///
+ ///
+ ///
+ /// in.TiffsaveStream(stream, compression: Enums.ForeignTiffCompression, q: int, predictor: Enums.ForeignTiffPredictor, tile: bool, tileWidth: int, tileHeight: int, pyramid: bool, miniswhite: bool, bitdepth: int, resunit: Enums.ForeignTiffResunit, xres: double, yres: double, bigtiff: bool, properties: bool, regionShrink: Enums.RegionShrink, level: int, lossless: bool, depth: Enums.ForeignDzDepth, subifd: bool, premultiply: bool, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Stream to save to.
+ /// Compression for this file.
+ /// Q factor.
+ /// Compression prediction.
+ /// Write a tiled tiff.
+ /// Tile width in pixels.
+ /// Tile height in pixels.
+ /// Write a pyramidal tiff.
+ /// Use 0 for white in 1-bit images.
+ /// Write as a 1, 2, 4 or 8 bit image.
+ /// Resolution unit.
+ /// Horizontal resolution in pixels/mm.
+ /// Vertical resolution in pixels/mm.
+ /// Write a bigtiff image.
+ /// Write a properties document to IMAGEDESCRIPTION.
+ /// Method to shrink regions.
+ /// Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level.
+ /// Enable WEBP lossless mode.
+ /// Pyramid depth.
+ /// Save pyr layers as sub-IFDs.
+ /// Save with premultiplied alpha.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void TiffsaveStream(Stream stream, Enums.ForeignTiffCompression? compression = null, int? q = null, Enums.ForeignTiffPredictor? predictor = null, bool? tile = null, int? tileWidth = null, int? tileHeight = null, bool? pyramid = null, bool? miniswhite = null, int? bitdepth = null, Enums.ForeignTiffResunit? resunit = null, double? xres = null, double? yres = null, bool? bigtiff = null, bool? properties = null, Enums.RegionShrink? regionShrink = null, int? level = null, bool? lossless = null, Enums.ForeignDzDepth? depth = null, bool? subifd = null, bool? premultiply = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ TiffsaveTarget(target, compression, q, predictor, tile, tileWidth, tileHeight, pyramid, miniswhite, bitdepth, resunit, xres, yres, bigtiff, properties, regionShrink, level, lossless, depth, subifd, premultiply, keep, background, pageHeight, profile);
+ }
+
+ ///
+ /// Cache an image as a set of tiles.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Tilecache(tileWidth: int, tileHeight: int, maxTiles: int, access: Enums.Access, threaded: bool, persistent: bool);
+ ///
+ ///
+ /// Tile width in pixels.
+ /// Tile height in pixels.
+ /// Maximum number of tiles to cache.
+ /// Expected access pattern.
+ /// Allow threaded access.
+ /// Keep cache between evaluations.
+ /// A new .
+ public Image Tilecache(int? tileWidth = null, int? tileHeight = null, int? maxTiles = null, Enums.Access? access = null, bool? threaded = null, bool? persistent = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("tile_width", tileWidth);
+ options.AddIfPresent("tile_height", tileHeight);
+ options.AddIfPresent("max_tiles", maxTiles);
+ options.AddIfPresent(nameof(access), access);
+ options.AddIfPresent(nameof(threaded), threaded);
+ options.AddIfPresent(nameof(persistent), persistent);
+
+ return this.Call("tilecache", options) as Image;
+ }
+
+ ///
+ /// Build a look-up table.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Tonelut(inMax: int, outMax: int, lb: double, lw: double, ps: double, pm: double, ph: double, s: double, m: double, h: double);
+ ///
+ ///
+ /// Size of LUT to build.
+ /// Maximum value in output LUT.
+ /// Lowest value in output.
+ /// Highest value in output.
+ /// Position of shadow.
+ /// Position of mid-tones.
+ /// Position of highlights.
+ /// Adjust shadows by this much.
+ /// Adjust mid-tones by this much.
+ /// Adjust highlights by this much.
+ /// A new .
+ public static Image Tonelut(int? inMax = null, int? outMax = null, double? lb = null, double? lw = null, double? ps = null, double? pm = null, double? ph = null, double? s = null, double? m = null, double? h = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("in_max", inMax);
+ options.AddIfPresent("out_max", outMax);
+ options.AddIfPresent("Lb", lb);
+ options.AddIfPresent("Lw", lw);
+ options.AddIfPresent("Ps", ps);
+ options.AddIfPresent("Pm", pm);
+ options.AddIfPresent("Ph", ph);
+ options.AddIfPresent("S", s);
+ options.AddIfPresent("M", m);
+ options.AddIfPresent("H", h);
+
+ return Operation.Call("tonelut", options) as Image;
+ }
+
+ ///
+ /// Transpose3d an image.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Transpose3d(pageHeight: int);
+ ///
+ ///
+ /// Height of each input page.
+ /// A new .
+ public Image Transpose3d(int? pageHeight = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("page_height", pageHeight);
+
+ return this.Call("transpose3d", options) as Image;
+ }
+
+ ///
+ /// Unpremultiply image alpha.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Unpremultiply(maxAlpha: double, alphaBand: int);
+ ///
+ ///
+ /// Maximum value of alpha channel.
+ /// Unpremultiply with this alpha.
+ /// A new .
+ public Image Unpremultiply(double? maxAlpha = null, int? alphaBand = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("max_alpha", maxAlpha);
+ options.AddIfPresent("alpha_band", alphaBand);
+
+ return this.Call("unpremultiply", options) as Image;
+ }
+
+ ///
+ /// Load vips from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Vipsload(filename, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Vipsload(string filename, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("vipsload", options, filename) as Image;
+ }
+
+ ///
+ /// Load vips from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Vipsload(filename, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Vipsload(string filename, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("vipsload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load vips from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.VipsloadSource(source, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image VipsloadSource(Source source, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("vipsload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load vips from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.VipsloadStream(stream, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image VipsloadStream(Stream stream, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = VipsloadSource(source, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load vips from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.VipsloadSource(source, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image VipsloadSource(Source source, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("vipsload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load vips from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.VipsloadStream(stream, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image VipsloadStream(Stream stream, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = VipsloadSource(source, out flags, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Save image to file in vips format.
+ ///
+ ///
+ ///
+ /// in.Vipssave(filename, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Vipssave(string filename, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("vipssave", options, filename);
+ }
+
+ ///
+ /// Save image to target in vips format.
+ ///
+ ///
+ ///
+ /// in.VipssaveTarget(target, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Target to save to.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void VipssaveTarget(Target target, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("vipssave_target", options, target);
+ }
+
+ ///
+ /// Save image to stream in vips format.
+ ///
+ ///
+ ///
+ /// in.VipssaveStream(stream, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Stream to save to.
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void VipssaveStream(Stream stream, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ VipssaveTarget(target, keep, background, pageHeight, profile);
+ }
+
+ ///
+ /// Load webp from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Webpload(filename, page: int, n: int, scale: double, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Factor to scale by.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Webpload(string filename, int? page = null, int? n = null, double? scale = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ return Operation.Call("webpload", options, filename) as Image;
+ }
+
+ ///
+ /// Load webp from file.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Webpload(filename, out var flags, page: int, n: int, scale: double, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool);
+ ///
+ ///
+ /// Filename to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Factor to scale by.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// Don't use a cached result for this operation.
+ /// A new .
+ public static Image Webpload(string filename, out Enums.ForeignFlags flags, int? page = null, int? n = null, double? scale = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("webpload", options, filename) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load webp from buffer.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.WebploadBuffer(buffer, page: int, n: int, scale: double, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Factor to scale by.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image WebploadBuffer(byte[] buffer, int? page = null, int? n = null, double? scale = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("webpload_buffer", options, buffer) as Image;
+ }
+
+ ///
+ /// Load webp from buffer.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.WebploadBuffer(buffer, out var flags, page: int, n: int, scale: double, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Buffer to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Factor to scale by.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image WebploadBuffer(byte[] buffer, out Enums.ForeignFlags flags, int? page = null, int? n = null, double? scale = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("webpload_buffer", options, buffer) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load webp from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.WebploadSource(source, page: int, n: int, scale: double, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Factor to scale by.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image WebploadSource(Source source, int? page = null, int? n = null, double? scale = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ return Operation.Call("webpload_source", options, source) as Image;
+ }
+
+ ///
+ /// Load webp from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.WebploadStream(stream, page: int, n: int, scale: double, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Factor to scale by.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image WebploadStream(Stream stream, int? page = null, int? n = null, double? scale = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = WebploadSource(source, page, n, scale, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Load webp from source.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.WebploadSource(source, out var flags, page: int, n: int, scale: double, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Source to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Factor to scale by.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image WebploadSource(Source source, out Enums.ForeignFlags flags, int? page = null, int? n = null, double? scale = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(page), page);
+ options.AddIfPresent(nameof(n), n);
+ options.AddIfPresent(nameof(scale), scale);
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("flags", true);
+
+ var results = Operation.Call("webpload_source", options, source) as object[];
+ var finalResult = results?[0] as Image;
+ var opts = results?[1] as VOption;
+ flags = (Enums.ForeignFlags)opts?["flags"];
+
+ return finalResult;
+ }
+
+ ///
+ /// Load webp from stream.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.WebploadStream(stream, out var flags, page: int, n: int, scale: double, memory: bool, access: Enums.Access, failOn: Enums.FailOn);
+ ///
+ ///
+ /// Stream to load from.
+ /// Flags for this file.
+ /// First page to load.
+ /// Number of pages to load, -1 for all.
+ /// Factor to scale by.
+ /// Force open via memory.
+ /// Required access pattern for this file.
+ /// Error level to fail on.
+ /// A new .
+ public static Image WebploadStream(Stream stream, out Enums.ForeignFlags flags, int? page = null, int? n = null, double? scale = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = WebploadSource(source, out flags, page, n, scale, memory, access, failOn);
+
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Save as WebP.
+ ///
+ ///
+ ///
+ /// in.Webpsave(filename, q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, targetSize: int, mixed: bool, smartDeblock: bool, passes: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Filename to save to.
+ /// Q factor.
+ /// Enable lossless compression.
+ /// Preset for lossy compression.
+ /// Enable high quality chroma subsampling.
+ /// Enable preprocessing in lossless mode (uses Q).
+ /// Change alpha plane fidelity for lossy compression.
+ /// Optimise for minimum size.
+ /// Minimum number of frames between key frames.
+ /// Maximum number of frames between key frames.
+ /// Level of CPU effort to reduce file size.
+ /// Desired target size in bytes.
+ /// Allow mixed encoding (might reduce file size).
+ /// Enable auto-adjusting of the deblocking filter.
+ /// Number of entropy-analysis passes (in [1..10]).
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void Webpsave(string filename, int? q = null, bool? lossless = null, Enums.ForeignWebpPreset? preset = null, bool? smartSubsample = null, bool? nearLossless = null, int? alphaQ = null, bool? minSize = null, int? kmin = null, int? kmax = null, int? effort = null, int? targetSize = null, bool? mixed = null, bool? smartDeblock = null, int? passes = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent(nameof(preset), preset);
+ options.AddIfPresent("smart_subsample", smartSubsample);
+ options.AddIfPresent("near_lossless", nearLossless);
+ options.AddIfPresent("alpha_q", alphaQ);
+ options.AddIfPresent("min_size", minSize);
+ options.AddIfPresent(nameof(kmin), kmin);
+ options.AddIfPresent(nameof(kmax), kmax);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddIfPresent("target_size", targetSize);
+ options.AddIfPresent(nameof(mixed), mixed);
+ options.AddIfPresent("smart_deblock", smartDeblock);
+ options.AddIfPresent(nameof(passes), passes);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("webpsave", options, filename);
+ }
+
+ ///
+ /// Save as WebP.
+ ///
+ ///
+ ///
+ /// byte[] buffer = in.WebpsaveBuffer(q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, targetSize: int, mixed: bool, smartDeblock: bool, passes: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Q factor.
+ /// Enable lossless compression.
+ /// Preset for lossy compression.
+ /// Enable high quality chroma subsampling.
+ /// Enable preprocessing in lossless mode (uses Q).
+ /// Change alpha plane fidelity for lossy compression.
+ /// Optimise for minimum size.
+ /// Minimum number of frames between key frames.
+ /// Maximum number of frames between key frames.
+ /// Level of CPU effort to reduce file size.
+ /// Desired target size in bytes.
+ /// Allow mixed encoding (might reduce file size).
+ /// Enable auto-adjusting of the deblocking filter.
+ /// Number of entropy-analysis passes (in [1..10]).
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ /// An array of bytes.
+ public byte[] WebpsaveBuffer(int? q = null, bool? lossless = null, Enums.ForeignWebpPreset? preset = null, bool? smartSubsample = null, bool? nearLossless = null, int? alphaQ = null, bool? minSize = null, int? kmin = null, int? kmax = null, int? effort = null, int? targetSize = null, bool? mixed = null, bool? smartDeblock = null, int? passes = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent(nameof(preset), preset);
+ options.AddIfPresent("smart_subsample", smartSubsample);
+ options.AddIfPresent("near_lossless", nearLossless);
+ options.AddIfPresent("alpha_q", alphaQ);
+ options.AddIfPresent("min_size", minSize);
+ options.AddIfPresent(nameof(kmin), kmin);
+ options.AddIfPresent(nameof(kmax), kmax);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddIfPresent("target_size", targetSize);
+ options.AddIfPresent(nameof(mixed), mixed);
+ options.AddIfPresent("smart_deblock", smartDeblock);
+ options.AddIfPresent(nameof(passes), passes);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ return this.Call("webpsave_buffer", options) as byte[];
+ }
+
+ ///
+ /// Save image to webp mime.
+ ///
+ ///
+ ///
+ /// in.WebpsaveMime(q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, targetSize: int, mixed: bool, smartDeblock: bool, passes: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Q factor.
+ /// Enable lossless compression.
+ /// Preset for lossy compression.
+ /// Enable high quality chroma subsampling.
+ /// Enable preprocessing in lossless mode (uses Q).
+ /// Change alpha plane fidelity for lossy compression.
+ /// Optimise for minimum size.
+ /// Minimum number of frames between key frames.
+ /// Maximum number of frames between key frames.
+ /// Level of CPU effort to reduce file size.
+ /// Desired target size in bytes.
+ /// Allow mixed encoding (might reduce file size).
+ /// Enable auto-adjusting of the deblocking filter.
+ /// Number of entropy-analysis passes (in [1..10]).
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void WebpsaveMime(int? q = null, bool? lossless = null, Enums.ForeignWebpPreset? preset = null, bool? smartSubsample = null, bool? nearLossless = null, int? alphaQ = null, bool? minSize = null, int? kmin = null, int? kmax = null, int? effort = null, int? targetSize = null, bool? mixed = null, bool? smartDeblock = null, int? passes = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent(nameof(preset), preset);
+ options.AddIfPresent("smart_subsample", smartSubsample);
+ options.AddIfPresent("near_lossless", nearLossless);
+ options.AddIfPresent("alpha_q", alphaQ);
+ options.AddIfPresent("min_size", minSize);
+ options.AddIfPresent(nameof(kmin), kmin);
+ options.AddIfPresent(nameof(kmax), kmax);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddIfPresent("target_size", targetSize);
+ options.AddIfPresent(nameof(mixed), mixed);
+ options.AddIfPresent("smart_deblock", smartDeblock);
+ options.AddIfPresent(nameof(passes), passes);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("webpsave_mime", options);
+ }
+
+ ///
+ /// Save as WebP.
+ ///
+ ///
+ ///
+ /// in.WebpsaveTarget(target, q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, targetSize: int, mixed: bool, smartDeblock: bool, passes: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Target to save to.
+ /// Q factor.
+ /// Enable lossless compression.
+ /// Preset for lossy compression.
+ /// Enable high quality chroma subsampling.
+ /// Enable preprocessing in lossless mode (uses Q).
+ /// Change alpha plane fidelity for lossy compression.
+ /// Optimise for minimum size.
+ /// Minimum number of frames between key frames.
+ /// Maximum number of frames between key frames.
+ /// Level of CPU effort to reduce file size.
+ /// Desired target size in bytes.
+ /// Allow mixed encoding (might reduce file size).
+ /// Enable auto-adjusting of the deblocking filter.
+ /// Number of entropy-analysis passes (in [1..10]).
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void WebpsaveTarget(Target target, int? q = null, bool? lossless = null, Enums.ForeignWebpPreset? preset = null, bool? smartSubsample = null, bool? nearLossless = null, int? alphaQ = null, bool? minSize = null, int? kmin = null, int? kmax = null, int? effort = null, int? targetSize = null, bool? mixed = null, bool? smartDeblock = null, int? passes = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("Q", q);
+ options.AddIfPresent(nameof(lossless), lossless);
+ options.AddIfPresent(nameof(preset), preset);
+ options.AddIfPresent("smart_subsample", smartSubsample);
+ options.AddIfPresent("near_lossless", nearLossless);
+ options.AddIfPresent("alpha_q", alphaQ);
+ options.AddIfPresent("min_size", minSize);
+ options.AddIfPresent(nameof(kmin), kmin);
+ options.AddIfPresent(nameof(kmax), kmax);
+ options.AddIfPresent(nameof(effort), effort);
+ options.AddIfPresent("target_size", targetSize);
+ options.AddIfPresent(nameof(mixed), mixed);
+ options.AddIfPresent("smart_deblock", smartDeblock);
+ options.AddIfPresent(nameof(passes), passes);
+ options.AddForeignKeep(keep);
+ options.AddIfPresent(nameof(background), background);
+ options.AddIfPresent("page_height", pageHeight);
+ options.AddIfPresent(nameof(profile), profile);
+
+ this.Call("webpsave_target", options, target);
+ }
+
+ ///
+ /// Save as WebP.
+ ///
+ ///
+ ///
+ /// in.WebpsaveStream(stream, q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, targetSize: int, mixed: bool, smartDeblock: bool, passes: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string);
+ ///
+ ///
+ /// Stream to save to.
+ /// Q factor.
+ /// Enable lossless compression.
+ /// Preset for lossy compression.
+ /// Enable high quality chroma subsampling.
+ /// Enable preprocessing in lossless mode (uses Q).
+ /// Change alpha plane fidelity for lossy compression.
+ /// Optimise for minimum size.
+ /// Minimum number of frames between key frames.
+ /// Maximum number of frames between key frames.
+ /// Level of CPU effort to reduce file size.
+ /// Desired target size in bytes.
+ /// Allow mixed encoding (might reduce file size).
+ /// Enable auto-adjusting of the deblocking filter.
+ /// Number of entropy-analysis passes (in [1..10]).
+ /// Which metadata to retain.
+ /// Background value.
+ /// Set page height for multipage save.
+ /// Filename of ICC profile to embed.
+ public void WebpsaveStream(Stream stream, int? q = null, bool? lossless = null, Enums.ForeignWebpPreset? preset = null, bool? smartSubsample = null, bool? nearLossless = null, int? alphaQ = null, bool? minSize = null, int? kmin = null, int? kmax = null, int? effort = null, int? targetSize = null, bool? mixed = null, bool? smartDeblock = null, int? passes = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ WebpsaveTarget(target, q, lossless, preset, smartSubsample, nearLossless, alphaQ, minSize, kmin, kmax, effort, targetSize, mixed, smartDeblock, passes, keep, background, pageHeight, profile);
+ }
+
+ ///
+ /// Make a worley noise image.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Worley(width, height, cellSize: int, seed: int);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Size of Worley cells.
+ /// Random number seed.
+ /// A new .
+ public static Image Worley(int width, int height, int? cellSize = null, int? seed = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent("cell_size", cellSize);
+ options.AddIfPresent(nameof(seed), seed);
+
+ return Operation.Call("worley", options, width, height) as Image;
+ }
+
+ ///
+ /// Wrap image origin.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Wrap(x: int, y: int);
+ ///
+ ///
+ /// Left edge of input in output.
+ /// Top edge of input in output.
+ /// A new .
+ public Image Wrap(int? x = null, int? y = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(x), x);
+ options.AddIfPresent(nameof(y), y);
+
+ return this.Call("wrap", options) as Image;
+ }
+
+ ///
+ /// Make an image where pixel values are coordinates.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Xyz(width, height, csize: int, dsize: int, esize: int);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Size of third dimension.
+ /// Size of fourth dimension.
+ /// Size of fifth dimension.
+ /// A new .
+ public static Image Xyz(int width, int height, int? csize = null, int? dsize = null, int? esize = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(csize), csize);
+ options.AddIfPresent(nameof(dsize), dsize);
+ options.AddIfPresent(nameof(esize), esize);
+
+ return Operation.Call("xyz", options, width, height) as Image;
+ }
+
+ ///
+ /// Transform XYZ to CMYK.
+ ///
+ ///
+ ///
+ /// using Image @out = in.XYZ2CMYK();
+ ///
+ ///
+ /// A new .
+ public Image XYZ2CMYK()
+ {
+ return this.Call("XYZ2CMYK") as Image;
+ }
+
+ ///
+ /// Transform XYZ to Lab.
+ ///
+ ///
+ ///
+ /// using Image @out = in.XYZ2Lab(temp: double[]);
+ ///
+ ///
+ /// Colour temperature.
+ /// A new .
+ public Image XYZ2Lab(double[] temp = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(temp), temp);
+
+ return this.Call("XYZ2Lab", options) as Image;
+ }
+
+ ///
+ /// Transform XYZ to scRGB.
+ ///
+ ///
+ ///
+ /// using Image @out = in.XYZ2scRGB();
+ ///
+ ///
+ /// A new .
+ public Image XYZ2scRGB()
+ {
+ return this.Call("XYZ2scRGB") as Image;
+ }
+
+ ///
+ /// Transform XYZ to Yxy.
+ ///
+ ///
+ ///
+ /// using Image @out = in.XYZ2Yxy();
+ ///
+ ///
+ /// A new .
+ public Image XYZ2Yxy()
+ {
+ return this.Call("XYZ2Yxy") as Image;
+ }
+
+ ///
+ /// Transform Yxy to XYZ.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Yxy2XYZ();
+ ///
+ ///
+ /// A new .
+ public Image Yxy2XYZ()
+ {
+ return this.Call("Yxy2XYZ") as Image;
+ }
+
+ ///
+ /// Make a zone plate.
+ ///
+ ///
+ ///
+ /// using Image @out = NetVips.Image.Zone(width, height, uchar: bool);
+ ///
+ ///
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Output an unsigned char image.
+ /// A new .
+ public static Image Zone(int width, int height, bool? uchar = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(uchar), uchar);
+
+ return Operation.Call("zone", options, width, height) as Image;
+ }
+
+ ///
+ /// Zoom an image.
+ ///
+ ///
+ ///
+ /// using Image @out = input.Zoom(xfac, yfac);
+ ///
+ ///
+ /// Horizontal zoom factor.
+ /// Vertical zoom factor.
+ /// A new .
+ public Image Zoom(int xfac, int yfac)
+ {
+ return this.Call("zoom", xfac, yfac) as Image;
+ }
+
+ #endregion
+
+ #region auto-generated properties
+
+ ///
+ /// Image width in pixels
+ ///
+ public int Width => (int)Get("width");
+
+ ///
+ /// Image height in pixels
+ ///
+ public int Height => (int)Get("height");
+
+ ///
+ /// Number of bands in image
+ ///
+ public int Bands => (int)Get("bands");
+
+ ///
+ /// Pixel format in image
+ ///
+ public Enums.BandFormat Format => (Enums.BandFormat)Get("format");
+
+ ///
+ /// Pixel coding
+ ///
+ public Enums.Coding Coding => (Enums.Coding)Get("coding");
+
+ ///
+ /// Pixel interpretation
+ ///
+ public Enums.Interpretation Interpretation => (Enums.Interpretation)Get("interpretation");
+
+ ///
+ /// Horizontal offset of origin
+ ///
+ public int Xoffset => (int)Get("xoffset");
+
+ ///
+ /// Vertical offset of origin
+ ///
+ public int Yoffset => (int)Get("yoffset");
+
+ ///
+ /// Horizontal resolution in pixels/mm
+ ///
+ public double Xres => (double)Get("xres");
+
+ ///
+ /// Vertical resolution in pixels/mm
+ ///
+ public double Yres => (double)Get("yres");
+
+ ///
+ /// Image filename
+ ///
+ public string Filename => (string)Get("filename");
+
+ #endregion
+}
\ No newline at end of file
diff --git a/vendor/NetVips/Image.Operators.cs b/vendor/NetVips/Image.Operators.cs
new file mode 100644
index 0000000..91b29df
--- /dev/null
+++ b/vendor/NetVips/Image.Operators.cs
@@ -0,0 +1,870 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace NetVips;
+
+public partial class Image
+{
+ #region auto-generated operator overloads
+
+ ///
+ /// This operation calculates + .
+ ///
+ /// Left .
+ /// Right .
+ /// A new .
+ public static Image operator +(Image left, Image right) =>
+ left.Call("add", right) as Image;
+
+ ///
+ /// This operation calculates + .
+ ///
+ /// Left double constant.
+ /// Right .
+ /// A new .
+ public static Image operator +(double left, Image right) =>
+ right.Call("linear", 1.0, left) as Image;
+
+ ///
+ /// This operation calculates + .
+ ///
+ /// Left .
+ /// Right double constant.
+ /// A new .
+ public static Image operator +(Image left, double right) =>
+ left.Call("linear", 1.0, right) as Image;
+
+ ///
+ /// This operation calculates + .
+ ///
+ /// Left double array.
+ /// Right .
+ /// A new .
+ public static Image operator +(double[] left, Image right) =>
+ right.Call("linear", 1.0, left) as Image;
+
+ ///
+ /// This operation calculates + .
+ ///
+ /// Left .
+ /// Right double array.
+ /// A new .
+ public static Image operator +(Image left, double[] right) =>
+ left.Call("linear", 1.0, right) as Image;
+
+ ///
+ /// This operation calculates + .
+ ///
+ /// Left integer array.
+ /// Right .
+ /// A new .
+ public static Image operator +(int[] left, Image right) =>
+ right.Call("linear", 1.0, left) as Image;
+
+ ///
+ /// This operation calculates + .
+ ///
+ /// Left .
+ /// Right integer array.
+ /// A new .
+ public static Image operator +(Image left, int[] right) =>
+ left.Call("linear", 1.0, right) as Image;
+
+ ///
+ /// This operation calculates - .
+ ///
+ /// Left .
+ /// Right .
+ /// A new .
+ public static Image operator -(Image left, Image right) =>
+ left.Call("subtract", right) as Image;
+
+ ///
+ /// This operation calculates - .
+ ///
+ /// Left double constant.
+ /// Right .
+ /// A new .
+ public static Image operator -(double left, Image right) =>
+ right.Call("linear", -1.0, left) as Image;
+
+ ///
+ /// This operation calculates - .
+ ///
+ /// Left .
+ /// Right double constant.
+ /// A new .
+ public static Image operator -(Image left, double right) =>
+ left.Call("linear", 1.0, -right) as Image;
+
+ ///
+ /// This operation calculates - .
+ ///
+ /// Left double array.
+ /// Right .
+ /// A new .
+ public static Image operator -(double[] left, Image right) =>
+ right.Call("linear", -1.0, left) as Image;
+
+ ///
+ /// This operation calculates - .
+ ///
+ /// Left .
+ /// Right double array.
+ /// A new .
+ public static Image operator -(Image left, double[] right) =>
+ left.Call("linear", 1.0, right.Negate()) as Image;
+
+ ///
+ /// This operation calculates - .
+ ///
+ /// Left integer array.
+ /// Right .
+ /// A new .
+ public static Image operator -(int[] left, Image right) =>
+ right.Call("linear", -1.0, left) as Image;
+
+ ///
+ /// This operation calculates - .
+ ///
+ /// Left .
+ /// Right integer array.
+ /// A new .
+ public static Image operator -(Image left, int[] right) =>
+ left.Call("linear", 1.0, right.Negate()) as Image;
+
+ ///
+ /// This operation calculates * .
+ ///
+ /// Left .
+ /// Right .
+ /// A new .
+ public static Image operator *(Image left, Image right) =>
+ left.Call("multiply", right) as Image;
+
+ ///
+ /// This operation calculates * .
+ ///
+ /// Left double constant.
+ /// Right .
+ /// A new .
+ public static Image operator *(double left, Image right) =>
+ right.Call("linear", left, 0.0) as Image;
+
+ ///
+ /// This operation calculates * .
+ ///
+ /// Left .
+ /// Right double constant.
+ /// A new .
+ public static Image operator *(Image left, double right) =>
+ left.Call("linear", right, 0.0) as Image;
+
+ ///
+ /// This operation calculates * .
+ ///
+ /// Left double array.
+ /// Right .
+ /// A new .
+ public static Image operator *(double[] left, Image right) =>
+ right.Call("linear", left, 0.0) as Image;
+
+ ///
+ /// This operation calculates * .
+ ///
+ /// Left .
+ /// Right double array.
+ /// A new .
+ public static Image operator *(Image left, double[] right) =>
+ left.Call("linear", right, 0.0) as Image;
+
+ ///
+ /// This operation calculates * .
+ ///
+ /// Left integer array.
+ /// Right .
+ /// A new .
+ public static Image operator *(int[] left, Image right) =>
+ right.Call("linear", left, 0.0) as Image;
+
+ ///
+ /// This operation calculates * .
+ ///
+ /// Left .
+ /// Right integer array.
+ /// A new .
+ public static Image operator *(Image left, int[] right) =>
+ left.Call("linear", right, 0.0) as Image;
+
+ ///
+ /// This operation calculates / .
+ ///
+ /// Left .
+ /// Right .
+ /// A new .
+ public static Image operator /(Image left, Image right) =>
+ left.Call("divide", right) as Image;
+
+ ///
+ /// This operation calculates / .
+ ///
+ /// Left double constant.
+ /// Right .
+ /// A new .
+ public static Image operator /(double left, Image right) =>
+ right.Pow(-1.0).Call("linear", left, 0.0) as Image;
+
+ ///
+ /// This operation calculates / .
+ ///
+ /// Left .
+ /// Right double constant.
+ /// A new .
+ public static Image operator /(Image left, double right) =>
+ left.Call("linear", 1.0 / right, 0.0) as Image;
+
+ ///
+ /// This operation calculates / .
+ ///
+ /// Left double array.
+ /// Right .
+ /// A new .
+ public static Image operator /(double[] left, Image right) =>
+ right.Pow(-1.0).Call("linear", left, 0.0) as Image;
+
+ ///
+ /// This operation calculates / .
+ ///
+ /// Left .
+ /// Right double array.
+ /// A new .
+ public static Image operator /(Image left, double[] right) =>
+ left.Call("linear", right.Invert(), 0.0) as Image;
+
+ ///
+ /// This operation calculates / .
+ ///
+ /// Left integer array.
+ /// Right .
+ /// A new .
+ public static Image operator /(int[] left, Image right) =>
+ right.Pow(-1.0).Call("linear", left, 0.0) as Image;
+
+ ///
+ /// This operation calculates / .
+ ///
+ /// Left .
+ /// Right integer array.
+ /// A new .
+ public static Image operator /(Image left, int[] right) =>
+ left.Call("linear", right.Invert(), 0.0) as Image;
+
+ ///
+ /// This operation calculates %
+ /// (remainder after integer division).
+ ///
+ /// Left .
+ /// Right .
+ /// A new .
+ public static Image operator %(Image left, Image right) =>
+ left.Call("remainder", right) as Image;
+
+ ///
+ /// This operation calculates %
+ /// (remainder after integer division).
+ ///
+ /// Left double constant.
+ /// Right .
+ /// A new .
+ public static Image operator %(double left, Image right) =>
+ right.Call("remainder_const", left) as Image;
+
+ ///
+ /// This operation calculates %
+ /// (remainder after integer division).
+ ///
+ /// Left .
+ /// Right double constant.
+ /// A new .
+ public static Image operator %(Image left, double right) =>
+ left.Call("remainder_const", right) as Image;
+
+ ///
+ /// This operation calculates %
+ /// (remainder after integer division).
+ ///
+ /// Left double array.
+ /// Right .
+ /// A new .
+ public static Image operator %(double[] left, Image right) =>
+ right.Call("remainder_const", left) as Image;
+
+ ///
+ /// This operation calculates %
+ /// (remainder after integer division).
+ ///
+ /// Left .
+ /// Right double array.
+ /// A new .
+ public static Image operator %(Image left, double[] right) =>
+ left.Call("remainder_const", right) as Image;
+
+ ///
+ /// This operation calculates %
+ /// (remainder after integer division).
+ ///
+ /// Left integer array.
+ /// Right .
+ /// A new .
+ public static Image operator %(int[] left, Image right) =>
+ right.Call("remainder_const", left) as Image;
+
+ ///
+ /// This operation calculates %
+ /// (remainder after integer division).
+ ///
+ /// Left .
+ /// Right integer array.
+ /// A new .
+ public static Image operator %(Image left, int[] right) =>
+ left.Call("remainder_const", right) as Image;
+
+ ///
+ /// This operation computes the logical bitwise AND of its operands.
+ ///
+ /// Left .
+ /// Right .
+ /// A new .
+ public static Image operator &(Image left, Image right) =>
+ left.Call("boolean", right, Enums.OperationBoolean.And) as Image;
+
+ ///
+ /// This operation computes the logical bitwise AND of its operands.
+ ///
+ /// Left double constant.
+ /// Right .
+ /// A new .
+ public static Image operator &(double left, Image right) =>
+ right.Call("boolean_const", Enums.OperationBoolean.And, left) as Image;
+
+ ///
+ /// This operation computes the logical bitwise AND of its operands.
+ ///
+ /// Left .
+ /// Right double constant.
+ /// A new .
+ public static Image operator &(Image left, double right) =>
+ left.Call("boolean_const", Enums.OperationBoolean.And, right) as Image;
+
+ ///
+ /// This operation computes the logical bitwise AND of its operands.
+ ///
+ /// Left double array.
+ /// Right .
+ /// A new .
+ public static Image operator &(double[] left, Image right) =>
+ right.Call("boolean_const", Enums.OperationBoolean.And, left) as Image;
+
+ ///
+ /// This operation computes the logical bitwise AND of its operands.
+ ///
+ /// Left .
+ /// Right double array.
+ /// A new .
+ public static Image operator &(Image left, double[] right) =>
+ left.Call("boolean_const", Enums.OperationBoolean.And, right) as Image;
+
+ ///
+ /// This operation computes the logical bitwise AND of its operands.
+ ///
+ /// Left integer array.
+ /// Right .
+ /// A new .
+ public static Image operator &(int[] left, Image right) =>
+ right.Call("boolean_const", Enums.OperationBoolean.And, left) as Image;
+
+ ///
+ /// This operation computes the logical bitwise AND of its operands.
+ ///
+ /// Left .
+ /// Right integer array.
+ /// A new .
+ public static Image operator &(Image left, int[] right) =>
+ left.Call("boolean_const", Enums.OperationBoolean.And, right) as Image;
+
+ ///
+ /// This operation computes the bitwise OR of its operands.
+ ///
+ /// Left .
+ /// Right .
+ /// A new .
+ public static Image operator |(Image left, Image right) =>
+ left.Call("boolean", right, Enums.OperationBoolean.Or) as Image;
+
+ ///
+ /// This operation computes the bitwise OR of its operands.
+ ///
+ /// Left double constant.
+ /// Right .
+ /// A new .
+ public static Image operator |(double left, Image right) =>
+ right.Call("boolean_const", Enums.OperationBoolean.Or, left) as Image;
+
+ ///
+ /// This operation computes the bitwise OR of its operands.
+ ///
+ /// Left .
+ /// Right double constant.
+ /// A new .
+ public static Image operator |(Image left, double right) =>
+ left.Call("boolean_const", Enums.OperationBoolean.Or, right) as Image;
+
+ ///
+ /// This operation computes the bitwise OR of its operands.
+ ///
+ /// Left double array.
+ /// Right .
+ /// A new .
+ public static Image operator |(double[] left, Image right) =>
+ right.Call("boolean_const", Enums.OperationBoolean.Or, left) as Image;
+
+ ///
+ /// This operation computes the bitwise OR of its operands.
+ ///
+ /// Left .
+ /// Right double array.
+ /// A new .
+ public static Image operator |(Image left, double[] right) =>
+ left.Call("boolean_const", Enums.OperationBoolean.Or, right) as Image;
+
+ ///
+ /// This operation computes the bitwise OR of its operands.
+ ///
+ /// Left integer array.
+ /// Right .
+ /// A new .
+ public static Image operator |(int[] left, Image right) =>
+ right.Call("boolean_const", Enums.OperationBoolean.Or, left) as Image;
+
+ ///
+ /// This operation computes the bitwise OR of its operands.
+ ///
+ /// Left .
+ /// Right integer array.
+ /// A new .
+ public static Image operator |(Image left, int[] right) =>
+ left.Call("boolean_const", Enums.OperationBoolean.Or, right) as Image;
+
+ ///
+ /// This operation computes the bitwise exclusive-OR of its operands.
+ ///
+ /// Left .
+ /// Right .
+ /// A new .
+ public static Image operator ^(Image left, Image right) =>
+ left.Call("boolean", right, Enums.OperationBoolean.Eor) as Image;
+
+ ///
+ /// This operation computes the bitwise exclusive-OR of its operands.
+ ///
+ /// Left double constant.
+ /// Right .
+ /// A new .
+ public static Image operator ^(double left, Image right) =>
+ right.Call("boolean_const", Enums.OperationBoolean.Eor, left) as Image;
+
+ ///
+ /// This operation computes the bitwise exclusive-OR of its operands.
+ ///
+ /// Left .
+ /// Right double constant.
+ /// A new .
+ public static Image operator ^(Image left, double right) =>
+ left.Call("boolean_const", Enums.OperationBoolean.Eor, right) as Image;
+
+ ///
+ /// This operation computes the bitwise exclusive-OR of its operands.
+ ///
+ /// Left double array.
+ /// Right .
+ /// A new .
+ public static Image operator ^(double[] left, Image right) =>
+ right.Call("boolean_const", Enums.OperationBoolean.Eor, left) as Image;
+
+ ///
+ /// This operation computes the bitwise exclusive-OR of its operands.
+ ///
+ /// Left .
+ /// Right double array.
+ /// A new .
+ public static Image operator ^(Image left, double[] right) =>
+ left.Call("boolean_const", Enums.OperationBoolean.Eor, right) as Image;
+
+ ///
+ /// This operation computes the bitwise exclusive-OR of its operands.
+ ///
+ /// Left integer array.
+ /// Right .
+ /// A new .
+ public static Image operator ^(int[] left, Image right) =>
+ right.Call("boolean_const", Enums.OperationBoolean.Eor, left) as Image;
+
+ ///
+ /// This operation computes the bitwise exclusive-OR of its operands.
+ ///
+ /// Left .
+ /// Right integer array.
+ /// A new .
+ public static Image operator ^(Image left, int[] right) =>
+ left.Call("boolean_const", Enums.OperationBoolean.Eor, right) as Image;
+
+ ///
+ /// This operation shifts its first operand left by the number of bits specified by its second operand.
+ ///
+ /// Left .
+ /// The number of bits.
+ /// A new .
+ public static Image operator <<(Image left, int right) =>
+ left.Call("boolean_const", Enums.OperationBoolean.Lshift, right) as Image;
+
+ ///
+ /// This operation shifts its first operand right by the number of bits specified by its second operand.
+ ///
+ /// Left .
+ /// The number of bits.
+ /// A new .
+ public static Image operator >>(Image left, int right) =>
+ left.Call("boolean_const", Enums.OperationBoolean.Rshift, right) as Image;
+
+ ///
+ /// This operation compares two images on equality.
+ ///
+ /// Left double constant to compare.
+ /// Right to compare.
+ /// A new .
+ public static Image operator ==(double left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.Equal, left) as Image;
+
+ ///
+ /// This operation compares two images on equality.
+ ///
+ /// Left double array to compare.
+ /// Right to compare.
+ /// A new .
+ public static Image operator ==(double[] left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.Equal, left) as Image;
+
+ ///
+ /// This operation compares two images on equality.
+ ///
+ /// Left integer array to compare.
+ /// Right to compare.
+ /// A new .
+ public static Image operator ==(int[] left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.Equal, left) as Image;
+
+ ///
+ /// This operation compares two images on inequality.
+ ///
+ /// Left double constant to compare.
+ /// Right to compare.
+ /// A new .
+ public static Image operator !=(double left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.Noteq, left) as Image;
+
+ ///
+ /// This operation compares two images on inequality.
+ ///
+ /// Left double array to compare.
+ /// Right to compare.
+ /// A new .
+ public static Image operator !=(double[] left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.Noteq, left) as Image;
+
+ ///
+ /// This operation compares two images on inequality.
+ ///
+ /// Left integer array to compare.
+ /// Right to compare.
+ /// A new .
+ public static Image operator !=(int[] left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.Noteq, left) as Image;
+
+ ///
+ /// This operation compares if the left operand is less than the right operand.
+ ///
+ /// Left .
+ /// Right .
+ /// A new .
+ public static Image operator <(Image left, Image right) =>
+ left.Call("relational", right, Enums.OperationRelational.Less) as Image;
+
+ ///
+ /// This operation compares if the left operand is less than the right operand.
+ ///
+ /// Left double constant.
+ /// Right .
+ /// A new .
+ public static Image operator <(double left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.More, left) as Image;
+
+ ///
+ /// This operation compares if the left operand is less than the right operand.
+ ///
+ /// Left .
+ /// Right double constant.
+ /// A new .
+ public static Image operator <(Image left, double right) =>
+ left.Call("relational_const", Enums.OperationRelational.Less, right) as Image;
+
+ ///
+ /// This operation compares if the left operand is less than the right operand.
+ ///
+ /// Left double array.
+ /// Right .
+ /// A new .
+ public static Image operator <(double[] left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.More, left) as Image;
+
+ ///
+ /// This operation compares if the left operand is less than the right operand.
+ ///
+ /// Left .
+ /// Right double array.
+ /// A new .
+ public static Image operator <(Image left, double[] right) =>
+ left.Call("relational_const", Enums.OperationRelational.Less, right) as Image;
+
+ ///
+ /// This operation compares if the left operand is less than the right operand.
+ ///
+ /// Left integer array.
+ /// Right .
+ /// A new .
+ public static Image operator <(int[] left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.More, left) as Image;
+
+ ///
+ /// This operation compares if the left operand is less than the right operand.
+ ///
+ /// Left .
+ /// Right integer array.
+ /// A new .
+ public static Image operator <(Image left, int[] right) =>
+ left.Call("relational_const", Enums.OperationRelational.Less, right) as Image;
+
+ ///
+ /// This operation compares if the left operand is greater than the right operand.
+ ///
+ /// Left .
+ /// Right .
+ /// A new .
+ public static Image operator >(Image left, Image right) =>
+ left.Call("relational", right, Enums.OperationRelational.More) as Image;
+
+ ///
+ /// This operation compares if the left operand is greater than the right operand.
+ ///
+ /// Left double constant.
+ /// Right .
+ /// A new .
+ public static Image operator >(double left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.Less, left) as Image;
+
+ ///
+ /// This operation compares if the left operand is greater than the right operand.
+ ///
+ /// Left .
+ /// Right double constant.
+ /// A new .
+ public static Image operator >(Image left, double right) =>
+ left.Call("relational_const", Enums.OperationRelational.More, right) as Image;
+
+ ///
+ /// This operation compares if the left operand is greater than the right operand.
+ ///
+ /// Left double array.
+ /// Right .
+ /// A new .
+ public static Image operator >(double[] left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.Less, left) as Image;
+
+ ///
+ /// This operation compares if the left operand is greater than the right operand.
+ ///
+ /// Left .
+ /// Right double array.
+ /// A new .
+ public static Image operator >(Image left, double[] right) =>
+ left.Call("relational_const", Enums.OperationRelational.More, right) as Image;
+
+ ///
+ /// This operation compares if the left operand is greater than the right operand.
+ ///
+ /// Left integer array.
+ /// Right .
+ /// A new .
+ public static Image operator >(int[] left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.Less, left) as Image;
+
+ ///
+ /// This operation compares if the left operand is greater than the right operand.
+ ///
+ /// Left .
+ /// Right integer array.
+ /// A new .
+ public static Image operator >(Image left, int[] right) =>
+ left.Call("relational_const", Enums.OperationRelational.More, right) as Image;
+
+ ///
+ /// This operation compares if the left operand is less than or equal to the right operand.
+ ///
+ /// Left .
+ /// Right .
+ /// A new .
+ public static Image operator <=(Image left, Image right) =>
+ left.Call("relational", right, Enums.OperationRelational.Lesseq) as Image;
+
+ ///
+ /// This operation compares if the left operand is less than or equal to the right operand.
+ ///
+ /// Left double constant.
+ /// Right .
+ /// A new .
+ public static Image operator <=(double left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.Moreeq, left) as Image;
+
+ ///
+ /// This operation compares if the left operand is less than or equal to the right operand.
+ ///
+ /// Left .
+ /// Right double constant.
+ /// A new .
+ public static Image operator <=(Image left, double right) =>
+ left.Call("relational_const", Enums.OperationRelational.Lesseq, right) as Image;
+
+ ///
+ /// This operation compares if the left operand is less than or equal to the right operand.
+ ///
+ /// Left double array.
+ /// Right .
+ /// A new .
+ public static Image operator <=(double[] left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.Moreeq, left) as Image;
+
+ ///
+ /// This operation compares if the left operand is less than or equal to the right operand.
+ ///
+ /// Left .
+ /// Right double array.
+ /// A new .
+ public static Image operator <=(Image left, double[] right) =>
+ left.Call("relational_const", Enums.OperationRelational.Lesseq, right) as Image;
+
+ ///
+ /// This operation compares if the left operand is less than or equal to the right operand.
+ ///
+ /// Left integer array.
+ /// Right .
+ /// A new .
+ public static Image operator <=(int[] left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.Moreeq, left) as Image;
+
+ ///
+ /// This operation compares if the left operand is less than or equal to the right operand.
+ ///
+ /// Left .
+ /// Right integer array.
+ /// A new .
+ public static Image operator <=(Image left, int[] right) =>
+ left.Call("relational_const", Enums.OperationRelational.Lesseq, right) as Image;
+
+ ///
+ /// This operation compares if the left operand is greater than or equal to the right operand.
+ ///
+ /// Left .
+ /// Right .
+ /// A new .
+ public static Image operator >=(Image left, Image right) =>
+ left.Call("relational", right, Enums.OperationRelational.Moreeq) as Image;
+
+ ///
+ /// This operation compares if the left operand is greater than or equal to the right operand.
+ ///
+ /// Left double constant.
+ /// Right .
+ /// A new .
+ public static Image operator >=(double left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.Lesseq, left) as Image;
+
+ ///
+ /// This operation compares if the left operand is greater than or equal to the right operand.
+ ///
+ /// Left .
+ /// Right double constant.
+ /// A new .
+ public static Image operator >=(Image left, double right) =>
+ left.Call("relational_const", Enums.OperationRelational.Moreeq, right) as Image;
+
+ ///
+ /// This operation compares if the left operand is greater than or equal to the right operand.
+ ///
+ /// Left double array.
+ /// Right .
+ /// A new .
+ public static Image operator >=(double[] left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.Lesseq, left) as Image;
+
+ ///
+ /// This operation compares if the left operand is greater than or equal to the right operand.
+ ///
+ /// Left .
+ /// Right double array.
+ /// A new .
+ public static Image operator >=(Image left, double[] right) =>
+ left.Call("relational_const", Enums.OperationRelational.Moreeq, right) as Image;
+
+ ///
+ /// This operation compares if the left operand is greater than or equal to the right operand.
+ ///
+ /// Left integer array.
+ /// Right .
+ /// A new .
+ public static Image operator >=(int[] left, Image right) =>
+ right.Call("relational_const", Enums.OperationRelational.Lesseq, left) as Image;
+
+ ///
+ /// This operation compares if the left operand is greater than or equal to the right operand.
+ ///
+ /// Left .
+ /// Right integer array.
+ /// A new .
+ public static Image operator >=(Image left, int[] right) =>
+ left.Call("relational_const", Enums.OperationRelational.Moreeq, right) as Image;
+
+ ///
+ /// Returns a value indicating whether a given is definitely .
+ ///
+ /// The image to check.
+ /// if is definitely ; otherwise, .
+ public static bool operator true(Image image) =>
+ // Always evaluate to false so that each side of the && equation is evaluated
+ false;
+
+ ///
+ /// Returns a value indicating whether a given is definitely .
+ ///
+ /// The image to check.
+ /// if is definitely ; otherwise, .
+ public static bool operator false(Image image) =>
+ // Always evaluate to false so that each side of the && equation is evaluated
+ false;
+
+ #endregion
+}
\ No newline at end of file
diff --git a/vendor/NetVips/Image.cs b/vendor/NetVips/Image.cs
new file mode 100644
index 0000000..dbcaf63
--- /dev/null
+++ b/vendor/NetVips/Image.cs
@@ -0,0 +1,2328 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Security;
+using System.Text;
+using System.Threading;
+using NetVips.Internal;
+
+namespace NetVips;
+
+///
+/// Wrap a object.
+///
+public partial class Image : VipsObject
+{
+ ///
+ /// A evaluation delegate that can be used on the
+ /// , and
+ /// signals.
+ ///
+ ///
+ /// Use to enable progress reporting on an image.
+ ///
+ public delegate void EvalDelegate(Image image, VipsProgress progressStruct);
+
+ ///
+ /// Internal marshaller delegate for .
+ ///
+ [SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void EvalMarshalDelegate(nint imagePtr, nint progressPtr, nint userDataPtr);
+
+ ///
+ internal Image(nint pointer) : base(pointer)
+ {
+ }
+
+ #region helpers
+
+ ///
+ /// Run a complex function on a non-complex image.
+ ///
+ ///
+ /// The image needs to be complex, or have an even number of bands. The input
+ /// can be int, the output is always float or double.
+ ///
+ /// A complex function.
+ /// A non-complex image.
+ /// A new .
+ /// If image doesn't have an even number of bands.
+ private static Image RunCmplx(Func func, Image image)
+ {
+ var originalFormat = image.Format;
+ if (image.Format != Enums.BandFormat.Complex && image.Format != Enums.BandFormat.Dpcomplex)
+ {
+ if (image.Bands % 2 != 0)
+ {
+ throw new ArgumentException("not an even number of bands");
+ }
+
+ if (image.Format != Enums.BandFormat.Float && image.Format != Enums.BandFormat.Double)
+ {
+ using (image)
+ {
+ image = image.Cast(Enums.BandFormat.Float);
+ }
+ }
+
+ var newFormat = image.Format == Enums.BandFormat.Double
+ ? Enums.BandFormat.Dpcomplex
+ : Enums.BandFormat.Complex;
+
+ using (image)
+ {
+ image = image.Copy(format: newFormat, bands: image.Bands / 2);
+ }
+ }
+
+ using (image)
+ {
+ image = func(image);
+ }
+
+ if (originalFormat != Enums.BandFormat.Complex && originalFormat != Enums.BandFormat.Dpcomplex)
+ {
+ var newFormat = image.Format == Enums.BandFormat.Dpcomplex
+ ? Enums.BandFormat.Double
+ : Enums.BandFormat.Float;
+
+ using (image)
+ {
+ image = image.Copy(format: newFormat, bands: image.Bands * 2);
+ }
+ }
+
+ return image;
+ }
+
+ ///
+ /// Turn a constant (eg. 1, "12", new[] {1, 2, 3}, new[] {new[] {1}}) into an image using
+ /// as a guide.
+ ///
+ /// Image guide.
+ /// A constant.
+ /// A new .
+ public static Image Imageize(Image matchImage, object value)
+ {
+ // careful! this can be None if value is a 2D array
+ return value switch
+ {
+ Image image => image,
+ double[,] doubleArray => NewFromArray(doubleArray),
+ int[,] intArray => NewFromArray(intArray),
+ double[] doubles => matchImage.NewFromImage(doubles),
+ int[] ints => matchImage.NewFromImage(ints),
+ double doubleValue => matchImage.NewFromImage(doubleValue),
+ int intValue => matchImage.NewFromImage(intValue),
+ _ => throw new ArgumentException($"unsupported value type {value.GetType()} for Imageize")
+ };
+ }
+
+ ///
+ /// Find the name of the load operation vips will use to load a file.
+ ///
+ ///
+ /// For example "VipsForeignLoadJpegFile". You can use this to work out what
+ /// options to pass to .
+ ///
+ /// The file to test.
+ /// The name of the load operation, or .
+ public static string FindLoad(string filename)
+ {
+ var bytes = Encoding.UTF8.GetBytes(filename + char.MinValue); // Ensure null-terminated string
+ return Marshal.PtrToStringAnsi(VipsForeign.FindLoad(bytes));
+ }
+
+ ///
+ /// Find the name of the load operation vips will use to load a buffer.
+ ///
+ ///
+ /// For example "VipsForeignLoadJpegBuffer". You can use this to work out what
+ /// options to pass to .
+ ///
+ /// The buffer to test.
+ /// The name of the load operation, or .
+ public static string FindLoadBuffer(byte[] data) =>
+ Marshal.PtrToStringAnsi(VipsForeign.FindLoadBuffer(data, (ulong)data.Length));
+
+ ///
+ /// Find the name of the load operation vips will use to load a buffer.
+ ///
+ ///
+ /// For example "VipsForeignLoadJpegBuffer". You can use this to work out what
+ /// options to pass to .
+ ///
+ /// The buffer to test.
+ /// The name of the load operation, or .
+ public static string FindLoadBuffer(string data) => FindLoadBuffer(Encoding.UTF8.GetBytes(data));
+
+ ///
+ /// Find the name of the load operation vips will use to load a buffer.
+ ///
+ ///
+ /// For example "VipsForeignLoadJpegBuffer". You can use this to work out what
+ /// options to pass to .
+ ///
+ /// The buffer to test.
+ /// The name of the load operation, or .
+ public static string FindLoadBuffer(char[] data) => FindLoadBuffer(Encoding.UTF8.GetBytes(data));
+
+ ///
+ /// Find the name of the load operation vips will use to load a source.
+ ///
+ ///
+ /// For example "VipsForeignLoadJpegSource". You can use this to work out what
+ /// options to pass to .
+ ///
+ /// The source to test.
+ /// The name of the load operation, or .
+ public static string FindLoadSource(Source source) =>
+ Marshal.PtrToStringAnsi(VipsForeign.FindLoadSource(source));
+
+ ///
+ /// Find the name of the load operation vips will use to load a stream.
+ ///
+ ///
+ /// For example "VipsForeignLoadJpegSource". You can use this to work out what
+ /// options to pass to .
+ ///
+ /// The stream to test.
+ /// The name of the load operation, or .
+ public static string FindLoadStream(Stream stream)
+ {
+ using var source = SourceStream.NewFromStream(stream);
+ return FindLoadSource(source);
+ }
+
+ #endregion
+
+ #region constructors
+
+ ///
+ /// Load an image from a file.
+ ///
+ ///
+ /// This method can load images in any format supported by vips. The
+ /// filename can include load options, for example:
+ ///
+ /// using var image = Image.NewFromFile("fred.jpg[shrink=2]");
+ ///
+ /// You can also supply options as keyword arguments, for example:
+ ///
+ /// using var image = Image.NewFromFile("fred.jpg", new VOption
+ /// {
+ /// {"shrink", 2}
+ /// });
+ ///
+ /// The full set of options available depend upon the load operation that
+ /// will be executed. Try something like:
+ ///
+ /// $ vips jpegload
+ ///
+ /// at the command-line to see a summary of the available options for the
+ /// JPEG loader.
+ ///
+ /// Loading is fast: only enough of the image is loaded to be able to fill
+ /// out the header. Pixels will only be decompressed when they are needed.
+ ///
+ /// The disc file to load the image from, with
+ /// optional appended arguments.
+ /// If set to , load the image
+ /// via memory rather than via a temporary disc file. See
+ /// for notes on where temporary files are created. Small images are loaded via memory
+ /// by default, use `VIPS_DISC_THRESHOLD` to set the definition of small.
+ /// Hint the expected access pattern for the image.
+ /// The type of error that will cause load to fail. By
+ /// default, loaders are permissive, that is, .
+ /// Don't use a cached result for this operation.
+ /// Optional options that depend on the load operation.
+ /// A new .
+ /// If unable to load from .
+ public static Image NewFromFile(
+ string vipsFilename,
+ bool? memory = null,
+ Enums.Access? access = null,
+ Enums.FailOn? failOn = null,
+ bool? revalidate = null,
+ VOption kwargs = null)
+ {
+ var bytes = Encoding.UTF8.GetBytes(vipsFilename + char.MinValue); // Ensure null-terminated string
+ var filename = Vips.GetFilename(bytes);
+ var fileOptions = Vips.GetOptions(bytes).ToUtf8String(true);
+
+ var operationName = Marshal.PtrToStringAnsi(VipsForeign.FindLoad(filename));
+ if (operationName == null)
+ {
+ throw new VipsException($"unable to load from file {vipsFilename}");
+ }
+
+ var options = new VOption();
+ if (kwargs != null)
+ {
+ options.Merge(kwargs);
+ }
+
+ options.AddIfPresent(nameof(memory), memory);
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+ options.AddIfPresent(nameof(revalidate), revalidate);
+
+ options.Add("string_options", fileOptions);
+
+ return Operation.Call(operationName, options, filename.ToUtf8String(true)) as Image;
+ }
+
+ ///
+ /// Load a formatted image from memory.
+ ///
+ ///
+ /// This behaves exactly as , but the image is
+ /// loaded from the memory object rather than from a file. The memory
+ /// object can be a string or buffer.
+ ///
+ /// The memory object to load the image from.
+ /// Load options as a string. Use for no options.
+ /// Hint the expected access pattern for the image.
+ /// The type of error that will cause load to fail. By
+ /// default, loaders are permissive, that is, .
+ /// Optional options that depend on the load operation.
+ /// A new .
+ /// If unable to load from .
+ public static Image NewFromBuffer(
+ byte[] data,
+ string strOptions = "",
+ Enums.Access? access = null,
+ Enums.FailOn? failOn = null,
+ VOption kwargs = null)
+ {
+ var operationName = FindLoadBuffer(data);
+ if (operationName == null)
+ {
+ throw new VipsException("unable to load from buffer");
+ }
+
+ var options = new VOption();
+ if (kwargs != null)
+ {
+ options.Merge(kwargs);
+ }
+
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("string_options", strOptions);
+
+ return Operation.Call(operationName, options, data) as Image;
+ }
+
+ ///
+ /// Load a formatted image from memory.
+ ///
+ ///
+ /// This behaves exactly as , but the image is
+ /// loaded from the memory object rather than from a file. The memory
+ /// object can be a string or buffer.
+ ///
+ /// The memory object to load the image from.
+ /// Load options as a string. Use for no options.
+ /// Hint the expected access pattern for the image.
+ /// The type of error that will cause load to fail. By
+ /// default, loaders are permissive, that is, .
+ /// Optional options that depend on the load operation.
+ /// A new .
+ /// If unable to load from .
+ public static Image NewFromBuffer(
+ string data,
+ string strOptions = "",
+ Enums.Access? access = null,
+ Enums.FailOn? failOn = null,
+ VOption kwargs = null) => NewFromBuffer(Encoding.UTF8.GetBytes(data), strOptions, access, failOn, kwargs);
+
+ ///
+ /// Load a formatted image from memory.
+ ///
+ ///
+ /// This behaves exactly as , but the image is
+ /// loaded from the memory object rather than from a file. The memory
+ /// object can be a string or buffer.
+ ///
+ /// The memory object to load the image from.
+ /// Load options as a string. Use for no options.
+ /// Hint the expected access pattern for the image.
+ /// The type of error that will cause load to fail. By
+ /// default, loaders are permissive, that is, .
+ /// Optional options that depend on the load operation.
+ /// A new .
+ /// If unable to load from .
+ public static Image NewFromBuffer(
+ char[] data,
+ string strOptions = "",
+ Enums.Access? access = null,
+ Enums.FailOn? failOn = null,
+ VOption kwargs = null) => NewFromBuffer(Encoding.UTF8.GetBytes(data), strOptions, access, failOn, kwargs);
+
+ ///
+ /// Load a formatted image from a source.
+ ///
+ ///
+ /// This behaves exactly as , but the image is
+ /// loaded from a source rather than from a file.
+ /// At least libvips 8.9 is needed.
+ ///
+ /// The source to load the image from.
+ /// Load options as a string. Use for no options.
+ /// Hint the expected access pattern for the image.
+ /// The type of error that will cause load to fail. By
+ /// default, loaders are permissive, that is, .
+ /// Optional options that depend on the load operation.
+ /// A new .
+ /// If unable to load from .
+ public static Image NewFromSource(
+ Source source,
+ string strOptions = "",
+ Enums.Access? access = null,
+ Enums.FailOn? failOn = null,
+ VOption kwargs = null)
+ {
+ // Load with the new source API if we can. Fall back to the older
+ // mechanism in case the loader we need has not been converted yet.
+ // We need to hide any errors from this first phase.
+ Vips.ErrorFreeze();
+ var operationName = FindLoadSource(source);
+ Vips.ErrorThaw();
+
+ var options = new VOption();
+ if (kwargs != null)
+ {
+ options.Merge(kwargs);
+ }
+
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("string_options", strOptions);
+
+ if (operationName != null)
+ {
+ return Operation.Call(operationName, options, source) as Image;
+ }
+
+ #region fallback mechanism
+
+ var filename = VipsConnection.FileName(source);
+ if (filename != IntPtr.Zero)
+ {
+ // Try with the old file-based loaders.
+ operationName = Marshal.PtrToStringAnsi(VipsForeign.FindLoad(filename));
+ if (operationName == null)
+ {
+ throw new VipsException("unable to load from source");
+ }
+
+ return Operation.Call(operationName, options, filename.ToUtf8String()) as Image;
+ }
+
+ // Try with the old buffer-based loaders.
+ // TODO:
+ // Do we need to check if the source can be efficiently mapped into
+ // memory with `vips_source_is_mappable`?
+ // This implicitly means that it will not work with network streams
+ // (`is_pipe` streams).
+
+ var ptr = VipsSource.MapBlob(source);
+ if (ptr == IntPtr.Zero)
+ {
+ throw new VipsException("unable to load from source");
+ }
+
+ using var blob = new VipsBlob(ptr);
+ var buf = blob.GetData(out var length);
+
+ operationName = Marshal.PtrToStringAnsi(VipsForeign.FindLoadBuffer(buf, length));
+ if (operationName == null)
+ {
+ throw new VipsException("unable to load from source");
+ }
+
+ return Operation.Call(operationName, options, blob) as Image;
+
+ #endregion
+ }
+
+ ///
+ /// Load a formatted image from a stream.
+ ///
+ ///
+ /// This behaves exactly as , but the image is
+ /// loaded from a stream rather than from a source.
+ /// At least libvips 8.9 is needed.
+ ///
+ /// The stream to load the image from.
+ /// Load options as a string. Use for no options.
+ /// Hint the expected access pattern for the image.
+ /// The type of error that will cause load to fail. By
+ /// default, loaders are permissive, that is, .
+ /// Optional options that depend on the load operation.
+ /// A new .
+ /// If unable to load from .
+ public static Image NewFromStream(
+ Stream stream,
+ string strOptions = "",
+ Enums.Access? access = null,
+ Enums.FailOn? failOn = null,
+ VOption kwargs = null)
+ {
+ var source = SourceStream.NewFromStream(stream);
+ var image = NewFromSource(source, strOptions, access, failOn, kwargs);
+
+ // Need to dispose the SourceStream when the image is closed.
+ image.OnPostClose += () => source.Dispose();
+
+ return image;
+ }
+
+
+ ///
+ /// Create an image from a 2D array.
+ ///
+ ///
+ /// A new one-band image with pixels is
+ /// created from the array. These images are useful with the libvips
+ /// convolution operator .
+ ///
+ /// Create the image from these values.
+ /// Default to 1.0. What to divide each pixel by after
+ /// convolution. Useful for integer convolution masks.
+ /// Default to 0.0. What to subtract from each pixel
+ /// after convolution. Useful for integer convolution masks.
+ /// A new .
+ /// If unable to make image from .
+ public static Image NewFromArray(T[,] array, double scale = 1.0, double offset = 0.0)
+ where T : struct, IEquatable
+ {
+ var height = array.GetLength(0);
+ var width = array.GetLength(1);
+ var n = width * height;
+
+ var a = new double[n];
+ for (var y = 0; y < height; y++)
+ {
+ for (var x = 0; x < width; x++)
+ {
+ ref var value = ref a[x + y * width];
+ value = Convert.ToDouble(array[y, x]);
+ }
+ }
+
+ var vi = VipsImage.NewMatrixFromArray(width, height, a, n);
+ if (vi == IntPtr.Zero)
+ {
+ throw new VipsException("unable to make image from matrix");
+ }
+
+ using var image = new Image(vi);
+ return image.Mutate(mutable =>
+ {
+ // be careful to set them as double
+ mutable.Set(GValue.GDoubleType, nameof(scale), scale);
+ mutable.Set(GValue.GDoubleType, nameof(offset), offset);
+ });
+ }
+
+ ///
+ /// Create an image from a 2D array.
+ ///
+ ///
+ /// A new one-band image with pixels is
+ /// created from the array. These images are useful with the libvips
+ /// convolution operator .
+ ///
+ /// Create the image from these values.
+ /// Default to 1.0. What to divide each pixel by after
+ /// convolution. Useful for integer convolution masks.
+ /// Default to 0.0. What to subtract from each pixel
+ /// after convolution. Useful for integer convolution masks.
+ /// A new .
+ /// If unable to make image from .
+ public static Image NewFromArray(T[][] array, double scale = 1.0, double offset = 0.0)
+ where T : struct, IEquatable
+ {
+ var height = array.Length;
+ var width = array[0].Length;
+ var n = width * height;
+
+ var a = new double[n];
+ for (var y = 0; y < height; y++)
+ {
+ for (var x = 0; x < width; x++)
+ {
+ ref var value = ref a[x + y * width];
+ value = Convert.ToDouble(array[y][x]);
+ }
+ }
+
+ var vi = VipsImage.NewMatrixFromArray(width, height, a, n);
+ if (vi == IntPtr.Zero)
+ {
+ throw new VipsException("unable to make image from matrix");
+ }
+
+ using var image = new Image(vi);
+ return image.Mutate(mutable =>
+ {
+ // be careful to set them as double
+ mutable.Set(GValue.GDoubleType, nameof(scale), scale);
+ mutable.Set(GValue.GDoubleType, nameof(offset), offset);
+ });
+ }
+
+ ///
+ /// Create an image from a 1D array.
+ ///
+ ///
+ /// A new one-band image with pixels is
+ /// created from the array. These images are useful with the libvips
+ /// convolution operator .
+ ///
+ /// Create the image from these values.
+ /// 1D arrays become a single row of pixels.
+ /// Default to 1.0. What to divide each pixel by after
+ /// convolution. Useful for integer convolution masks.
+ /// Default to 0.0. What to subtract from each pixel
+ /// after convolution. Useful for integer convolution masks.
+ /// A new .
+ /// If unable to make image from .
+ public static Image NewFromArray(T[] array, double scale = 1.0, double offset = 0.0)
+ where T : struct, IEquatable
+ {
+ var height = array.Length;
+ var a = new double[height];
+ for (var y = 0; y < height; y++)
+ {
+ ref var value = ref a[y];
+ value = Convert.ToDouble(array[y]);
+ }
+
+ var vi = VipsImage.NewMatrixFromArray(1, height, a, height);
+ if (vi == IntPtr.Zero)
+ {
+ throw new VipsException("unable to make image from matrix");
+ }
+
+ using var image = new Image(vi);
+ return image.Mutate(mutable =>
+ {
+ // be careful to set them as double
+ mutable.Set(GValue.GDoubleType, nameof(scale), scale);
+ mutable.Set(GValue.GDoubleType, nameof(offset), offset);
+ });
+ }
+
+ ///
+ /// Wrap an image around a memory array.
+ ///
+ ///
+ /// Wraps an image around a C-style memory array. For example, if the
+ /// memory array contains four bytes with the
+ /// values 1, 2, 3, 4, you can make a one-band, 2x2 uchar image from
+ /// it like this:
+ ///
+ /// using var image = Image.NewFromMemory(data, 2, 2, 1, Enums.BandFormat.Uchar);
+ ///
+ /// A reference is kept to the data object, so it will not be
+ /// garbage-collected until the returned image is garbage-collected.
+ ///
+ /// This method is useful for efficiently transferring images from GDI+
+ /// into libvips.
+ ///
+ /// See for the opposite operation.
+ ///
+ /// Use to set other image attributes.
+ ///
+ /// A memory object.
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Number of bands.
+ /// Band format.
+ /// A new .
+ /// If unable to make image from .
+ public static Image NewFromMemory(
+ Array data,
+ int width,
+ int height,
+ int bands,
+ Enums.BandFormat format)
+ {
+ var handle = GCHandle.Alloc(data, GCHandleType.Pinned);
+ var vi = VipsImage.NewFromMemory(handle.AddrOfPinnedObject(), (nuint)data.Length, width, height, bands,
+ format);
+ if (vi == IntPtr.Zero)
+ {
+ if (handle.IsAllocated)
+ {
+ handle.Free();
+ }
+
+ throw new VipsException("unable to make image from memory");
+ }
+
+ var image = new Image(vi);
+
+ // Need to release the pinned GCHandle when the image is closed.
+ image.OnPostClose += () =>
+ {
+ if (handle.IsAllocated)
+ {
+ handle.Free();
+ }
+ };
+
+ return image;
+ }
+
+ ///
+ /// Wrap an image around a memory area.
+ ///
+ ///
+ /// Because libvips is "borrowing" from the caller, this function
+ /// is extremely dangerous. Unless you are very careful, you will get crashes or memory
+ /// corruption. Use instead if you are at all unsure.
+ ///
+ /// A unmanaged block of memory.
+ /// Length of memory.
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Number of bands.
+ /// Band format.
+ /// A new .
+ /// If unable to make image from .
+ public static Image NewFromMemory(
+ nint data,
+ ulong size,
+ int width,
+ int height,
+ int bands,
+ Enums.BandFormat format)
+ {
+ var vi = VipsImage.NewFromMemory(data, (nuint)size, width, height, bands, format);
+ if (vi == IntPtr.Zero)
+ {
+ throw new VipsException("unable to make image from memory");
+ }
+
+ return new Image(vi) { MemoryPressure = (long)size };
+ }
+
+ ///
+ /// Like , but libvips
+ /// will make a copy of the memory area. This means more memory use and an extra copy
+ /// operation, but is much simpler and safer.
+ ///
+ /// A unmanaged block of memory.
+ /// Length of memory.
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Number of bands.
+ /// Band format.
+ /// A new .
+ /// If unable to make image from .
+ public static Image NewFromMemoryCopy(
+ nint data,
+ ulong size,
+ int width,
+ int height,
+ int bands,
+ Enums.BandFormat format)
+ {
+ var vi = VipsImage.NewFromMemoryCopy(data, (nuint)size, width, height, bands, format);
+ if (vi == IntPtr.Zero)
+ {
+ throw new VipsException("unable to make image from memory");
+ }
+
+ return new Image(vi) { MemoryPressure = (long)size };
+ }
+
+ ///
+ /// Make a new temporary image.
+ ///
+ ///
+ /// Returns an image backed by a temporary file. When written to with
+ /// , a temporary file will be created on disc in the
+ /// specified format. When the image is closed, the file will be deleted
+ /// automatically.
+ ///
+ /// The file is created in the temporary directory. This is set with
+ /// the environment variable `TMPDIR`. If this is not set, then on
+ /// Unix systems, vips will default to `/tmp`. On Windows, vips uses
+ /// `GetTempPath()` to find the temporary directory.
+ ///
+ /// vips uses `g_mkstemp()` to make the temporary filename. They
+ /// generally look something like `vips-12-EJKJFGH.v`.
+ ///
+ /// The format for the temp file, for example
+ /// `%s.v` for a vips format file. The `%s` is
+ /// substituted by the file path.
+ /// A new .
+ /// If unable to make temp file from .
+ public static Image NewTempFile(string format)
+ {
+ var vi = VipsImage.NewTempFile(Encoding.UTF8.GetBytes(format));
+ if (vi == IntPtr.Zero)
+ {
+ throw new VipsException("unable to make temp file");
+ }
+
+ return new Image(vi);
+ }
+
+ ///
+ /// Make a new image from an existing one.
+ ///
+ ///
+ /// A new image is created which has the same size, format, interpretation
+ /// and resolution as `this`, but with every pixel set to `value`.
+ ///
+ /// The value for the pixels. Use a
+ /// single number to make a one-band image; use an array constant
+ /// to make a many-band image.
+ /// A new .
+ public Image NewFromImage(Image value)
+ {
+ using var black = Black(1, 1);
+ using var pixel = black + value;
+ using var cast = pixel.Cast(Format);
+ using var image = cast.Embed(0, 0, Width, Height, extend: Enums.Extend.Copy);
+ return image.Copy(interpretation: Interpretation, xres: Xres, yres: Yres, xoffset: Xoffset,
+ yoffset: Yoffset);
+ }
+
+ ///
+ /// Make a new image from an existing one.
+ ///
+ ///
+ /// A new image is created which has the same size, format, interpretation
+ /// and resolution as `this`, but with every pixel set to `value`.
+ ///
+ /// The value for the pixels. Use a
+ /// single number to make a one-band image; use an array constant
+ /// to make a many-band image.
+ /// A new .
+ public Image NewFromImage(params double[] doubles)
+ {
+ using var black = Black(1, 1);
+ using var pixel = black + doubles;
+ using var cast = pixel.Cast(Format);
+ using var image = cast.Embed(0, 0, Width, Height, extend: Enums.Extend.Copy);
+ return image.Copy(interpretation: Interpretation, xres: Xres, yres: Yres, xoffset: Xoffset,
+ yoffset: Yoffset);
+ }
+
+ ///
+ /// Make a new image from an existing one.
+ ///
+ ///
+ /// A new image is created which has the same size, format, interpretation
+ /// and resolution as `this`, but with every pixel set to `value`.
+ ///
+ /// The value for the pixels. Use a
+ /// single number to make a one-band image; use an array constant
+ /// to make a many-band image.
+ /// A new .
+ public Image NewFromImage(params int[] ints) =>
+ NewFromImage(Array.ConvertAll(ints, Convert.ToDouble));
+
+ ///
+ /// Copy an image to memory.
+ ///
+ ///
+ /// A large area of memory is allocated, the image is rendered to that
+ /// memory area, and a new image is returned which wraps that large memory
+ /// area.
+ ///
+ /// A new .
+ /// If unable to copy to memory.
+ public Image CopyMemory()
+ {
+ var vi = VipsImage.CopyMemory(this);
+ if (vi == IntPtr.Zero)
+ {
+ throw new VipsException("unable to copy to memory");
+ }
+
+ return new Image(vi) { MemoryPressure = MemoryPressure };
+ }
+
+ #endregion
+
+ #region writers
+
+ ///
+ /// Write an image to a file on disc.
+ ///
+ ///
+ /// This method can save images in any format supported by vips. The format
+ /// is selected from the filename suffix. The filename can include embedded
+ /// save options, see .
+ ///
+ /// For example:
+ ///
+ /// image.WriteToFile("fred.jpg[Q=95]");
+ ///
+ /// You can also supply options as keyword arguments, for example:
+ ///
+ /// image.WriteToFile("fred.jpg", new VOption
+ /// {
+ /// {"Q", 95}
+ /// });
+ ///
+ /// The full set of options available depend upon the save operation that
+ /// will be executed. Try something like:
+ ///
+ /// $ vips jpegsave
+ ///
+ /// at the command-line to see a summary of the available options for the
+ /// JPEG saver.
+ ///
+ /// The disc file to save the image to, with
+ /// optional appended arguments.
+ /// Optional options that depend on the save operation.
+ /// If unable to write to .
+ public void WriteToFile(string vipsFilename, VOption kwargs = null)
+ {
+ var bytes = Encoding.UTF8.GetBytes(vipsFilename + char.MinValue); // Ensure null-terminated string
+ var filename = Vips.GetFilename(bytes);
+ var fileOptions = Vips.GetOptions(bytes).ToUtf8String(true);
+
+ var operationName = Marshal.PtrToStringAnsi(VipsForeign.FindSave(filename));
+ if (operationName == null)
+ {
+ throw new VipsException($"unable to write to file {vipsFilename}");
+ }
+
+ var stringOptions = new VOption
+ {
+ {"string_options", fileOptions}
+ };
+
+ if (kwargs != null)
+ {
+ kwargs.Merge(stringOptions);
+ }
+ else
+ {
+ kwargs = stringOptions;
+ }
+
+ this.Call(operationName, kwargs, filename.ToUtf8String(true));
+ }
+
+ ///
+ /// Write an image to a formatted string.
+ ///
+ ///
+ /// This method can save images in any format supported by vips. The format
+ /// is selected from the suffix in the format string. This can include
+ /// embedded save options, see .
+ ///
+ /// For example:
+ ///
+ /// var data = image.WriteToBuffer(".jpg[Q=95]");
+ ///
+ /// You can also supply options as keyword arguments, for example:
+ ///
+ /// var data = image.WriteToBuffer(".jpg", new VOption
+ /// {
+ /// {"Q", 95}
+ /// });
+ ///
+ /// The full set of options available depend upon the load operation that
+ /// will be executed. Try something like:
+ ///
+ /// $ vips jpegsave_buffer
+ ///
+ /// at the command-line to see a summary of the available options for the
+ /// JPEG saver.
+ ///
+ /// The suffix, plus any string-form arguments.
+ /// Optional options that depend on the save operation.
+ /// An array of bytes.
+ /// If unable to write to buffer.
+ public byte[] WriteToBuffer(string formatString, VOption kwargs = null)
+ {
+ var bytes = Encoding.UTF8.GetBytes(formatString + char.MinValue); // Ensure null-terminated string
+ var bufferOptions = Vips.GetOptions(bytes).ToUtf8String(true);
+ string operationName = null;
+
+ // Save with the new target API if we can. Fall back to the older
+ // mechanism in case the saver we need has not been converted yet.
+ // We need to hide any errors from this first phase.
+ if (NetVips.AtLeastLibvips(8, 9))
+ {
+ Vips.ErrorFreeze();
+ operationName = Marshal.PtrToStringAnsi(VipsForeign.FindSaveTarget(bytes));
+ Vips.ErrorThaw();
+ }
+
+ var stringOptions = new VOption
+ {
+ {"string_options", bufferOptions}
+ };
+
+ if (kwargs != null)
+ {
+ kwargs.Merge(stringOptions);
+ }
+ else
+ {
+ kwargs = stringOptions;
+ }
+
+ if (operationName != null)
+ {
+ using var target = Target.NewToMemory();
+ this.Call(operationName, kwargs, target);
+ return target.Blob;
+ }
+
+ #region fallback mechanism
+
+ operationName = Marshal.PtrToStringAnsi(VipsForeign.FindSaveBuffer(bytes));
+ if (operationName == null)
+ {
+ throw new VipsException("unable to write to buffer");
+ }
+
+ return this.Call(operationName, kwargs) as byte[];
+
+ #endregion
+ }
+
+ ///
+ /// Write an image to a target.
+ ///
+ ///
+ /// This behaves exactly as , but the image is
+ /// written to a target rather than a file.
+ /// At least libvips 8.9 is needed.
+ ///
+ /// Write to this target.
+ /// The suffix, plus any string-form arguments.
+ /// Optional options that depend on the save operation.
+ /// If unable to write to target.
+ public void WriteToTarget(Target target, string formatString, VOption kwargs = null)
+ {
+ var bytes = Encoding.UTF8.GetBytes(formatString + char.MinValue); // Ensure null-terminated string
+ var bufferOptions = Vips.GetOptions(bytes).ToUtf8String(true);
+
+ var operationName = Marshal.PtrToStringAnsi(VipsForeign.FindSaveTarget(bytes));
+ if (operationName == null)
+ {
+ throw new VipsException("unable to write to target");
+ }
+
+ var stringOptions = new VOption
+ {
+ {"string_options", bufferOptions}
+ };
+
+ if (kwargs != null)
+ {
+ kwargs.Merge(stringOptions);
+ }
+ else
+ {
+ kwargs = stringOptions;
+ }
+
+ this.Call(operationName, kwargs, target);
+ }
+
+ ///
+ /// Write an image to a stream.
+ ///
+ ///
+ /// This behaves exactly as , but the image is
+ /// written to a stream rather than a target.
+ /// At least libvips 8.9 is needed.
+ ///
+ /// Write to this stream.
+ /// The suffix, plus any string-form arguments.
+ /// Optional options that depend on the save operation.
+ /// If unable to write to stream.
+ public void WriteToStream(Stream stream, string formatString, VOption kwargs = null)
+ {
+ using var target = TargetStream.NewFromStream(stream);
+ WriteToTarget(target, formatString, kwargs);
+ }
+
+
+ ///
+ /// Write the image to memory as a simple, unformatted C-style array.
+ ///
+ ///
+ /// The caller is responsible for freeing this memory with .
+ ///
+ /// Output buffer length.
+ /// A pointing to an unformatted C-style array.
+ /// If unable to write to memory.
+ public nint WriteToMemory(out ulong size)
+ {
+ var pointer = VipsImage.WriteToMemory(this, out size);
+ if (pointer == IntPtr.Zero)
+ {
+ throw new VipsException("unable to write to memory");
+ }
+
+ return pointer;
+ }
+
+ ///
+ /// Write the image to a large memory array.
+ ///
+ ///
+ /// A large area of memory is allocated, the image is rendered to that
+ /// memory array, and the array is returned as a buffer.
+ ///
+ /// For example, if you have a 2x2 uchar image containing the bytes 1, 2,
+ /// 3, 4, read left-to-right, top-to-bottom, then:
+ ///
+ /// var buf = image.WriteToMemory();
+ ///
+ /// will return a four byte buffer containing the values 1, 2, 3, 4.
+ ///
+ /// An array of bytes.
+ /// If unable to write to memory.
+ public byte[] WriteToMemory()
+ {
+ var pointer = WriteToMemory(out var size);
+
+ var managedArray = new byte[size];
+ Marshal.Copy(pointer, managedArray, 0, (int)size);
+
+ GLib.GFree(pointer);
+
+ return managedArray;
+ }
+
+ ///
+ /// Write an image to another image.
+ ///
+ ///
+ /// This function writes `this` to another image. Use something like
+ /// to make an image that can be written to.
+ ///
+ /// The to write to.
+ /// If unable to write to image.
+ public void Write(Image other)
+ {
+ var result = VipsImage.Write(this, other);
+ if (result != 0)
+ {
+ throw new VipsException("unable to write to image");
+ }
+ }
+
+ #endregion
+
+ #region get metadata
+
+ ///
+ /// Get the GType of an item of metadata.
+ ///
+ ///
+ /// Fetch the GType of a piece of metadata, or if the named
+ /// item does not exist. See .
+ ///
+ /// The name of the piece of metadata to get the type of.
+ /// A new instance of initialized to the GType or
+ /// if the property does not exist.
+ public new nint GetTypeOf(string name)
+ {
+ // on libvips before 8.5, property types must be fetched separately,
+ // since built-in enums were reported as ints
+ if (!NetVips.AtLeastLibvips(8, 5))
+ {
+ var gtype = base.GetTypeOf(name);
+ if (gtype != IntPtr.Zero)
+ {
+ return gtype;
+ }
+ }
+
+ return VipsImage.GetTypeof(this, name);
+ }
+
+ ///
+ /// Check if the underlying image contains an property of metadata.
+ ///
+ /// The name of the piece of metadata to check for.
+ /// if the metadata exits; otherwise, .
+ public bool Contains(string name)
+ {
+ return GetTypeOf(name) != IntPtr.Zero;
+ }
+
+ ///
+ /// Get an item of metadata.
+ ///
+ ///
+ /// Fetches an item of metadata as a C# value. For example:
+ ///
+ /// var orientation = image.Get("orientation");
+ ///
+ /// would fetch the image orientation.
+ ///
+ /// The name of the piece of metadata to get.
+ /// The metadata item as a C# value.
+ /// If unable to get .
+ public new object Get(string name)
+ {
+ switch (name)
+ {
+ // scale and offset have default values
+ case "scale" when !Contains("scale"):
+ return 1.0;
+ case "offset" when !Contains("offset"):
+ return 0.0;
+ }
+
+ // with old libvips, we must fetch properties (as opposed to
+ // metadata) via VipsObject
+ if (!NetVips.AtLeastLibvips(8, 5))
+ {
+ var gtype = base.GetTypeOf(name);
+ if (gtype != IntPtr.Zero)
+ {
+ return base.Get(name);
+ }
+ }
+
+ var result = VipsImage.Get(this, name, out var gvCopy);
+ if (result != 0)
+ {
+ throw new VipsException($"unable to get {name}");
+ }
+
+ using var gv = new GValue(gvCopy);
+ return gv.Get();
+ }
+
+ ///
+ /// Get a list of all the metadata fields on an image.
+ ///
+ ///
+ /// At least libvips 8.5 is needed.
+ ///
+ /// An array of strings or .
+ public string[] GetFields()
+ {
+ if (!NetVips.AtLeastLibvips(8, 5))
+ {
+ return null;
+ }
+
+ var ptrArr = VipsImage.GetFields(this);
+
+ var names = new List();
+
+ var count = 0;
+ nint strPtr;
+ while ((strPtr = Marshal.ReadIntPtr(ptrArr, count * IntPtr.Size)) != IntPtr.Zero)
+ {
+ var name = Marshal.PtrToStringAnsi(strPtr);
+ names.Add(name);
+ GLib.GFree(strPtr);
+ ++count;
+ }
+
+ GLib.GFree(ptrArr);
+
+ return names.ToArray();
+ }
+
+ ///
+ /// Returns a string that represents the current image.
+ ///
+ /// A string that represents the current image.
+ public override string ToString()
+ {
+ return $"";
+ }
+
+ #endregion
+
+ #region handwritten functions
+
+ ///
+ /// Mutate an image with a delegate. Inside the delegate, you can call methods
+ /// which modify the image, such as setting or removing metadata, or
+ /// modifying pixels.
+ ///
+ ///
+ ///
+ /// using var mutated = image.Mutate(mutable =>
+ /// {
+ /// for (var i = 0; i <= 100; i++)
+ /// {
+ /// var j = i / 100.0;
+ /// mutable.DrawLine(new[] { 255.0 }, (int)(mutable.Width * j), 0, 0, (int)(mutable.Height * (1 - j)));
+ /// }
+ /// });
+ ///
+ ///
+ /// A new .
+ public virtual Image Mutate(Action action)
+ {
+ // We take a copy of the regular Image to ensure we have an unshared (unique) object.
+ using var mutable = new MutableImage(Copy());
+ action.Invoke(mutable);
+ return mutable.Image;
+ }
+
+ ///
+ /// Scale an image to 0 - 255.
+ ///
+ ///
+ /// This is the libvips `scale` operation, renamed to avoid a clash with
+ /// the `scale` for convolution masks.
+ ///
+ ///
+ ///
+ /// using Image @out = in.Scale(exp: double, log: bool);
+ ///
+ ///
+ /// Exponent for log scale.
+ /// Log scale.
+ /// A new .
+ public Image ScaleImage(double? exp = null, bool? log = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(exp), exp);
+ options.AddIfPresent(nameof(log), log);
+
+ return this.Call("scale", options) as Image;
+ }
+
+ ///
+ /// Ifthenelse an image.
+ ///
+ ///
+ ///
+ /// using Image @out = cond.Ifthenelse(in1, in2, blend: bool);
+ ///
+ ///
+ /// Source for TRUE pixels.
+ /// Source for FALSE pixels.
+ /// Blend smoothly between then and else parts.
+ /// A new .
+ public Image Ifthenelse(object in1, object in2, bool? blend = null)
+ {
+ Image matchImage;
+ if (in1 is Image th)
+ {
+ matchImage = th;
+ }
+ else if (in2 is Image el)
+ {
+ matchImage = el;
+ }
+ else
+ {
+ matchImage = this;
+ }
+
+ using var im1 = in1 is Image ? null : Imageize(matchImage, in1);
+ using var im2 = in2 is Image ? null : Imageize(matchImage, in2);
+
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(blend), blend);
+
+ return this.Call("ifthenelse", options, im1 ?? in1, im2 ?? in2) as Image;
+ }
+
+ ///
+ /// Use pixel values to pick cases from an array of constants.
+ ///
+ ///
+ ///
+ /// using Image @out = index.Case(10.5, 20.5);
+ ///
+ ///
+ /// Array of constants.
+ /// A new .
+ public Image Case(params double[] doubles) =>
+ this.Call("case", doubles) as Image;
+
+ ///
+ /// Use pixel values to pick cases from an array of constants.
+ ///
+ ///
+ ///
+ /// using Image @out = index.Case(10, 20);
+ ///
+ ///
+ /// Array of constants.
+ /// A new .
+ public Image Case(params int[] ints) =>
+ Case(Array.ConvertAll(ints, Convert.ToDouble));
+
+ ///
+ /// Use pixel values to pick cases from an array of images.
+ ///
+ ///
+ ///
+ /// using Image @out = index.Case(images);
+ ///
+ ///
+ /// Array of case images.
+ /// A new .
+ public Image Case(params Image[] images) =>
+ this.Call("case", new object[] { images }) as Image;
+
+ ///
+ /// Use pixel values to pick cases from an a set of mixed images and constants.
+ ///
+ ///
+ ///
+ /// using Image @out = index.Case(image, 10);
+ ///
+ ///
+ /// Array of mixed images and constants.
+ /// A new .
+ public Image Case(params object[] objects) =>
+ this.Call("case", new object[] { objects }) as Image;
+
+ ///
+ /// Append a set of constants bandwise.
+ ///
+ ///
+ ///
+ /// using Image @out = image.Bandjoin(127.5, 255.0);
+ ///
+ ///
+ /// Array of constants.
+ /// A new .
+ public Image Bandjoin(params double[] doubles) =>
+ BandjoinConst(doubles);
+
+ ///
+ /// Append a set of constants bandwise.
+ ///
+ ///
+ ///
+ /// using Image @out = image.Bandjoin(255, 128);
+ ///
+ ///
+ /// Array of constants.
+ /// A new .
+ public Image Bandjoin(params int[] ints) =>
+ BandjoinConst(Array.ConvertAll(ints, Convert.ToDouble));
+
+ ///
+ /// Append a set of images bandwise.
+ ///
+ ///
+ ///
+ /// using Image @out = image.Bandjoin(image2, image3);
+ ///
+ ///
+ /// Array of images.
+ /// A new .
+ public Image Bandjoin(params Image[] images) =>
+ this.Call("bandjoin", new object[] { images.PrependImage(this) }) as Image;
+
+ ///
+ /// Append a set of mixed images and constants bandwise.
+ ///
+ ///
+ ///
+ /// using Image @out = image.Bandjoin(image2, 255);
+ ///
+ ///
+ /// Array of mixed images and constants.
+ /// A new .
+ public Image Bandjoin(params object[] objects) =>
+ this.Call("bandjoin", new object[] { objects.PrependImage(this) }) as Image;
+
+ ///
+ /// Band-wise rank a set of constants.
+ ///
+ ///
+ ///
+ /// using Image @out = image.Bandrank(other, index: int);
+ ///
+ ///
+ /// Array of constants.
+ /// Select this band element from sorted list.
+ /// A new
+ public Image Bandrank(double[] doubles, int? index = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(index), index);
+
+ return this.Call("bandrank", options, doubles) as Image;
+ }
+
+ ///
+ /// Band-wise rank a set of constants.
+ ///
+ ///
+ ///
+ /// using Image @out = image.Bandrank(other, index: int);
+ ///
+ ///
+ /// Array of constants.
+ /// Select this band element from sorted list.
+ /// A new .
+ public Image Bandrank(int[] ints, int? index = null) =>
+ Bandrank(Array.ConvertAll(ints, Convert.ToDouble), index);
+
+ ///
+ /// Band-wise rank a set of images.
+ ///
+ ///
+ ///
+ /// using Image @out = image.Bandrank(other, index: int);
+ ///
+ ///
+ /// Array of input images.
+ /// Select this band element from sorted list.
+ /// A new .
+ public Image Bandrank(Image[] images, int? index = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(index), index);
+
+ return this.Call("bandrank", options, new object[] { images.PrependImage(this) }) as Image;
+ }
+
+ ///
+ /// Band-wise rank a image.
+ ///
+ ///
+ ///
+ /// using Image @out = image.Bandrank(other, index: int);
+ ///
+ ///
+ /// Input image.
+ /// Select this band element from sorted list.
+ /// A new .
+ public Image Bandrank(Image other, int? index = null) =>
+ Bandrank(new[] { other }, index);
+
+ ///
+ /// Band-wise rank a set of mixed images and constants.
+ ///
+ ///
+ ///
+ /// using Image @out = image.Bandrank(new object[] { image2, 255 }, index: int);
+ ///
+ ///
+ /// Array of mixed images and constants.
+ /// Select this band element from sorted list.
+ /// A new .
+ public Image Bandrank(object[] objects, int? index = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(index), index);
+
+ return this.Call("bandrank", options, new object[] { objects.PrependImage(this) }) as Image;
+ }
+
+ ///
+ /// Blend an array of images with an array of blend modes.
+ ///
+ ///
+ ///
+ /// using Image @out = image.Composite(images, modes, x: int[], y: int[], compositingSpace: Enums.Interpretation, premultiplied: bool);
+ ///
+ ///
+ /// Array of input images.
+ /// Array of VipsBlendMode to join with.
+ /// Array of x coordinates to join at.
+ /// Array of y coordinates to join at.
+ /// Composite images in this colour space.
+ /// Images have premultiplied alpha.
+ /// A new .
+ public Image Composite(Image[] images, Enums.BlendMode[] modes, int[] x = null, int[] y = null,
+ Enums.Interpretation? compositingSpace = null, bool? premultiplied = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(x), x);
+ options.AddIfPresent(nameof(y), y);
+ options.AddIfPresent("compositing_space", compositingSpace);
+ options.AddIfPresent(nameof(premultiplied), premultiplied);
+
+ return this.Call("composite", options, images.PrependImage(this), modes) as Image;
+ }
+
+ ///
+ /// A synonym for .
+ ///
+ ///
+ ///
+ /// using Image @out = base.Composite(overlay, mode, x: int, y: int, compositingSpace: Enums.Interpretation, premultiplied: bool);
+ ///
+ ///
+ /// Overlay image.
+ /// VipsBlendMode to join with.
+ /// x position of overlay.
+ /// y position of overlay.
+ /// Composite images in this colour space.
+ /// Images have premultiplied alpha.
+ /// A new .
+ public Image Composite(Image overlay, Enums.BlendMode mode, int? x = null, int? y = null,
+ Enums.Interpretation? compositingSpace = null, bool? premultiplied = null) =>
+ Composite2(overlay, mode, x, y, compositingSpace, premultiplied);
+
+ ///
+ /// A synonym for .
+ ///
+ ///
+ ///
+ /// using Image @out = input.Crop(left, top, width, height);
+ ///
+ ///
+ /// Left edge of extract area.
+ /// Top edge of extract area.
+ /// Width of extract area.
+ /// Height of extract area.
+ /// A new .
+ public Image Crop(int left, int top, int width, int height) =>
+ ExtractArea(left, top, width, height);
+
+ ///
+ /// Return the coordinates of the image maximum.
+ ///
+ /// An array of doubles.
+ public double[] MaxPos()
+ {
+ var v = Max(out var x, out var y);
+ return new[] { v, x, y };
+ }
+
+ ///
+ /// Return the coordinates of the image minimum.
+ ///
+ /// An array of doubles.
+ public double[] MinPos()
+ {
+ var v = Min(out var x, out var y);
+ return new[] { v, x, y };
+ }
+
+ ///
+ /// Return the real part of a complex image.
+ ///
+ /// A new .
+ public Image Real() => Complexget(Enums.OperationComplexget.Real);
+
+ ///
+ /// Return the imaginary part of a complex image.
+ ///
+ /// A new .
+ public Image Imag() => Complexget(Enums.OperationComplexget.Imag);
+
+ ///
+ /// Return an image converted to polar coordinates.
+ ///
+ /// A new .
+ public Image Polar() => RunCmplx(x => x.Complex(Enums.OperationComplex.Polar), this);
+
+ ///
+ /// Return an image converted to rectangular coordinates.
+ ///
+ /// A new .
+ public Image Rect() => RunCmplx(x => x.Complex(Enums.OperationComplex.Rect), this);
+
+ ///
+ /// Return the complex conjugate of an image.
+ ///
+ /// A new .
+ public Image Conj() => Complex(Enums.OperationComplex.Conj);
+
+ ///
+ /// Return the sine of an image in degrees.
+ ///
+ /// A new .
+ public Image Sin() => Math(Enums.OperationMath.Sin);
+
+ ///
+ /// Return the cosine of an image in degrees.
+ ///
+ /// A new .
+ public Image Cos() => Math(Enums.OperationMath.Cos);
+
+ ///
+ /// Return the tangent of an image in degrees.
+ ///
+ /// A new .
+ public Image Tan() => Math(Enums.OperationMath.Tan);
+
+ ///
+ /// Return the inverse sine of an image in degrees.
+ ///
+ /// A new .
+ public Image Asin() => Math(Enums.OperationMath.Asin);
+
+ ///
+ /// Return the inverse cosine of an image in degrees.
+ ///
+ /// A new .
+ public Image Acos() => Math(Enums.OperationMath.Acos);
+
+ ///
+ /// Return the inverse tangent of an image in degrees.
+ ///
+ /// A new .
+ public Image Atan() => Math(Enums.OperationMath.Atan);
+
+ ///
+ /// Return the hyperbolic sine of an image in radians.
+ ///
+ /// A new .
+ public Image Sinh() => Math(Enums.OperationMath.Sinh);
+
+ ///
+ /// Return the hyperbolic cosine of an image in radians.
+ ///
+ /// A new .
+ public Image Cosh() => Math(Enums.OperationMath.Cosh);
+
+ ///
+ /// Return the hyperbolic tangent of an image in radians.
+ ///
+ /// A new .
+ public Image Tanh() => Math(Enums.OperationMath.Tanh);
+
+ ///
+ /// Return the inverse hyperbolic sine of an image in radians.
+ ///
+ /// A new .
+ public Image Asinh() => Math(Enums.OperationMath.Asinh);
+
+ ///
+ /// Return the inverse hyperbolic cosine of an image in radians.
+ ///
+ /// A new .
+ public Image Acosh() => Math(Enums.OperationMath.Acosh);
+
+ ///
+ /// Return the inverse hyperbolic tangent of an image in radians.
+ ///
+ /// A new .
+ public Image Atanh() => Math(Enums.OperationMath.Atanh);
+
+ ///
+ /// Return the natural log of an image.
+ ///
+ /// A new .
+ public Image Log() => Math(Enums.OperationMath.Log);
+
+ ///
+ /// Return the log base 10 of an image.
+ ///
+ /// A new .
+ public Image Log10() => Math(Enums.OperationMath.Log10);
+
+ ///
+ /// Return e ** pixel.
+ ///
+ /// A new .
+ public Image Exp() => Math(Enums.OperationMath.Exp);
+
+ ///
+ /// Return 10 ** pixel.
+ ///
+ /// A new .
+ public Image Exp10() => Math(Enums.OperationMath.Exp10);
+
+ ///
+ /// Raise to power of an image.
+ ///
+ /// To the power of this.
+ /// A new .
+ public Image Pow(Image exp) => Math2(exp, Enums.OperationMath2.Pow);
+
+ ///
+ /// Raise to power of an constant.
+ ///
+ /// To the power of this.
+ /// A new .
+ public Image Pow(double exp) => Math2Const(Enums.OperationMath2.Pow, new[] { exp });
+
+ ///
+ /// Raise to power of an array.
+ ///
+ /// To the power of this.
+ /// A new .
+ public Image Pow(double[] exp) => Math2Const(Enums.OperationMath2.Pow, exp);
+
+ ///
+ /// Raise to power of an array.
+ ///
+ /// To the power of this.
+ /// A new .
+ public Image Pow(int[] exp) =>
+ Math2Const(Enums.OperationMath2.Pow, Array.ConvertAll(exp, Convert.ToDouble));
+
+ ///
+ /// Raise to power of an image, but with the arguments reversed.
+ ///
+ /// To the base of this.
+ /// A new .
+ public Image Wop(Image @base) => Math2(@base, Enums.OperationMath2.Wop);
+
+ ///
+ /// Raise to power of an constant, but with the arguments reversed.
+ ///
+ /// To the base of this.
+ /// A new .
+ public Image Wop(double @base) => Math2Const(Enums.OperationMath2.Wop, new[] { @base });
+
+ ///
+ /// Raise to power of an array, but with the arguments reversed.
+ ///
+ /// To the base of this.
+ /// A new .
+ public Image Wop(double[] @base) => Math2Const(Enums.OperationMath2.Wop, @base);
+
+ ///
+ /// Raise to power of an array, but with the arguments reversed.
+ ///
+ /// To the base of this.
+ /// A new .
+ public Image Wop(int[] @base) =>
+ Math2Const(Enums.OperationMath2.Wop, Array.ConvertAll(@base, Convert.ToDouble));
+
+ ///
+ /// Arc tangent of an image in degrees.
+ ///
+ /// Arc tangent of y / .
+ /// A new .
+ public Image Atan2(Image x) => Math2(x, Enums.OperationMath2.Atan2);
+
+ ///
+ /// Arc tangent of an constant in degrees.
+ ///
+ /// Arc tangent of y / .
+ /// A new .
+ public Image Atan2(double x) => Math2Const(Enums.OperationMath2.Atan2, new[] { x });
+
+ ///
+ /// Arc tangent of an array in degrees.
+ ///
+ /// Arc tangent of y / .
+ /// A new .
+ public Image Atan2(double[] x) => Math2Const(Enums.OperationMath2.Atan2, x);
+
+ ///
+ /// Arc tangent of an array in degrees.
+ ///
+ /// Arc tangent of y / .
+ /// A new .
+ public Image Atan2(int[] x) =>
+ Math2Const(Enums.OperationMath2.Atan2, Array.ConvertAll(x, Convert.ToDouble));
+
+ ///
+ /// Erode with a structuring element.
+ ///
+ /// The structuring element.
+ /// A new .
+ public Image Erode(Image mask) => Morph(mask, Enums.OperationMorphology.Erode);
+
+ ///
+ /// Dilate with a structuring element.
+ ///
+ /// The structuring element.
+ /// A new .
+ public Image Dilate(Image mask) => Morph(mask, Enums.OperationMorphology.Dilate);
+
+ ///
+ /// size x size median filter.
+ ///
+ /// The median filter.
+ /// A new .
+ public Image Median(int size) => Rank(size, size, size * size / 2);
+
+ ///
+ /// Flip horizontally.
+ ///
+ /// A new .
+ public Image FlipHor() => Flip(Enums.Direction.Horizontal);
+
+ ///
+ /// Flip vertically.
+ ///
+ /// A new .
+ public Image FlipVer() => Flip(Enums.Direction.Vertical);
+
+ ///
+ /// Rotate 90 degrees clockwise.
+ ///
+ /// A new .
+ public Image Rot90() => Rot(Enums.Angle.D90);
+
+ ///
+ /// Rotate 180 degrees.
+ ///
+ /// A new .
+ public Image Rot180() => Rot(Enums.Angle.D180);
+
+ ///
+ /// Rotate 270 degrees clockwise.
+ ///
+ /// A new .
+ public Image Rot270() => Rot(Enums.Angle.D270);
+
+ ///
+ /// Return the largest integral value not greater than the argument.
+ ///
+ /// A new .
+ public Image Floor() => this.Call("round", Enums.OperationRound.Floor) as Image;
+
+ ///
+ /// Return the largest integral value not greater than the argument.
+ ///
+ /// A new .
+ public Image Ceil() => this.Call("round", Enums.OperationRound.Ceil) as Image;
+
+ ///
+ /// Return the nearest integral value.
+ ///
+ /// A new .
+ public Image Rint() => this.Call("round", Enums.OperationRound.Rint) as Image;
+
+ ///
+ /// AND image bands together.
+ ///
+ /// A new .
+ public Image BandAnd() => this.Call("bandbool", Enums.OperationBoolean.And) as Image;
+
+ ///
+ /// OR image bands together.
+ ///
+ /// A new .
+ public Image BandOr() => this.Call("bandbool", Enums.OperationBoolean.Or) as Image;
+
+ ///
+ /// EOR image bands together.
+ ///
+ /// A new .
+ public Image BandEor() => this.Call("bandbool", Enums.OperationBoolean.Eor) as Image;
+
+ ///
+ /// This operation compares two images on equality.
+ ///
+ /// A to compare.
+ /// A new .
+ public Image Equal(Image right) =>
+ this.Call("relational", right, Enums.OperationRelational.Equal) as Image;
+
+ ///
+ /// This operation compares two images on equality.
+ ///
+ /// A double array to compare.
+ /// A new .
+ public Image Equal(double[] right) =>
+ this.Call("relational_const", Enums.OperationRelational.Equal, right) as Image;
+
+ ///
+ /// This operation compares two images on equality.
+ ///
+ /// A integer array to compare.
+ /// A new .
+ public Image Equal(int[] right) =>
+ this.Call("relational_const", Enums.OperationRelational.Equal, right) as Image;
+
+ ///
+ /// This operation compares two images on equality.
+ ///
+ /// A double constant to compare.
+ /// A new .
+ public Image Equal(double right) =>
+ this.Call("relational_const", Enums.OperationRelational.Equal, right) as Image;
+
+ ///
+ /// This operation compares two images on inequality.
+ ///
+ /// A to compare.
+ /// A new .
+ public Image NotEqual(Image right) =>
+ this.Call("relational", right, Enums.OperationRelational.Noteq) as Image;
+
+ ///
+ /// This operation compares two images on inequality.
+ ///
+ /// A double constant to compare.
+ /// A new .
+ public Image NotEqual(double right) =>
+ this.Call("relational_const", Enums.OperationRelational.Noteq, right) as Image;
+
+ ///
+ /// This operation compares two images on inequality.
+ ///
+ /// A double array to compare.
+ /// A new .
+ public Image NotEqual(double[] right) =>
+ this.Call("relational_const", Enums.OperationRelational.Noteq, right) as Image;
+
+ ///
+ /// This operation compares two images on inequality.
+ ///
+ /// A integer array to compare.
+ /// A new .
+ public Image NotEqual(int[] right) =>
+ this.Call("relational_const", Enums.OperationRelational.Noteq, right) as Image;
+
+ ///
+ /// Does this image have an alpha channel?
+ ///
+ ///
+ /// Uses colour space interpretation with number of channels to guess
+ /// this.
+ ///
+ /// if this image has an alpha channel;
+ /// otherwise, .
+ public bool HasAlpha()
+ {
+ // use `vips_image_hasalpha` on libvips >= 8.5.
+ if (NetVips.AtLeastLibvips(8, 5))
+ {
+ return VipsImage.HasAlpha(this);
+ }
+
+ return Bands == 2 ||
+ (Bands == 4 && Interpretation != Enums.Interpretation.Cmyk) ||
+ Bands > 4;
+ }
+
+ ///
+ /// Append an alpha channel to an image.
+ ///
+ ///
+ ///
+ /// using rgba = rgb.AddAlpha();
+ ///
+ ///
+ /// A new .
+ public Image AddAlpha()
+ {
+ // `vips_addalpha` was turned into a VipsOperation in 8.16.
+ if (NetVips.AtLeastLibvips(8, 16))
+ {
+ return this.Call("addalpha") as Image;
+ }
+
+ // use `vips_addalpha` on libvips >= 8.6.
+ if (NetVips.AtLeastLibvips(8, 6))
+ {
+ var result = VipsImage.AddAlpha(this, out var vi);
+ if (result != 0)
+ {
+ throw new VipsException("unable to append an alpha channel");
+ }
+
+ return new Image(vi);
+ }
+
+ var maxAlpha = Interpretation is Enums.Interpretation.Grey16 or Enums.Interpretation.Rgb16
+ ? 65535
+ : 255;
+ return Bandjoin(maxAlpha);
+ }
+
+ ///
+ /// If image has been killed (see ), set an error message,
+ /// clear the `kill` flag and return .
+ /// Otherwise return .
+ ///
+ ///
+ /// Handy for loops which need to run sets of threads which can fail.
+ /// At least libvips 8.8 is needed. If this version requirement is not met,
+ /// it will always return .
+ ///
+ /// if image has been killed;
+ /// otherwise, .
+ public bool IsKilled()
+ {
+ if (!NetVips.AtLeastLibvips(8, 8))
+ {
+ return false;
+ }
+
+ return VipsImage.IsKilled(this);
+ }
+
+ ///
+ /// Set the `kill` flag on an image. Handy for stopping sets of threads.
+ ///
+ ///
+ /// At least libvips 8.8 is needed.
+ ///
+ /// The kill state.
+ public void SetKill(bool kill)
+ {
+ if (!NetVips.AtLeastLibvips(8, 8))
+ {
+ return;
+ }
+
+ VipsImage.SetKill(this, kill);
+ }
+
+ ///
+ /// Connects a callback function () to a signal on this image.
+ ///
+ ///
+ /// The callback will be triggered every time this signal is issued on this image.
+ ///
+ /// A signal to be used on this image. See .
+ /// The callback to connect.
+ /// Data to pass to handler calls.
+ /// The handler id.
+ /// If it failed to connect the signal.
+ public ulong SignalConnect(Enums.Signals signal, EvalDelegate callback, nint data = default)
+ {
+ void EvalMarshal(nint imagePtr, nint progressPtr, nint userDataPtr)
+ {
+ if (imagePtr == IntPtr.Zero || progressPtr == IntPtr.Zero)
+ {
+ return;
+ }
+
+ using var image = new Image(imagePtr);
+ image.ObjectRef();
+
+ var progress = Marshal.PtrToStructure(progressPtr);
+
+ callback.Invoke(image, progress);
+ }
+
+ return signal switch
+ {
+ Enums.Signals.PreEval => SignalConnect("preeval", EvalMarshal, data),
+ Enums.Signals.Eval => SignalConnect("eval", EvalMarshal, data),
+ Enums.Signals.PostEval => SignalConnect("posteval", EvalMarshal, data),
+ _ => throw new ArgumentOutOfRangeException(nameof(signal), signal,
+ $"The value of argument '{nameof(signal)}' ({signal}) is invalid for enum type '{nameof(Enums.Signals)}'.")
+ };
+ }
+
+ ///
+ /// Drop caches on an image, and any downstream images.
+ ///
+ ///
+ /// This method drops all pixel caches on an image and on all downstream
+ /// images. Any operations which depend on this image, directly or
+ /// indirectly, are also dropped from the libvips operation cache.
+ ///
+ /// This method can be useful if you wrap a libvips image around an array
+ /// with
+ /// and then change some bytes without libvips knowing.
+ ///
+ public void Invalidate()
+ {
+ VipsImage.InvalidateAll(this);
+ }
+
+ ///
+ /// Enable progress reporting on an image.
+ ///
+ ///
+ /// When progress reporting is enabled, evaluation of the most downstream
+ /// image from this image will report progress using the ,
+ /// and signals.
+ ///
+ /// to enable progress reporting;
+ /// otherwise, .
+ public void SetProgress(bool progress)
+ {
+ VipsImage.SetProgress(this, progress);
+ }
+
+ ///
+ /// Attach progress feedback, if required.
+ ///
+ ///
+ /// You can use this function to update user-interfaces with
+ /// progress feedback, for example:
+ ///
+ /// using var image = Image.NewFromFile("huge.jpg", access: Enums.Access.Sequential);
+ ///
+ /// var progress = new Progress<int>(percent =>
+ /// {
+ /// Console.Write($"\r{percent}% complete");
+ /// });
+ /// image.SetProgress(progress);
+ ///
+ /// image.Dzsave("image-pyramid");
+ ///
+ ///
+ /// If a cancellation has been requested for this token (see )
+ /// it will block the evaluation of this image on libvips >= 8.8 (see ).
+ /// If this version requirement is not met, it will only stop updating the progress.
+ ///
+ /// A provider for progress updates.
+ /// Cancellation token to block evaluation on this image.
+ public void SetProgress(IProgress progress, CancellationToken token = default)
+ {
+ SetProgress(progress != null);
+ if (progress == null)
+ {
+ return;
+ }
+
+ var lastPercent = 0;
+ var isKilled = false;
+
+ void EvalCallback(Image image, VipsProgress progressStruct)
+ {
+ // Block evaluation on this image if a cancellation
+ // has been requested for this token.
+ if (token.IsCancellationRequested)
+ {
+ if (!isKilled)
+ {
+ image.SetKill(true);
+ isKilled = true;
+ }
+
+ return;
+ }
+
+ if (progressStruct.Percent != lastPercent)
+ {
+ progress.Report(progressStruct.Percent);
+ lastPercent = progressStruct.Percent;
+ }
+ }
+
+ SignalConnect(Enums.Signals.Eval, EvalCallback);
+ }
+
+ #endregion
+
+ #region handwritten properties
+
+ ///
+ /// Multi-page images can have a page height.
+ /// If page-height is not set, it defaults to the image height.
+ ///
+ ///
+ /// At least libvips 8.8 is needed.
+ ///
+ public int PageHeight => VipsImage.GetPageHeight(this);
+
+ #endregion
+
+ #region support with in the most trivial way
+
+ ///
+ /// Does band exist in image.
+ ///
+ /// The index to fetch.
+ /// true if the index exists.
+ public bool BandExists(int i)
+ {
+ return i >= 0 && i <= Bands - 1;
+ }
+
+ ///
+ /// Overload `[]`.
+ ///
+ ///
+ /// Use `[]` to pull out band elements from an image. For example:
+ ///
+ /// using var green = rgbImage[1];
+ ///
+ /// Will make a new one-band image from band 1 (the middle band).
+ ///
+ /// The band element to pull out.
+ /// A new .
+ public Image this[int i] => BandExists(i) ? ExtractBand(i) : null;
+
+ ///
+ /// A synonym for .
+ ///
+ ///
+ ///
+ /// double[] outArray = in[x, y];
+ ///
+ ///
+ /// Point to read.
+ /// Point to read.
+ /// An array of doubles.
+ public double[] this[int x, int y] => Getpoint(x, y);
+
+ ///
+ /// Split an n-band image into n separate images.
+ ///
+ /// An array of .
+ public Image[] Bandsplit()
+ {
+ var images = new Image[Bands];
+ for (var i = 0; i < Bands; i++)
+ {
+ ref var image = ref images[i];
+ image = this[i];
+ }
+
+ return images;
+ }
+
+ ///
+ /// Compares the hashcode of two images.
+ ///
+ /// The to compare.
+ /// if equal; otherwise, .
+ public bool Equals(Image other)
+ {
+ return Equals(GetHashCode(), other.GetHashCode());
+ }
+
+ ///
+ /// Determines whether the specified object is equal to the current image.
+ ///
+ /// The object to compare with the current image.
+ /// if the specified object is equal
+ /// to the current image; otherwise, .
+ public override bool Equals(object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+
+ if (obj.GetType() != GetType())
+ {
+ return false;
+ }
+
+ return Equals((Image)obj);
+ }
+
+ ///
+ /// Serves as the default hash function.
+ ///
+ /// A hash code for the current image.
+ public override int GetHashCode()
+ {
+ return ToString().GetHashCode();
+ }
+
+ #endregion
+}
diff --git a/vendor/NetVips/Internal/Enums.cs b/vendor/NetVips/Internal/Enums.cs
new file mode 100644
index 0000000..5be964a
--- /dev/null
+++ b/vendor/NetVips/Internal/Enums.cs
@@ -0,0 +1,42 @@
+using System;
+
+namespace NetVips.Internal;
+
+internal static class Enums
+{
+ [Flags]
+ internal enum GParamFlags
+ {
+ G_PARAM_READABLE = 1 << 0,
+ G_PARAM_WRITABLE = 1 << 1,
+ G_PARAM_READWRITE = G_PARAM_READABLE | G_PARAM_WRITABLE,
+ G_PARAM_CONSTRUCT = 1 << 2,
+ G_PARAM_CONSTRUCT_ONLY = 1 << 3,
+ G_PARAM_LAX_VALIDATION = 1 << 4,
+ G_PARAM_STATIC_NAME = 1 << 5,
+ G_PARAM_PRIVATE = G_PARAM_STATIC_NAME,
+ G_PARAM_STATIC_NICK = 1 << 6,
+ G_PARAM_STATIC_BLURB = 1 << 7,
+ G_PARAM_EXPLICIT_NOTIFY = 1 << 30,
+ G_PARAM_DEPRECATED = 1 << 31
+ }
+
+ [Flags]
+ internal enum GConnectFlags
+ {
+ G_CONNECT_DEFAULT = 0,
+ G_CONNECT_AFTER = 1 << 0,
+ G_CONNECT_SWAPPED = 1 << 1
+ }
+
+ [Flags]
+ internal enum GSignalMatchType
+ {
+ G_SIGNAL_MATCH_ID = 1 << 0,
+ G_SIGNAL_MATCH_DETAIL = 1 << 1,
+ G_SIGNAL_MATCH_CLOSURE = 1 << 2,
+ G_SIGNAL_MATCH_FUNC = 1 << 3,
+ G_SIGNAL_MATCH_DATA = 1 << 4,
+ G_SIGNAL_MATCH_UNBLOCKED = 1 << 5
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/Internal/GLib.cs b/vendor/NetVips/Internal/GLib.cs
new file mode 100644
index 0000000..7d99196
--- /dev/null
+++ b/vendor/NetVips/Internal/GLib.cs
@@ -0,0 +1,47 @@
+using System.Runtime.InteropServices;
+using System.Security;
+using NetVips.Interop;
+
+using LogLevelFlags = NetVips.Enums.LogLevelFlags;
+
+namespace NetVips.Internal;
+
+internal static class GLib
+{
+ [SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void LogFuncNative([MarshalAs(UnmanagedType.LPStr)] string logDomain,
+ LogLevelFlags flags, nint message, nint userData);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GLib, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_free")]
+ internal static extern void GFree(nint mem);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GLib, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_malloc")]
+ internal static extern nint GMalloc(ulong nBytes);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GLib, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_log_set_handler")]
+ internal static extern uint GLogSetHandler([MarshalAs(UnmanagedType.LPStr)] string logDomain,
+ LogLevelFlags flags, LogFuncNative logFunc, nint userData);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GLib, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_log_remove_handler")]
+ internal static extern void
+ GLogRemoveHandler([MarshalAs(UnmanagedType.LPStr)] string logDomain, uint handlerId);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GLib, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_log_set_always_fatal")]
+ internal static extern LogLevelFlags GLogSetAlwaysFatal(LogLevelFlags fatalMask);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GLib, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_log_set_fatal_mask")]
+ internal static extern LogLevelFlags GLogSetFatalMask(
+ [MarshalAs(UnmanagedType.LPStr)] string logDomain, LogLevelFlags fatalMask);
+}
\ No newline at end of file
diff --git a/vendor/NetVips/Internal/GObject.cs b/vendor/NetVips/Internal/GObject.cs
new file mode 100644
index 0000000..e18b716
--- /dev/null
+++ b/vendor/NetVips/Internal/GObject.cs
@@ -0,0 +1,260 @@
+using System.Runtime.InteropServices;
+using System.Security;
+using NetVips.Interop;
+
+using GObjectManaged = NetVips.GObject;
+using VipsBlobManaged = NetVips.VipsBlob;
+
+namespace NetVips.Internal;
+
+[SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+internal delegate void GWeakNotify(nint data, nint objectPointer);
+
+internal static class GObject
+{
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct Struct
+ {
+ internal nint GTypeInstance;
+
+ internal uint RefCount;
+
+ internal nint QData;
+ }
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_object_set_property")]
+ internal static extern void SetProperty(GObjectManaged @object,
+ [MarshalAs(UnmanagedType.LPStr)] string propertyName, in GValue.Struct value);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_object_get_property")]
+ internal static extern void GetProperty(GObjectManaged @object,
+ [MarshalAs(UnmanagedType.LPStr)] string propertyName, ref GValue.Struct value);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_object_ref")]
+ internal static extern nint Ref(nint @object);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_object_unref")]
+ internal static extern void Unref(nint @object);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_object_weak_ref")]
+ internal static extern void WeakRef(GObjectManaged @object, GWeakNotify notify, nint data);
+}
+
+[StructLayout(LayoutKind.Sequential)]
+internal struct GEnumValue
+{
+ internal int Value;
+
+ [MarshalAs(UnmanagedType.LPStr)]
+ internal string ValueName;
+
+ [MarshalAs(UnmanagedType.LPStr)]
+ internal string ValueNick;
+}
+
+[StructLayout(LayoutKind.Sequential)]
+internal struct GEnumClass
+{
+ internal nint GTypeClass;
+
+ internal int Minimum;
+ internal int Maximum;
+ internal uint NValues;
+
+ internal nint Values;
+}
+
+internal static class GType
+{
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_type_name")]
+ internal static extern nint Name(nint type);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_type_from_name")]
+ internal static extern nint FromName([MarshalAs(UnmanagedType.LPStr)] string name);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_type_fundamental")]
+ internal static extern nint Fundamental(nint typeId);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_type_class_ref")]
+ internal static extern nint ClassRef(nint type);
+}
+
+internal static class GValue
+{
+ [StructLayout(LayoutKind.Explicit, Size = 24)]
+ internal struct Struct
+ {
+ [FieldOffset(0)]
+ internal nint GType;
+
+ [FieldOffset(8)]
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
+ internal nint[] Data;
+ }
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_init")]
+ internal static extern nint Init(ref Struct value, nint gType);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_unset")]
+ internal static extern void Unset(ref Struct value);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_set_boolean")]
+ internal static extern void SetBoolean(ref Struct value, [MarshalAs(UnmanagedType.Bool)] bool vBoolean);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_get_boolean")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool GetBoolean(in Struct value);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_set_int")]
+ internal static extern void SetInt(ref Struct value, int vInt);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_get_int")]
+ internal static extern int GetInt(in Struct value);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_set_uint64")]
+ internal static extern void SetUint64(ref Struct value, ulong vUint64);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_get_uint64")]
+ internal static extern ulong GetUint64(in Struct value);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_set_double")]
+ internal static extern void SetDouble(ref Struct value, double vDouble);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_get_double")]
+ internal static extern double GetDouble(in Struct value);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_set_string")]
+ internal static extern void SetString(ref Struct value, byte[] vString);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_get_string")]
+ internal static extern nint GetString(in Struct value);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_set_enum")]
+ internal static extern void SetEnum(ref Struct value, int vEnum);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_get_enum")]
+ internal static extern int GetEnum(in Struct value);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_set_flags")]
+ internal static extern void SetFlags(ref Struct value, uint vFlags);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_get_flags")]
+ internal static extern uint GetFlags(in Struct value);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_set_object")]
+ internal static extern void SetObject(ref Struct value, GObjectManaged vObject);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_get_object")]
+ internal static extern nint GetObject(in Struct value);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_value_set_boxed")]
+ internal static extern void SetBoxed(ref Struct value, VipsBlobManaged boxed);
+}
+
+internal static class GParamSpec
+{
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct Struct
+ {
+ internal nint GTypeInstance;
+
+ internal nint Name;
+
+ internal Enums.GParamFlags Flags;
+ internal nint ValueType;
+ internal nint OwnerType;
+
+ internal nint Nick;
+ internal nint Blurb;
+ internal nint QData;
+ internal uint RefCount;
+ internal uint ParamId;
+ }
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_param_spec_get_blurb")]
+ internal static extern nint GetBlurb(in Struct pspec);
+}
+
+[SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+internal delegate void GClosureNotify(nint data, nint closure);
+
+internal static class GSignal
+{
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_signal_connect_data")]
+ internal static extern ulong ConnectData(GObjectManaged instance,
+ [MarshalAs(UnmanagedType.LPStr)] string detailedSignal,
+ nint cHandler, nint data,
+ GClosureNotify destroyData, Enums.GConnectFlags connectFlags);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_signal_handler_disconnect")]
+ internal static extern void HandlerDisconnect(GObjectManaged instance, ulong handlerId);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.GObject, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "g_signal_handlers_disconnect_matched")]
+ internal static extern uint HandlersDisconnectMatched(GObjectManaged instance,
+ Enums.GSignalMatchType mask, uint signalId, uint detail, nint closure,
+ nint func, nint data);
+}
\ No newline at end of file
diff --git a/vendor/NetVips/Internal/Vips.cs b/vendor/NetVips/Internal/Vips.cs
new file mode 100644
index 0000000..36c0a4f
--- /dev/null
+++ b/vendor/NetVips/Internal/Vips.cs
@@ -0,0 +1,708 @@
+using System.Runtime.InteropServices;
+using System.Security;
+using System.Text;
+using NetVips.Interop;
+
+using ArgumentFlags = NetVips.Enums.ArgumentFlags;
+using BandFormat = NetVips.Enums.BandFormat;
+using OperationFlags = NetVips.Enums.OperationFlags;
+using VipsBlobManaged = NetVips.VipsBlob;
+using VipsObjectManaged = NetVips.VipsObject;
+
+namespace NetVips.Internal;
+
+internal static class Vips
+{
+ [SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate nint TypeMap2Fn(nint type, nint a, nint b);
+
+ [SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate nint ArgumentMapFn(nint @object, nint pspec, nint argumentClass,
+ nint argumentInstance, nint a, nint b);
+
+ [SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate int CallbackFn(nint a, nint b);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_init")]
+ internal static extern int Init([MarshalAs(UnmanagedType.LPStr)] string argv0);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_shutdown")]
+ internal static extern void Shutdown();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_leak_set")]
+ internal static extern void LeakSet([MarshalAs(UnmanagedType.Bool)] bool leak);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_profile_set")]
+ internal static extern void ProfileSet([MarshalAs(UnmanagedType.Bool)] bool profile);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_cache_get_max")]
+ internal static extern int CacheGetMax();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_cache_set_max")]
+ internal static extern void CacheSetMax(int max);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_cache_get_max_mem")]
+ internal static extern nuint CacheGetMaxMem();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_cache_set_max_mem")]
+ internal static extern void CacheSetMaxMem(ulong maxMem);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_cache_get_max_files")]
+ internal static extern int CacheGetMaxFiles();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_cache_set_max_files")]
+ internal static extern void CacheSetMaxFiles(int maxFiles);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_cache_get_size")]
+ internal static extern int CacheGetSize();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_cache_set_trace")]
+ internal static extern void CacheSetTrace([MarshalAs(UnmanagedType.Bool)] bool trace);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_concurrency_set")]
+ internal static extern void ConcurrencySet(int concurrency);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_concurrency_get")]
+ internal static extern int ConcurrencyGet();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_vector_isenabled")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool VectorIsEnabled();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_vector_set_enabled")]
+ internal static extern void VectorSet([MarshalAs(UnmanagedType.Bool)] bool enabled);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_block_untrusted_set")]
+ internal static extern void BlockUntrustedSet([MarshalAs(UnmanagedType.Bool)] bool state);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_tracked_get_allocs")]
+ internal static extern int TrackedGetAllocs();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_tracked_get_mem")]
+ internal static extern int TrackedGetMem();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_tracked_get_files")]
+ internal static extern int TrackedGetFiles();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_tracked_get_mem_highwater")]
+ internal static extern ulong TrackedGetMemHighwater();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_version")]
+ internal static extern int Version(int flag);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_error_buffer")]
+ internal static extern nint ErrorBuffer();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_error_clear")]
+ internal static extern void ErrorClear();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_error_freeze")]
+ internal static extern void ErrorFreeze();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_error_thaw")]
+ internal static extern void ErrorThaw();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_path_filename7")]
+ internal static extern nint PathFilename7(byte[] path);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_path_mode7")]
+ internal static extern nint PathMode7(byte[] path);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_filename_get_filename")]
+ internal static extern nint GetFilename(byte[] vipsFilename);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_filename_get_options")]
+ internal static extern nint GetOptions(byte[] vipsFilename);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_blend_mode_get_type")]
+ internal static extern nint BlendModeGetType();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_interpretation_get_type")]
+ internal static extern nint InterpretationGetType();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_band_format_get_type")]
+ internal static extern nint BandFormatGetType();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_argument_map")]
+ internal static extern nint ArgumentMap(VipsObjectManaged @object, ArgumentMapFn fn, nint a,
+ nint b);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_type_map")]
+ internal static extern nint TypeMap(nint @base, TypeMap2Fn fn, nint a, nint b);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_type_find")]
+ internal static extern nint TypeFind([MarshalAs(UnmanagedType.LPStr)] string basename,
+ [MarshalAs(UnmanagedType.LPStr)] string nickname);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_nickname_find")]
+ internal static extern nint NicknameFind(nint type);
+
+ internal static string PathFilename7(string path)
+ {
+ var bytes = Encoding.UTF8.GetBytes(path + char.MinValue); // Ensure null-terminated string
+ return PathFilename7(bytes).ToUtf8String();
+ }
+
+ internal static string PathMode7(string path)
+ {
+ var bytes = Encoding.UTF8.GetBytes(path + char.MinValue); // Ensure null-terminated string
+ return PathMode7(bytes).ToUtf8String();
+ }
+}
+
+internal static class VipsObject
+{
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl, EntryPoint = "vips_object_get_args")]
+ internal static extern int GetArgs(VipsObjectManaged @object, out nint names, out nint flags,
+ out int nArgs);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_object_get_argument")]
+ internal static extern int GetArgument(VipsObjectManaged @object,
+ [MarshalAs(UnmanagedType.LPStr)] string name,
+ out nint pspec, out VipsArgumentClass argumentClass,
+ out VipsArgumentInstance argumentInstance);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_object_set_from_string")]
+ internal static extern int SetFromString(VipsObjectManaged @object,
+ [MarshalAs(UnmanagedType.LPStr)] string @string);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl, EntryPoint = "vips_object_print_all")]
+ internal static extern void PrintAll();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_object_unref_outputs")]
+ internal static extern void UnrefOutputs(VipsObjectManaged @object);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_object_get_description")]
+ internal static extern nint GetDescription(VipsObjectManaged @object);
+}
+
+[StructLayout(LayoutKind.Sequential)]
+internal struct VipsArgumentClass
+{
+ internal nint Parent;
+ internal nint ObjectClass;
+ internal ArgumentFlags Flags;
+
+ internal int Priority;
+ internal uint Offset;
+}
+
+[StructLayout(LayoutKind.Sequential)]
+internal struct VipsArgumentInstance
+{
+ internal nint Parent;
+ internal nint ArgumentClass;
+ internal nint Object;
+
+ [MarshalAs(UnmanagedType.Bool)]
+ internal bool Assigned;
+ internal uint CloseId;
+ internal uint InvalidateId;
+}
+
+internal static class VipsBlob
+{
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl, EntryPoint = "vips_blob_get")]
+ internal static extern nint Get(VipsBlobManaged blob, out nuint length);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl, EntryPoint = "vips_blob_copy")]
+ internal static extern unsafe nint Copy(void* data, nuint length);
+}
+
+internal static class VipsArea
+{
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct Struct
+ {
+ internal nint Data;
+ internal nuint Length;
+
+ internal int N;
+
+ // private
+
+ internal int Count;
+ internal nint Lock;
+
+ internal Vips.CallbackFn FreeFn;
+ internal nint Client;
+
+ internal nint Type;
+ internal nuint SizeofType;
+ }
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl, EntryPoint = "vips_area_unref")]
+ internal static extern nint Unref(nint blob);
+}
+
+internal static class VipsValue
+{
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_value_get_ref_string")]
+ internal static extern nint GetRefString(in GValue.Struct value, out ulong length);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_value_set_ref_string")]
+ internal static extern void SetRefString(ref GValue.Struct value, byte[] str);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_value_get_blob")]
+ internal static extern nint GetBlob(in GValue.Struct value, out ulong length);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_value_set_blob")]
+ internal static extern void SetBlob(ref GValue.Struct value, Vips.CallbackFn freeFn,
+ nint data, ulong length);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_value_set_blob_free")]
+ internal static extern void SetBlobFree(ref GValue.Struct value, nint data,
+ ulong length);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_value_get_array_double")]
+ internal static extern nint GetArrayDouble(in GValue.Struct value, out int n);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_value_set_array_double")]
+ internal static extern void SetArrayDouble(ref GValue.Struct value,
+ [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)]
+ double[] array, int n);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_value_get_array_int")]
+ internal static extern nint GetArrayInt(in GValue.Struct value, out int n);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_value_set_array_int")]
+ internal static extern void SetArrayInt(ref GValue.Struct value,
+ [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)]
+ int[] array, int n);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_value_get_array_image")]
+ internal static extern nint GetArrayImage(in GValue.Struct value, out int n);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_value_set_array_image")]
+ internal static extern void SetArrayImage(ref GValue.Struct value, int n);
+}
+
+internal static class VipsImage
+{
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_get_page_height")]
+ internal static extern int GetPageHeight(Image image);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_invalidate_all")]
+ internal static extern void InvalidateAll(Image image);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_set_progress")]
+ internal static extern void SetProgress(Image image, [MarshalAs(UnmanagedType.Bool)] bool progress);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_iskilled")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool IsKilled(Image image);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_set_kill")]
+ internal static extern void SetKill(Image image, [MarshalAs(UnmanagedType.Bool)] bool kill);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_new_from_memory")]
+ internal static extern nint NewFromMemory(nint data, nuint size, int width, int height,
+ int bands, BandFormat format);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_new_from_memory")]
+ internal static extern unsafe nint NewFromMemory(void* data, nuint size, int width, int height,
+ int bands, BandFormat format);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_new_from_memory_copy")]
+ internal static extern nint NewFromMemoryCopy(nint data, nuint size, int width, int height,
+ int bands, BandFormat format);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_new_from_memory_copy")]
+ internal static extern unsafe nint NewFromMemoryCopy(void* data, nuint size, int width, int height,
+ int bands, BandFormat format);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_new_matrix_from_array")]
+ internal static extern nint NewMatrixFromArray(int width, int height, double[] array, int size);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_new_temp_file")]
+ internal static extern nint NewTempFile(byte[] format);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_write")]
+ internal static extern int Write(Image image, Image @out);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_write_to_memory")]
+ internal static extern nint WriteToMemory(Image @in, out ulong size);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_hasalpha")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool HasAlpha(Image image);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_addalpha")]
+ internal static extern int AddAlpha(Image image, out nint @out, nint sentinel = default);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_copy_memory")]
+ internal static extern nint CopyMemory(Image image);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl, EntryPoint = "vips_image_set")]
+ internal static extern void Set(Image image, [MarshalAs(UnmanagedType.LPStr)] string name,
+ in GValue.Struct value);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl, EntryPoint = "vips_image_get")]
+ internal static extern int Get(Image image, [MarshalAs(UnmanagedType.LPStr)] string name,
+ out GValue.Struct valueCopy);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_get_typeof")]
+ internal static extern nint GetTypeof(Image image, [MarshalAs(UnmanagedType.LPStr)] string name);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_remove")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool Remove(Image image, [MarshalAs(UnmanagedType.LPStr)] string name);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_image_get_fields")]
+ internal static extern nint GetFields(Image image);
+}
+
+internal static class VipsInterpolate
+{
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_interpolate_new")]
+ internal static extern nint New([MarshalAs(UnmanagedType.LPStr)] string nickname);
+}
+
+internal static class VipsRegion
+{
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_region_new")]
+ internal static extern nint New(Image image);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_region_fetch")]
+ internal static extern nint Fetch(Region region, int left, int top, int width, int height, out ulong length);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_region_width")]
+ internal static extern int Width(Region region);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_region_height")]
+ internal static extern int Height(Region region);
+}
+
+internal static class VipsOperation
+{
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_operation_get_flags")]
+ internal static extern OperationFlags GetFlags(Operation operation);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_operation_new")]
+ internal static extern nint New([MarshalAs(UnmanagedType.LPStr)] string name);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_cache_operation_build")]
+ internal static extern nint Build(Operation operation);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_operation_flags_get_type")]
+ internal static extern nint FlagsGetType();
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_operation_block_set")]
+ internal static extern void BlockSet([MarshalAs(UnmanagedType.LPStr)] string name,
+ [MarshalAs(UnmanagedType.Bool)] bool state);
+}
+
+internal static class VipsForeign
+{
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_foreign_find_load")]
+ internal static extern nint FindLoad(nint filename);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_foreign_find_load")]
+ internal static extern nint FindLoad(byte[] filename);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_foreign_find_load_buffer")]
+ internal static extern nint FindLoadBuffer(byte[] data, ulong size);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_foreign_find_load_buffer")]
+ internal static extern nint FindLoadBuffer(nint data, ulong size);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_foreign_find_load_buffer")]
+ internal static extern unsafe nint FindLoadBuffer(void* data, ulong size);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_foreign_find_load_source")]
+ internal static extern nint FindLoadSource(Source stream);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_foreign_find_save")]
+ internal static extern nint FindSave(nint filename);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_foreign_find_save_buffer")]
+ internal static extern nint FindSaveBuffer(byte[] name);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_foreign_find_save_target")]
+ internal static extern nint FindSaveTarget(byte[] name);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_foreign_get_suffixes")]
+ internal static extern nint GetSuffixes();
+}
+
+internal static class VipsConnection
+{
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_connection_filename")]
+ internal static extern nint FileName(Connection connection);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl, EntryPoint = "vips_connection_nick")]
+ internal static extern nint Nick(Connection connection);
+}
+
+internal static class VipsSource
+{
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_source_new_from_descriptor")]
+ internal static extern nint NewFromDescriptor(int descriptor);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_source_new_from_file")]
+ internal static extern nint NewFromFile(byte[] filename);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_source_new_from_blob")]
+ internal static extern nint NewFromBlob(VipsBlobManaged blob);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_source_new_from_memory")]
+ internal static extern nint NewFromMemory(nint data, nuint size);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl, EntryPoint = "vips_source_map_blob")]
+ internal static extern nint MapBlob(Source source);
+}
+
+internal static class VipsSourceCustom
+{
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_source_custom_new")]
+ internal static extern nint New();
+
+ [SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate long ReadSignal(nint sourcePtr, nint buffer, long length, nint userDataPtr);
+
+ [SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate long SeekSignal(nint sourcePtr, long offset, int whence, nint userDataPtr);
+}
+
+internal static class VipsTarget
+{
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_target_new_to_descriptor")]
+ internal static extern nint NewToDescriptor(int descriptor);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_target_new_to_file")]
+ internal static extern nint NewToFile(byte[] filename);
+
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_target_new_to_memory")]
+ internal static extern nint NewToMemory();
+}
+
+internal static class VipsTargetCustom
+{
+ [SuppressUnmanagedCodeSecurity]
+ [DllImport(Libraries.Vips, CallingConvention = CallingConvention.Cdecl,
+ EntryPoint = "vips_target_custom_new")]
+ internal static extern nint New();
+
+ [SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate long WriteSignal(nint targetPtr,
+ [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)]
+ byte[] buffer, int length, nint userDataPtr);
+
+ [SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate long ReadSignal(nint targetPtr, nint buffer, long length, nint userDataPtr);
+
+ [SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate long SeekSignal(nint targetPtr, long offset, int whence, nint userDataPtr);
+
+ [SuppressUnmanagedCodeSecurity, UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate int EndSignal(nint targetPtr, nint userDataPtr);
+}
\ No newline at end of file
diff --git a/vendor/NetVips/Interop/Libraries.cs b/vendor/NetVips/Interop/Libraries.cs
new file mode 100644
index 0000000..8c63eed
--- /dev/null
+++ b/vendor/NetVips/Interop/Libraries.cs
@@ -0,0 +1,12 @@
+namespace NetVips.Interop;
+
+internal static class Libraries
+{
+ ///
+ /// These library names are remapped in a cross-platform manner,
+ /// .
+ ///
+ internal const string GLib = "libglib-2.0-0.dll",
+ GObject = "libgobject-2.0-0.dll",
+ Vips = "libvips-42.dll";
+}
\ No newline at end of file
diff --git a/vendor/NetVips/Interpolate.cs b/vendor/NetVips/Interpolate.cs
new file mode 100644
index 0000000..46daf4d
--- /dev/null
+++ b/vendor/NetVips/Interpolate.cs
@@ -0,0 +1,43 @@
+using System;
+using NetVips.Internal;
+
+namespace NetVips;
+
+///
+/// Make interpolators for operators like .
+///
+public class Interpolate : VipsObject
+{
+ private Interpolate(nint pointer) : base(pointer)
+ {
+ }
+
+ ///
+ /// Make a new interpolator by name.
+ ///
+ ///
+ /// Make a new interpolator from the libvips class nickname. For example:
+ ///
+ /// var inter = Interpolate.NewFromName("bicubic");
+ ///
+ /// You can get a list of all supported interpolators from the command-line
+ /// with:
+ ///
+ /// $ vips -l interpolate
+ ///
+ /// See for example .
+ ///
+ /// libvips class nickname.
+ /// A new .
+ /// If unable to make a new interpolator from .
+ public static Interpolate NewFromName(string name)
+ {
+ var vi = VipsInterpolate.New(name);
+ if (vi == IntPtr.Zero)
+ {
+ throw new VipsException($"no such interpolator {name}");
+ }
+
+ return new Interpolate(vi);
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/Introspect.cs b/vendor/NetVips/Introspect.cs
new file mode 100644
index 0000000..7dc2a21
--- /dev/null
+++ b/vendor/NetVips/Introspect.cs
@@ -0,0 +1,219 @@
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using NetVips.Internal;
+
+namespace NetVips;
+
+///
+/// Build introspection data for operations.
+///
+///
+/// Make an operation, introspect it, and build a structure representing
+/// everything we know about it.
+///
+public class Introspect
+{
+ ///
+ /// A cache for introspection data.
+ ///
+ private static readonly ConcurrentDictionary IntrospectCache = new();
+
+ ///
+ /// An object structure that encapsulates the metadata
+ /// required to specify arguments.
+ ///
+ public struct Argument
+ {
+ ///
+ /// Name of this argument.
+ ///
+ public string Name;
+
+ ///
+ /// Flags for this argument.
+ ///
+ public Enums.ArgumentFlags Flags;
+
+ ///
+ /// The GType for this argument.
+ ///
+ public nint Type;
+ }
+
+ ///
+ /// The first required input image or .
+ ///
+ public Argument? MemberX;
+
+ ///
+ /// A bool indicating if this operation is mutable.
+ ///
+ public readonly bool Mutable;
+
+ ///
+ /// The required input for this operation.
+ ///
+ public readonly List RequiredInput = new();
+
+ ///
+ /// The optional input for this operation.
+ ///
+ public readonly Dictionary OptionalInput = new();
+
+ ///
+ /// The required output for this operation.
+ ///
+ public readonly List RequiredOutput = new();
+
+ ///
+ /// The optional output for this operation.
+ ///
+ public readonly Dictionary OptionalOutput = new();
+
+ ///
+ /// Build introspection data for a specified operation name.
+ ///
+ /// The operation name to introspect.
+ private Introspect(string operationName)
+ {
+ using var op = Operation.NewFromName(operationName);
+ var arguments = GetArgs(op);
+
+ foreach (var entry in arguments)
+ {
+ var name = entry.Key;
+ var flag = entry.Value;
+ var gtype = op.GetTypeOf(name);
+
+ var details = new Argument
+ {
+ Name = name,
+ Flags = flag,
+ Type = gtype
+ };
+
+ if ((flag & Enums.ArgumentFlags.INPUT) != 0)
+ {
+ if ((flag & Enums.ArgumentFlags.REQUIRED) != 0 &&
+ (flag & Enums.ArgumentFlags.DEPRECATED) == 0)
+ {
+ // the first required input image arg will be self
+ if (!MemberX.HasValue && gtype == GValue.ImageType)
+ {
+ MemberX = details;
+ }
+ else
+ {
+ RequiredInput.Add(details);
+ }
+ }
+ else
+ {
+ // we allow deprecated optional args
+ OptionalInput[name] = details;
+ }
+
+ // modified input arguments count as mutable.
+ if ((flag & Enums.ArgumentFlags.MODIFY) != 0 &&
+ (flag & Enums.ArgumentFlags.REQUIRED) != 0 &&
+ (flag & Enums.ArgumentFlags.DEPRECATED) == 0)
+ {
+ Mutable = true;
+ }
+ }
+ else if ((flag & Enums.ArgumentFlags.OUTPUT) != 0)
+ {
+ if ((flag & Enums.ArgumentFlags.REQUIRED) != 0 &&
+ (flag & Enums.ArgumentFlags.DEPRECATED) == 0)
+ {
+ RequiredOutput.Add(details);
+ }
+ else
+ {
+ // again, allow deprecated optional args
+ OptionalOutput[name] = details;
+ }
+ }
+ }
+ }
+
+ ///
+ /// Get all arguments for an operation.
+ ///
+ ///
+ /// Not quick! Try to call this infrequently.
+ ///
+ /// Operation to lookup.
+ /// Arguments for the operation.
+ private IEnumerable> GetArgs(Operation operation)
+ {
+ var args = new List>();
+
+ void AddArg(string name, Enums.ArgumentFlags flags)
+ {
+ // libvips uses '-' to separate parts of arg names, but we
+ // need '_' for C#
+ name = name.Replace("-", "_");
+
+ args.Add(new KeyValuePair(name, flags));
+ }
+
+ // vips_object_get_args was added in 8.7
+ if (NetVips.AtLeastLibvips(8, 7))
+ {
+ var result = Internal.VipsObject.GetArgs(operation, out var names, out var flags, out var nArgs);
+
+ if (result != 0)
+ {
+ throw new VipsException("unable to get arguments from operation");
+ }
+
+ for (var i = 0; i < nArgs; i++)
+ {
+ var flag = (Enums.ArgumentFlags)Marshal.PtrToStructure(flags + i * sizeof(int));
+ if ((flag & Enums.ArgumentFlags.CONSTRUCT) == 0)
+ {
+ continue;
+ }
+
+ var name = Marshal.PtrToStringAnsi(Marshal.ReadIntPtr(names, i * IntPtr.Size));
+
+ AddArg(name, flag);
+ }
+ }
+ else
+ {
+ nint AddConstruct(nint self, nint pspec, nint argumentClass, nint argumentInstance,
+ nint a, nint b)
+ {
+ var flags = Marshal.PtrToStructure(argumentClass).Flags;
+ if ((flags & Enums.ArgumentFlags.CONSTRUCT) == 0)
+ {
+ return IntPtr.Zero;
+ }
+
+ var name = Marshal.PtrToStringAnsi(Marshal.PtrToStructure(pspec).Name);
+
+ AddArg(name, flags);
+
+ return IntPtr.Zero;
+ }
+
+ Vips.ArgumentMap(operation, AddConstruct, IntPtr.Zero, IntPtr.Zero);
+ }
+
+ return args;
+ }
+
+ ///
+ /// Get introspection data for a specified operation name.
+ ///
+ /// Operation name.
+ /// Introspection data.
+ public static Introspect Get(string operationName)
+ {
+ return IntrospectCache.GetOrAdd(operationName, name => new Introspect(name));
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/LICENSE b/vendor/NetVips/LICENSE
new file mode 100644
index 0000000..c1df61d
--- /dev/null
+++ b/vendor/NetVips/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018-present Kleis Auke Wolthuizen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/NetVips/Log.cs b/vendor/NetVips/Log.cs
new file mode 100644
index 0000000..361005c
--- /dev/null
+++ b/vendor/NetVips/Log.cs
@@ -0,0 +1,137 @@
+using System;
+using System.Collections.Concurrent;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using NetVips.Internal;
+
+namespace NetVips;
+
+///
+/// Wrapper for message logging functions.
+///
+public static class Log
+{
+ private static GLib.LogFuncNative _nativeHandler;
+
+ ///
+ /// Specifies the prototype of log handler functions.
+ ///
+ /// The log domain of the message.
+ /// The log level of the message (including the fatal and recursion flags).
+ /// The message to process.
+ public delegate void LogDelegate(string logDomain, Enums.LogLevelFlags logLevel, string message);
+
+ private static void NativeCallback(string logDomain, Enums.LogLevelFlags flags, nint messagePtr,
+ nint userData)
+ {
+ if (userData == IntPtr.Zero)
+ {
+ return;
+ }
+
+ var message = messagePtr.ToUtf8String();
+ var gch = (GCHandle)userData;
+ if (gch.Target is LogDelegate func)
+ {
+ func(logDomain, flags, message);
+ }
+ }
+
+ private static readonly ConcurrentDictionary Handlers = new();
+
+ ///
+ /// Sets the log handler for a domain and a set of log levels.
+ ///
+ /// The log domain, or for the default "" application domain.
+ /// The log levels to apply the log handler for.
+ /// The log handler function.
+ /// The id of the handler.
+ public static uint SetLogHandler(string logDomain, Enums.LogLevelFlags flags, LogDelegate logFunc)
+ {
+ _nativeHandler ??= NativeCallback;
+
+ var gch = GCHandle.Alloc(logFunc);
+ var result = GLib.GLogSetHandler(logDomain, flags, _nativeHandler, (nint)gch);
+ Handlers.AddOrUpdate(result, gch, (_, _) => gch);
+ return result;
+ }
+
+ ///
+ /// Removes the log handler.
+ ///
+ /// The log domain.
+ /// The id of the handler, which was returned in .
+ public static void RemoveLogHandler(string logDomain, uint handlerId)
+ {
+ if (Handlers != null &&
+ Handlers.ContainsKey(handlerId) &&
+ Handlers.TryRemove(handlerId, out var handler))
+ {
+ handler.Free();
+ }
+
+ GLib.GLogRemoveHandler(logDomain, handlerId);
+ }
+
+ ///
+ /// Sets the message levels which are always fatal, in any log domain.
+ /// When a message with any of these levels is logged the program terminates.
+ ///
+ /// The mask containing bits set for each level of error which is to be fatal.
+ /// The old fatal mask.
+ public static Enums.LogLevelFlags SetAlwaysFatal(Enums.LogLevelFlags fatalMask)
+ {
+ return GLib.GLogSetAlwaysFatal(fatalMask);
+ }
+
+ ///
+ /// Sets the log levels which are fatal in the given domain.
+ ///
+ /// The log domain.
+ /// The new fatal mask.
+ /// The old fatal mask for the log domain.
+ public static Enums.LogLevelFlags SetAlwaysFatal(string logDomain, Enums.LogLevelFlags fatalMask)
+ {
+ return GLib.GLogSetFatalMask(logDomain, fatalMask);
+ }
+
+ ///
+ /// Common logging method.
+ ///
+ ///
+ /// Sample usage:
+ ///
+ /// // Print the messages for the NULL domain
+ /// var logFunc = new LogFunc(Log.PrintLogFunction);
+ /// Log.SetLogHandler(null, Enums.LogLevelFlags.All, logFunc);
+ ///
+ ///
+ /// The log domain of the message.
+ /// The log level of the message (including the fatal and recursion flags).
+ /// The message to process.
+ public static void PrintLogFunction(string domain, Enums.LogLevelFlags level, string message)
+ {
+ Console.WriteLine("Domain: '{0}' Level: {1}", domain, level);
+ Console.WriteLine("Message: {0}", message);
+ }
+
+ ///
+ /// Common logging method.
+ ///
+ ///
+ /// Sample usage:
+ ///
+ /// // Print messages and stack trace for vips critical messages
+ /// var logFunc = new LogFunc(Log.PrintTraceLogFunction);
+ /// Log.SetLogHandler("VIPS", Enums.LogLevelFlags.Critical, logFunc);
+ ///
+ ///
+ /// The log domain of the message.
+ /// The log level of the message (including the fatal and recursion flags).
+ /// The message to process.
+ public static void PrintTraceLogFunction(string domain, Enums.LogLevelFlags level, string message)
+ {
+ PrintLogFunction(domain, level, message);
+ Console.WriteLine("Trace follows:\n{0}", new StackTrace());
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/ModuleInitializer.cs b/vendor/NetVips/ModuleInitializer.cs
new file mode 100644
index 0000000..bb7e742
--- /dev/null
+++ b/vendor/NetVips/ModuleInitializer.cs
@@ -0,0 +1,139 @@
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using NetVips.Interop;
+
+namespace NetVips;
+
+///
+/// All code inside the method is ran as soon as the assembly is loaded.
+///
+public static class ModuleInitializer
+{
+ ///
+ /// Is vips initialized?
+ ///
+ public static bool VipsInitialized;
+
+ ///
+ /// Contains the exception when initialization of libvips fails.
+ ///
+ public static Exception Exception;
+
+ ///
+ /// Could contain the version number of libvips in an 3-bytes integer.
+ ///
+ public static int? Version;
+
+#if NET6_0_OR_GREATER
+ ///
+ /// Windows specific: is GLib statically-linked in `libvips-42.dll`?
+ ///
+ [System.Runtime.Versioning.SupportedOSPlatform("windows")]
+ private static bool _gLibStaticallyLinked = true;
+
+ ///
+ /// A cache for .
+ ///
+ internal static readonly Dictionary DllImportCache = new();
+
+ internal static string RemapLibraryName(string libraryName)
+ {
+ // For Windows, we try to locate the GLib symbols within
+ // `libvips-42.dll` first. If these symbols cannot be found there,
+ // we proceed to locate them within `libglib-2.0-0.dll` and
+ // `libgobject-2.0-0.dll`. Note that this is only possible when
+ // targeting .NET 6 or higher. As a result, we always ship at least
+ // 3 DLLs in a separate package for .NET Framework.
+ if (OperatingSystem.IsWindows())
+ {
+ return _gLibStaticallyLinked ? Libraries.Vips : libraryName;
+ }
+
+ // FIXME: Switch to `OperatingSystem.IsApplePlatform()` once public.
+ // See: https://github.com/dotnet/runtime/issues/113262
+ var isApplePlatform = OperatingSystem.IsMacOS() || OperatingSystem.IsIOS() ||
+ OperatingSystem.IsTvOS() || OperatingSystem.IsWatchOS();
+
+ // We can safely remap the library names to `libvips.so.42` on *nix
+ // and `libvips.42.dylib` on macOS since DLLImport uses dlsym() there.
+ // This function also searches for named symbols in the dependencies
+ // of the shared library. Therefore, we can provide libvips as a
+ // single shared library with all dependencies statically linked
+ // without breaking compatibility with the shared builds
+ // (i.e. what is usually installed via package managers).
+ return isApplePlatform ? "libvips.42.dylib" : "libvips.so.42";
+ }
+
+ internal static nint DllImportResolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
+ {
+ libraryName = RemapLibraryName(libraryName);
+ if (DllImportCache.TryGetValue(libraryName, out var cachedHandle))
+ {
+ return cachedHandle;
+ }
+
+ var handle = NativeLibrary.Load(libraryName, assembly, searchPath);
+ DllImportCache[libraryName] = handle;
+
+ return handle;
+ }
+#endif
+
+ ///
+ /// Initializes the module.
+ ///
+#pragma warning disable CA2255
+ [System.Runtime.CompilerServices.ModuleInitializer]
+#pragma warning restore CA2255
+ public static void Initialize()
+ {
+#if NET6_0_OR_GREATER
+ try
+ {
+ NativeLibrary.SetDllImportResolver(typeof(ModuleInitializer).Assembly, DllImportResolver);
+ }
+ catch
+ {
+ // Ignored; allows this function to be called multiple times.
+ }
+#endif
+
+ try
+ {
+ VipsInitialized = NetVips.Init();
+ if (VipsInitialized)
+ {
+ Version = NetVips.Version(0, false);
+ Version = (Version << 8) + NetVips.Version(1, false);
+ Version = (Version << 8) + NetVips.Version(2, false);
+
+#if NET6_0_OR_GREATER
+ if (!OperatingSystem.IsWindows())
+ {
+ return;
+ }
+
+ try
+ {
+ _gLibStaticallyLinked = NetVips.TypeFromName("VipsImage") != IntPtr.Zero;
+ }
+ catch
+ {
+ _gLibStaticallyLinked = false;
+ }
+#endif
+ }
+ else
+ {
+ Exception = new VipsException("unable to initialize libvips");
+ }
+ }
+ catch (Exception e)
+ {
+ VipsInitialized = false;
+ Exception = e;
+ }
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/ModuleInitializerAttribute.cs b/vendor/NetVips/ModuleInitializerAttribute.cs
new file mode 100644
index 0000000..4ad320c
--- /dev/null
+++ b/vendor/NetVips/ModuleInitializerAttribute.cs
@@ -0,0 +1,11 @@
+// This file enables ModuleInitializer, a C# 9 feature to work with .NET Framework.
+
+#if NETFRAMEWORK
+namespace System.Runtime.CompilerServices;
+
+///
+[AttributeUsage(AttributeTargets.Method, Inherited = false)]
+internal sealed class ModuleInitializerAttribute : Attribute
+{
+}
+#endif
\ No newline at end of file
diff --git a/vendor/NetVips/MutableImage.Generated.cs b/vendor/NetVips/MutableImage.Generated.cs
new file mode 100644
index 0000000..e09ea90
--- /dev/null
+++ b/vendor/NetVips/MutableImage.Generated.cs
@@ -0,0 +1,293 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// libvips version: 8.17.0
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace NetVips;
+
+public sealed partial class MutableImage
+{
+ #region auto-generated functions
+
+ ///
+ /// Draw a circle on an image.
+ ///
+ ///
+ ///
+ /// image.Mutate(x => x.DrawCircle(ink, cx, cy, radius, fill: bool));
+ ///
+ ///
+ /// Color for pixels.
+ /// Centre of draw_circle.
+ /// Centre of draw_circle.
+ /// Radius in pixels.
+ /// Draw a solid object.
+ public void DrawCircle(double[] ink, int cx, int cy, int radius, bool? fill = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(fill), fill);
+
+ this.Call("draw_circle", options, ink, cx, cy, radius);
+ }
+
+ ///
+ /// Flood-fill an area.
+ ///
+ ///
+ ///
+ /// image.Mutate(x => x.DrawFlood(ink, x, y, test: Image, equal: bool));
+ ///
+ ///
+ /// Color for pixels.
+ /// DrawFlood start point.
+ /// DrawFlood start point.
+ /// Test pixels in this image.
+ /// DrawFlood while equal to edge.
+ public void DrawFlood(double[] ink, int x, int y, Image test = null, bool? equal = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(test), test);
+ options.AddIfPresent(nameof(equal), equal);
+
+ this.Call("draw_flood", options, ink, x, y);
+ }
+
+ ///
+ /// Flood-fill an area.
+ ///
+ ///
+ ///
+ /// image.Mutate(x => x.DrawFlood(ink, x, y, out var left, test: Image, equal: bool));
+ ///
+ ///
+ /// Color for pixels.
+ /// DrawFlood start point.
+ /// DrawFlood start point.
+ /// Left edge of modified area.
+ /// Test pixels in this image.
+ /// DrawFlood while equal to edge.
+ public void DrawFlood(double[] ink, int x, int y, out int left, Image test = null, bool? equal = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(test), test);
+ options.AddIfPresent(nameof(equal), equal);
+
+ options.Add("left", true);
+
+ var results = this.Call("draw_flood", options, ink, x, y) as object[];
+
+ var opts = results?[1] as VOption;
+ left = opts?["left"] is int out1 ? out1 : 0;
+ }
+
+ ///
+ /// Flood-fill an area.
+ ///
+ ///
+ ///
+ /// image.Mutate(x => x.DrawFlood(ink, x, y, out var left, out var top, test: Image, equal: bool));
+ ///
+ ///
+ /// Color for pixels.
+ /// DrawFlood start point.
+ /// DrawFlood start point.
+ /// Left edge of modified area.
+ /// Top edge of modified area.
+ /// Test pixels in this image.
+ /// DrawFlood while equal to edge.
+ public void DrawFlood(double[] ink, int x, int y, out int left, out int top, Image test = null, bool? equal = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(test), test);
+ options.AddIfPresent(nameof(equal), equal);
+
+ options.Add("left", true);
+ options.Add("top", true);
+
+ var results = this.Call("draw_flood", options, ink, x, y) as object[];
+
+ var opts = results?[1] as VOption;
+ left = opts?["left"] is int out1 ? out1 : 0;
+ top = opts?["top"] is int out2 ? out2 : 0;
+ }
+
+ ///
+ /// Flood-fill an area.
+ ///
+ ///
+ ///
+ /// image.Mutate(x => x.DrawFlood(ink, x, y, out var left, out var top, out var width, test: Image, equal: bool));
+ ///
+ ///
+ /// Color for pixels.
+ /// DrawFlood start point.
+ /// DrawFlood start point.
+ /// Left edge of modified area.
+ /// Top edge of modified area.
+ /// Width of modified area.
+ /// Test pixels in this image.
+ /// DrawFlood while equal to edge.
+ public void DrawFlood(double[] ink, int x, int y, out int left, out int top, out int width, Image test = null, bool? equal = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(test), test);
+ options.AddIfPresent(nameof(equal), equal);
+
+ options.Add("left", true);
+ options.Add("top", true);
+ options.Add("width", true);
+
+ var results = this.Call("draw_flood", options, ink, x, y) as object[];
+
+ var opts = results?[1] as VOption;
+ left = opts?["left"] is int out1 ? out1 : 0;
+ top = opts?["top"] is int out2 ? out2 : 0;
+ width = opts?["width"] is int out3 ? out3 : 0;
+ }
+
+ ///
+ /// Flood-fill an area.
+ ///
+ ///
+ ///
+ /// image.Mutate(x => x.DrawFlood(ink, x, y, out var left, out var top, out var width, out var height, test: Image, equal: bool));
+ ///
+ ///
+ /// Color for pixels.
+ /// DrawFlood start point.
+ /// DrawFlood start point.
+ /// Left edge of modified area.
+ /// Top edge of modified area.
+ /// Width of modified area.
+ /// Height of modified area.
+ /// Test pixels in this image.
+ /// DrawFlood while equal to edge.
+ public void DrawFlood(double[] ink, int x, int y, out int left, out int top, out int width, out int height, Image test = null, bool? equal = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(test), test);
+ options.AddIfPresent(nameof(equal), equal);
+
+ options.Add("left", true);
+ options.Add("top", true);
+ options.Add("width", true);
+ options.Add("height", true);
+
+ var results = this.Call("draw_flood", options, ink, x, y) as object[];
+
+ var opts = results?[1] as VOption;
+ left = opts?["left"] is int out1 ? out1 : 0;
+ top = opts?["top"] is int out2 ? out2 : 0;
+ width = opts?["width"] is int out3 ? out3 : 0;
+ height = opts?["height"] is int out4 ? out4 : 0;
+ }
+
+ ///
+ /// Paint an image into another image.
+ ///
+ ///
+ ///
+ /// image.Mutate(x => x.DrawImage(sub, x, y, mode: Enums.CombineMode));
+ ///
+ ///
+ /// Sub-image to insert into main image.
+ /// Draw image here.
+ /// Draw image here.
+ /// Combining mode.
+ public void DrawImage(Image sub, int x, int y, Enums.CombineMode? mode = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(mode), mode);
+
+ this.Call("draw_image", options, sub, x, y);
+ }
+
+ ///
+ /// Draw a line on an image.
+ ///
+ ///
+ ///
+ /// image.Mutate(x => x.DrawLine(ink, x1, y1, x2, y2));
+ ///
+ ///
+ /// Color for pixels.
+ /// Start of draw_line.
+ /// Start of draw_line.
+ /// End of draw_line.
+ /// End of draw_line.
+ public void DrawLine(double[] ink, int x1, int y1, int x2, int y2)
+ {
+ this.Call("draw_line", ink, x1, y1, x2, y2);
+ }
+
+ ///
+ /// Draw a mask on an image.
+ ///
+ ///
+ ///
+ /// image.Mutate(x => x.DrawMask(ink, mask, x, y));
+ ///
+ ///
+ /// Color for pixels.
+ /// Mask of pixels to draw.
+ /// Draw mask here.
+ /// Draw mask here.
+ public void DrawMask(double[] ink, Image mask, int x, int y)
+ {
+ this.Call("draw_mask", ink, mask, x, y);
+ }
+
+ ///
+ /// Paint a rectangle on an image.
+ ///
+ ///
+ ///
+ /// image.Mutate(x => x.DrawRect(ink, left, top, width, height, fill: bool));
+ ///
+ ///
+ /// Color for pixels.
+ /// Rect to fill.
+ /// Rect to fill.
+ /// Rect to fill.
+ /// Rect to fill.
+ /// Draw a solid object.
+ public void DrawRect(double[] ink, int left, int top, int width, int height, bool? fill = null)
+ {
+ var options = new VOption();
+
+ options.AddIfPresent(nameof(fill), fill);
+
+ this.Call("draw_rect", options, ink, left, top, width, height);
+ }
+
+ ///
+ /// Blur a rectangle on an image.
+ ///
+ ///
+ ///
+ /// image.Mutate(x => x.DrawSmudge(left, top, width, height));
+ ///
+ ///
+ /// Rect to fill.
+ /// Rect to fill.
+ /// Rect to fill.
+ /// Rect to fill.
+ public void DrawSmudge(int left, int top, int width, int height)
+ {
+ this.Call("draw_smudge", left, top, width, height);
+ }
+
+ #endregion
+}
\ No newline at end of file
diff --git a/vendor/NetVips/MutableImage.cs b/vendor/NetVips/MutableImage.cs
new file mode 100644
index 0000000..5150397
--- /dev/null
+++ b/vendor/NetVips/MutableImage.cs
@@ -0,0 +1,153 @@
+using System;
+using NetVips.Internal;
+
+using SMath = System.Math;
+
+namespace NetVips;
+
+///
+/// This class represents a libvips image which can be modified. See
+/// .
+///
+public sealed partial class MutableImage : Image
+{
+ ///
+ /// The this is modifying.
+ /// Only use this once you have finished all modifications.
+ ///
+ internal Image Image { get; private set; }
+
+ ///
+ /// Make a from a regular copied .
+ ///
+ ///
+ /// This is for internal use only. See for the
+ /// user-facing interface.
+ ///
+ internal MutableImage(Image copiedImage) : base(copiedImage.ObjectRef())
+ {
+ Image = copiedImage;
+ }
+
+ #region set/remove metadata
+
+ ///
+ /// Set the type and value of an item of metadata.
+ ///
+ ///
+ /// Sets the type and value of an item of metadata. Any old item of the
+ /// same name is removed. See for types.
+ ///
+ /// The GType of the metadata item to create.
+ /// The name of the piece of metadata to create.
+ /// The value to set as a C# value. It is
+ /// converted to the GType, if possible.
+ public new void Set(nint gtype, string name, object value)
+ {
+ using var gv = new GValue();
+ gv.SetType(gtype);
+ gv.Set(value);
+ VipsImage.Set(this, name, in gv.Struct);
+ }
+
+ ///
+ /// Set the value of an item of metadata.
+ ///
+ ///
+ /// Sets the value of an item of metadata. The metadata item must already
+ /// exist.
+ ///
+ /// The name of the piece of metadata to set the value of.
+ /// The value to set as a C# value. It is
+ /// converted to the type of the metadata item, if possible.
+ /// If metadata item does not exist.
+ public void Set(string name, object value)
+ {
+ var gtype = GetTypeOf(name);
+ if (gtype == IntPtr.Zero)
+ {
+ throw new ArgumentException(
+ $"metadata item {name} does not exist - use the Set(nint, string, object) overload to create and set");
+ }
+
+ Set(gtype, name, value);
+ }
+
+ ///
+ /// Remove an item of metadata.
+ ///
+ ///
+ /// The named metadata item is removed.
+ ///
+ /// The name of the piece of metadata to remove.
+ /// if the metadata is successfully removed;
+ /// otherwise, .
+ public bool Remove(string name)
+ {
+ return VipsImage.Remove(this, name);
+ }
+
+ #endregion
+
+ #region overrides
+
+ ///
+ /// Overload `[]`.
+ ///
+ ///
+ /// Use `[]` to set band elements on an image. For example:
+ ///
+ /// using var test = image.Mutate(x => x[1] = green);
+ ///
+ /// Will change band 1 (the middle band).
+ ///
+ /// The band element to change.
+ public new Image this[int i]
+ {
+ set
+ {
+ // number of bands to the left and right of value
+ var nLeft = SMath.Min(Bands, SMath.Max(0, i));
+ var nRight = SMath.Min(Bands, SMath.Max(0, Bands - 1 - i));
+ var offset = Bands - nRight;
+ using var left = nLeft > 0 ? Image.ExtractBand(0, n: nLeft) : null;
+ using var right = nRight > 0 ? Image.ExtractBand(offset, n: nRight) : null;
+ if (left == null)
+ {
+ using (Image)
+ {
+ Image = value.Bandjoin(right);
+ }
+ }
+ else if (right == null)
+ {
+ using (Image)
+ {
+ Image = left.Bandjoin(value);
+ }
+ }
+ else
+ {
+ using (Image)
+ {
+ Image = left.Bandjoin(value, right);
+ }
+ }
+ }
+ }
+
+ ///
+ public override Image Mutate(Action action)
+ {
+ action.Invoke(this);
+ return Image;
+ }
+
+ ///
+ public override string ToString()
+ {
+ return $"";
+ }
+
+ #endregion
+}
\ No newline at end of file
diff --git a/vendor/NetVips/NetVips.cs b/vendor/NetVips/NetVips.cs
new file mode 100644
index 0000000..f46808d
--- /dev/null
+++ b/vendor/NetVips/NetVips.cs
@@ -0,0 +1,424 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using NetVips.Internal;
+
+namespace NetVips;
+
+///
+/// Basic utility stuff.
+///
+public static class NetVips
+{
+ ///
+ /// Init() starts up the world of VIPS.
+ ///
+ ///
+ /// This function will be automatically called by
+ /// once the assembly is loaded. You should only call this method in your own program if the
+ /// fails to initialize libvips.
+ ///
+ /// if successful started; otherwise, .
+ public static bool Init()
+ {
+ return Vips.Init("NetVips") == 0;
+ }
+
+ ///
+ /// Call this to drop caches, close plugins, terminate background threads, and finalize
+ /// any internal library testing.
+ ///
+ ///
+ /// Calling this is optional. If you don't call it, your platform will clean up for you.
+ /// The only negative consequences are that the leak checker ()
+ /// and the profiler () will not work.
+ ///
+ public static void Shutdown()
+ {
+ Vips.Shutdown();
+ }
+
+ ///
+ /// Enable or disable libvips leak checking.
+ ///
+ ///
+ /// With this enabled, libvips will check for object and area leaks on .
+ /// Enabling this option will make libvips run slightly more slowly.
+ ///
+ public static bool Leak
+ {
+ set => Vips.LeakSet(value);
+ }
+
+ ///
+ /// Enable or disable libvips profile recording.
+ ///
+ ///
+ /// If set, vips will record profiling information, and dump it on .
+ /// These profiles can be analyzed with the `vipsprofile` program.
+ ///
+ public static bool Profile
+ {
+ set => Vips.ProfileSet(value);
+ }
+
+ ///
+ /// Gets or sets the number of worker threads libvips' should create to process each image.
+ ///
+ public static int Concurrency
+ {
+ get => Vips.ConcurrencyGet();
+ set => Vips.ConcurrencySet(value);
+ }
+
+ ///
+ /// Enable or disable SIMD.
+ ///
+ public static bool Vector
+ {
+ get => Vips.VectorIsEnabled();
+ set => Vips.VectorSet(value);
+ }
+
+ ///
+ /// Set the block state on all untrusted operations.
+ ///
+ ///
+ /// For example:
+ ///
+ /// NetVips.BlockUntrusted = true;
+ ///
+ /// Will block all untrusted operations from running. Use:
+ ///
+ /// $ vips -l
+ ///
+ /// at the command-line to see the class hierarchy and which
+ /// operations are marked as untrusted. Use
+ /// to set the block state on
+ /// specific operations in the libvips class hierarchy.
+ ///
+ /// At least libvips 8.13 is needed.
+ ///
+ public static bool BlockUntrusted
+ {
+ set => Vips.BlockUntrustedSet(value);
+ }
+
+ ///
+ /// Get the major, minor or patch version number of the libvips library.
+ ///
+ /// Pass 0 to get the major version number, 1 to get minor, 2 to get patch.
+ /// to get this value from the pre-initialized
+ /// variable.
+ /// The version number.
+ /// If is not in range.
+ public static int Version(int flag, bool fromModule = true)
+ {
+ if (fromModule && ModuleInitializer.Version.HasValue)
+ {
+ var version = ModuleInitializer.Version.Value;
+ switch (flag)
+ {
+ case 0:
+ return (version >> 16) & 0xFF;
+ case 1:
+ return (version >> 8) & 0xFF;
+ case 2:
+ return version & 0xFF;
+ }
+ }
+
+ if (flag is < 0 or > 2)
+ {
+ throw new ArgumentOutOfRangeException(nameof(flag), "Flag must be in the range of 0 to 2");
+ }
+
+ var value = Vips.Version(flag);
+ if (value < 0)
+ {
+ throw new VipsException("Unable to get library version");
+ }
+
+ return value;
+ }
+
+ ///
+ /// Is this at least libvips major.minor[.patch]?
+ ///
+ /// Major component.
+ /// Minor component.
+ /// Patch component.
+ /// if at least libvips major.minor[.patch]; otherwise, .
+ public static bool AtLeastLibvips(int x, int y, int z = 0)
+ {
+ var major = Version(0);
+ var minor = Version(1);
+ var patch = Version(2);
+
+ return major > x ||
+ major == x && minor > y ||
+ major == x && minor == y && patch >= z;
+ }
+
+ ///
+ /// Get a list of all the filename suffixes supported by libvips.
+ ///
+ ///
+ /// At least libvips 8.8 is needed.
+ ///
+ /// An array of strings or .
+ public static string[] GetSuffixes()
+ {
+ if (!AtLeastLibvips(8, 8))
+ {
+ return null;
+ }
+
+ var ptrArr = VipsForeign.GetSuffixes();
+
+ var names = new List();
+
+ var count = 0;
+ nint strPtr;
+ while ((strPtr = Marshal.ReadIntPtr(ptrArr, count * IntPtr.Size)) != IntPtr.Zero)
+ {
+ var name = Marshal.PtrToStringAnsi(strPtr);
+ names.Add(name);
+ GLib.GFree(strPtr);
+ ++count;
+ }
+
+ GLib.GFree(ptrArr);
+
+ return names.ToArray();
+ }
+
+ ///
+ /// Reports leaks (hopefully there are none) it also tracks and reports peak memory use.
+ ///
+ internal static void ReportLeak()
+ {
+ VipsObject.PrintAll();
+
+ Console.WriteLine("memory: {0} allocations, {1} bytes", Stats.Allocations, Stats.Mem);
+ Console.WriteLine("files: {0} open", Stats.Files);
+
+ Console.WriteLine("memory: high-water mark: {0}", Stats.MemHighwater.ToReadableBytes());
+
+ var errorBuffer = Marshal.PtrToStringAnsi(Vips.ErrorBuffer());
+ if (!string.IsNullOrEmpty(errorBuffer))
+ {
+ Console.WriteLine("error buffer: {0}", errorBuffer);
+ }
+ }
+
+ #region unit test functions
+
+ ///
+ /// For testing only.
+ ///
+ /// Path to split.
+ /// The filename part of a vips7 path.
+ internal static string PathFilename7(string path)
+ {
+ return Vips.PathFilename7(path);
+ }
+
+ ///
+ /// For testing only.
+ ///
+ /// Path to split.
+ /// The mode part of a vips7 path.
+ internal static string PathMode7(string path)
+ {
+ return Vips.PathMode7(path);
+ }
+
+ ///
+ /// For testing only.
+ ///
+ internal static void VipsInterpretationGetType()
+ {
+ Vips.InterpretationGetType();
+ }
+
+ ///
+ /// For testing only.
+ ///
+ internal static void VipsOperationFlagsGetType()
+ {
+ VipsOperation.FlagsGetType();
+ }
+
+ #endregion
+
+ ///
+ /// Get the GType for a name.
+ ///
+ ///
+ /// Looks up the GType for a nickname. Types below basename in the type
+ /// hierarchy are searched.
+ ///
+ /// Name of base class.
+ /// Search for a class with this nickname.
+ /// The GType of the class, or if the class is not found.
+ public static nint TypeFind(string basename, string nickname)
+ {
+ return Vips.TypeFind(basename, nickname);
+ }
+
+ ///
+ /// Return the name for a GType.
+ ///
+ /// Type to return name for.
+ /// Type name.
+ public static string TypeName(nint type)
+ {
+ return Marshal.PtrToStringAnsi(GType.Name(type));
+ }
+
+ ///
+ /// Return the nickname for a GType.
+ ///
+ /// Type to return nickname for.
+ /// Nickname.
+ public static string NicknameFind(nint type)
+ {
+ return Marshal.PtrToStringAnsi(Vips.NicknameFind(type));
+ }
+
+ ///
+ /// Get a list of operations available within the libvips library.
+ ///
+ ///
+ /// This can be useful for documentation generators.
+ ///
+ /// A list of operations.
+ public static List GetOperations()
+ {
+ var allNickNames = new List();
+ var handle = GCHandle.Alloc(allNickNames);
+
+ nint TypeMap(nint type, nint a, nint b)
+ {
+ var nickname = NicknameFind(type);
+
+ // exclude base classes, for e.g. 'jpegload_base'
+ if (TypeFind("VipsOperation", nickname) != IntPtr.Zero)
+ {
+ var list = (List)GCHandle.FromIntPtr(a).Target;
+ list.Add(NicknameFind(type));
+ }
+
+ return Vips.TypeMap(type, TypeMap, a, b);
+ }
+
+ try
+ {
+ Vips.TypeMap(TypeFromName("VipsOperation"), TypeMap, GCHandle.ToIntPtr(handle), IntPtr.Zero);
+ }
+ finally
+ {
+ handle.Free();
+ }
+
+ // Sort
+ allNickNames.Sort();
+
+ // Filter duplicates
+ allNickNames = allNickNames.Distinct().ToList();
+
+ return allNickNames;
+ }
+
+ ///
+ /// Get a list of enums available within the libvips library.
+ ///
+ /// A list of enums.
+ public static List GetEnums()
+ {
+ var allEnums = new List();
+ var handle = GCHandle.Alloc(allEnums);
+
+ nint TypeMap(nint type, nint a, nint b)
+ {
+ var nickname = TypeName(type);
+
+ var list = (List)GCHandle.FromIntPtr(a).Target;
+ list.Add(nickname);
+
+ return Vips.TypeMap(type, TypeMap, a, b);
+ }
+
+ try
+ {
+ Vips.TypeMap(TypeFromName("GEnum"), TypeMap, GCHandle.ToIntPtr(handle), IntPtr.Zero);
+ }
+ finally
+ {
+ handle.Free();
+ }
+
+ // Sort
+ allEnums.Sort();
+
+ return allEnums;
+ }
+
+ ///
+ /// Get all values for a enum (GType).
+ ///
+ /// Type to return enum values for.
+ /// A list of values.
+ public static Dictionary ValuesForEnum(nint type)
+ {
+ var typeClass = GType.ClassRef(type);
+ var enumClass = Marshal.PtrToStructure(typeClass);
+
+ var values = new Dictionary((int)enumClass.NValues);
+
+ var ptr = enumClass.Values;
+ for (var i = 0; i < enumClass.NValues; i++)
+ {
+ var enumValue = Marshal.PtrToStructure(ptr);
+ values[enumValue.ValueNick] = enumValue.Value;
+
+ ptr += Marshal.SizeOf();
+ }
+
+ return values;
+ }
+
+ ///
+ /// Return the GType for a name.
+ ///
+ /// Type name to lookup.
+ /// Corresponding type ID or .
+ public static nint TypeFromName(string name)
+ {
+ return GType.FromName(name);
+ }
+
+ ///
+ /// Extract the fundamental type ID portion.
+ ///
+ /// A valid type ID.
+ /// Fundamental type ID.
+ public static nint FundamentalType(nint type)
+ {
+ return GType.Fundamental(type);
+ }
+
+ ///
+ /// Frees the memory pointed to by .
+ ///
+ ///
+ /// This is needed for .
+ ///
+ /// The memory to free.
+ public static void Free(nint mem)
+ {
+ GLib.GFree(mem);
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/NetVips.csproj b/vendor/NetVips/NetVips.csproj
new file mode 100644
index 0000000..7e7d0d4
--- /dev/null
+++ b/vendor/NetVips/NetVips.csproj
@@ -0,0 +1,31 @@
+
+
+
+
+
+ net6.0;net8.0
+ true
+
+ Library
+
+ x64;x86;ARM64;ARM32
+ true
+ true
+ false
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/vendor/NetVips/Operation.cs b/vendor/NetVips/Operation.cs
new file mode 100644
index 0000000..1ad3e9d
--- /dev/null
+++ b/vendor/NetVips/Operation.cs
@@ -0,0 +1,270 @@
+using System;
+using NetVips.Internal;
+
+namespace NetVips;
+
+///
+/// Wrap a object.
+///
+public class Operation : VipsObject
+{
+ ///
+ private Operation(nint pointer) : base(pointer)
+ {
+ }
+
+ ///
+ /// Create a new with the specified nickname.
+ ///
+ ///
+ /// You'll need to set any arguments and build the operation before you can use it. See
+ /// for a higher-level way to make new operations.
+ ///
+ /// Nickname of operation to create.
+ /// The new operation.
+ /// If the operation doesn't exist.
+ public static Operation NewFromName(string operationName)
+ {
+ var vop = VipsOperation.New(operationName);
+ if (vop == IntPtr.Zero)
+ {
+ throw new VipsException($"no such operation {operationName}");
+ }
+
+ return new Operation(vop);
+ }
+
+ ///
+ /// Set a GObject property. The value is converted to the property type, if possible.
+ ///
+ /// The name of the property to set.
+ /// A used as guide.
+ /// The value.
+ /// The GType of the property.
+ private void Set(nint gtype, Image matchImage, string name, object value)
+ {
+ // if the object wants an image and we have a constant, Imageize it
+ //
+ // if the object wants an image array, Imageize any constants in the
+ // array
+ if (matchImage != null)
+ {
+ if (gtype == GValue.ImageType)
+ {
+ value = Image.Imageize(matchImage, value);
+ }
+ else if (gtype == GValue.ArrayImageType)
+ {
+ if (value is not Array { Rank: 1 } values)
+ {
+ throw new ArgumentException(
+ $"unsupported value type {value.GetType()} for VipsArrayImage");
+ }
+
+ var images = new Image[values.Length];
+ for (var i = 0; i < values.Length; i++)
+ {
+ ref var image = ref images[i];
+ image = Image.Imageize(matchImage, values.GetValue(i));
+ }
+
+ value = images;
+ }
+ }
+
+ Set(gtype, name, value);
+ }
+
+ ///
+ /// Lookup the set of flags for this operation.
+ ///
+ /// Flags for this operation.
+ public Enums.OperationFlags GetFlags() => VipsOperation.GetFlags(this);
+
+ ///
+ /// Call a libvips operation.
+ ///
+ ///
+ /// Use this method to call any libvips operation. For example:
+ ///
+ /// using Image blackImage = Operation.Call("black", 10, 10) as Image;
+ ///
+ /// See the Introduction for notes on how this works.
+ ///
+ /// Operation name.
+ /// An arbitrary number and variety of arguments.
+ /// A new object.
+ public static object Call(string operationName, params object[] args) =>
+ Call(operationName, null, null, args);
+
+ ///
+ /// Call a libvips operation.
+ ///
+ ///
+ /// Use this method to call any libvips operation. For example:
+ ///
+ /// using Image blackImage = Operation.Call("black", 10, 10) as Image;
+ ///
+ /// See the Introduction for notes on how this works.
+ ///
+ /// Operation name.
+ /// Optional arguments.
+ /// An arbitrary number and variety of arguments.
+ /// A new object.
+ public static object Call(string operationName, VOption kwargs = null, params object[] args) =>
+ Call(operationName, kwargs, null, args);
+
+ ///
+ /// Call a libvips operation.
+ ///
+ ///
+ /// Use this method to call any libvips operation. For example:
+ ///
+ /// using Image blackImage = Operation.Call("black", 10, 10) as Image;
+ ///
+ /// See the Introduction for notes on how this works.
+ ///
+ /// Operation name.
+ /// Optional arguments.
+ /// A used as guide.
+ /// An arbitrary number and variety of arguments.
+ /// A new object.
+ public static object Call(string operationName, VOption kwargs = null, Image matchImage = null,
+ params object[] args)
+ {
+ // pull out the special string_options kwarg
+ object stringOptions = null;
+ kwargs?.Remove("string_options", out stringOptions);
+
+ var intro = Introspect.Get(operationName);
+ if (intro.RequiredInput.Count != args.Length)
+ {
+ throw new ArgumentException(
+ $"unable to call {operationName}: {args.Length} arguments given, but {intro.RequiredInput.Count} required");
+ }
+
+ if (!intro.Mutable && matchImage is MutableImage)
+ {
+ throw new VipsException($"unable to call {operationName}: operation must be mutable");
+ }
+
+ nint vop;
+ using (var op = NewFromName(operationName))
+ {
+ // set any string options before any args so they can't be
+ // overridden
+ if (stringOptions != null && !op.SetString(stringOptions as string))
+ {
+ throw new VipsException($"unable to call {operationName}");
+ }
+
+ // set all required inputs
+ if (matchImage != null && intro.MemberX.HasValue)
+ {
+ var memberX = intro.MemberX.Value;
+ op.Set(memberX.Type, memberX.Name, matchImage);
+ }
+
+ for (var i = 0; i < intro.RequiredInput.Count; i++)
+ {
+ var arg = intro.RequiredInput[i];
+ op.Set(arg.Type, matchImage, arg.Name, args[i]);
+ }
+
+ // set all optional inputs, if any
+ if (kwargs != null)
+ {
+ foreach (var item in kwargs)
+ {
+ var name = item.Key;
+ var value = item.Value;
+
+ if (intro.OptionalInput.TryGetValue(name, out var arg))
+ {
+ op.Set(arg.Type, matchImage, name, value);
+ }
+ else if (!intro.OptionalOutput.ContainsKey(name))
+ {
+ throw new ArgumentException($"{operationName} does not support optional argument: {name}");
+ }
+ }
+ }
+
+ // build operation
+ vop = VipsOperation.Build(op);
+ if (vop == IntPtr.Zero)
+ {
+ Internal.VipsObject.UnrefOutputs(op);
+ throw new VipsException($"unable to call {operationName}");
+ }
+ }
+
+ var results = new object[intro.RequiredOutput.Count];
+ using (var op = new Operation(vop))
+ {
+ // get all required results
+ for (var i = 0; i < intro.RequiredOutput.Count; i++)
+ {
+ var arg = intro.RequiredOutput[i];
+
+ ref var result = ref results[i];
+ result = op.Get(arg.Name);
+ }
+
+ // fetch optional output args, if any
+ if (kwargs != null)
+ {
+ var optionalArgs = new VOption();
+
+ foreach (var item in kwargs)
+ {
+ var name = item.Key;
+
+ if (intro.OptionalOutput.ContainsKey(name))
+ {
+ optionalArgs[name] = op.Get(name);
+ }
+ }
+
+ if (optionalArgs.Count > 0)
+ {
+ var resultsLength = results.Length;
+ Array.Resize(ref results, resultsLength + 1);
+ results[resultsLength] = optionalArgs;
+ }
+ }
+
+ Internal.VipsObject.UnrefOutputs(op);
+ }
+
+ return results.Length == 1 ? results[0] : results;
+ }
+
+ ///
+ /// Set the block state on all operations in the libvips class hierarchy at
+ /// and below.
+ ///
+ ///
+ /// For example:
+ ///
+ /// Operation.Block("VipsForeignLoad", true);
+ /// Operation.Block("VipsForeignLoadJpeg", false);
+ ///
+ /// Will block all load operations, except JPEG. Use:
+ ///
+ /// $ vips -l
+ ///
+ /// at the command-line to see the class hierarchy.
+ /// Use to set the
+ /// block state on all untrusted operations.
+ ///
+ /// This call does nothing if the named operation is not found.
+ /// At least libvips 8.13 is needed.
+ ///
+ /// Set block state at this point and below.
+ /// The block state to set.
+ public static void Block(string name, bool state)
+ {
+ VipsOperation.BlockSet(name, state);
+ }
+}
diff --git a/vendor/NetVips/Region.cs b/vendor/NetVips/Region.cs
new file mode 100644
index 0000000..5cc0670
--- /dev/null
+++ b/vendor/NetVips/Region.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Runtime.InteropServices;
+using NetVips.Internal;
+
+namespace NetVips;
+
+///
+/// Wrap a object.
+///
+///
+/// A region is a small part of an image. You use regions to read pixels
+/// out of images without storing the entire image in memory.
+/// At least libvips 8.8 is needed.
+///
+public class Region : VipsObject
+{
+ private Region(nint pointer) : base(pointer)
+ {
+ }
+
+ ///
+ /// Make a region on an image.
+ ///
+ /// to create this region on.
+ /// A new .
+ /// If unable to make a new region on .
+ public static Region New(Image image)
+ {
+ var vi = VipsRegion.New(image);
+ if (vi == IntPtr.Zero)
+ {
+ throw new VipsException("unable to make region");
+ }
+
+ return new Region(vi);
+ }
+
+ ///
+ /// Width of pixels held by region.
+ ///
+ public int Width => VipsRegion.Width(this);
+
+ ///
+ /// Height of pixels held by region.
+ ///
+ public int Height => VipsRegion.Height(this);
+
+ ///
+ /// Fetch an area of pixels.
+ ///
+ /// Left edge of area to fetch.
+ /// Top edge of area to fetch.
+ /// Width of area to fetch.
+ /// Height of area to fetch.
+ /// An array of bytes filled with pixel data.
+ public byte[] Fetch(int left, int top, int width, int height)
+ {
+ var pointer = VipsRegion.Fetch(this, left, top, width, height, out var size);
+ if (pointer == IntPtr.Zero)
+ {
+ throw new VipsException("unable to fetch from region");
+ }
+
+ var managedArray = new byte[size];
+ Marshal.Copy(pointer, managedArray, 0, (int)size);
+
+ GLib.GFree(pointer);
+
+ return managedArray;
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/Source.cs b/vendor/NetVips/Source.cs
new file mode 100644
index 0000000..ac6d538
--- /dev/null
+++ b/vendor/NetVips/Source.cs
@@ -0,0 +1,145 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace NetVips;
+
+///
+/// An input connection.
+///
+public partial class Source : Connection
+{
+ ///
+ /// Secret ref for .
+ ///
+ private GCHandle _dataHandle;
+
+ ///
+ internal Source(nint pointer) : base(pointer)
+ {
+ }
+
+ ///
+ /// Make a new source from a file descriptor (a small integer).
+ ///
+ ///
+ /// Make a new source that is attached to the descriptor. For example:
+ ///
+ /// using var source = Source.NewFromDescriptor(0);
+ ///
+ /// Makes a descriptor attached to stdin.
+ ///
+ /// You can pass this source to (for example) .
+ ///
+ /// Read from this file descriptor.
+ /// A new .
+ /// If unable to create a new from .
+ public static Source NewFromDescriptor(int descriptor)
+ {
+ var pointer = Internal.VipsSource.NewFromDescriptor(descriptor);
+ if (pointer == IntPtr.Zero)
+ {
+ throw new VipsException($"can't create source from descriptor {descriptor}");
+ }
+
+ return new Source(pointer);
+ }
+
+ ///
+ /// Make a new source from a filename.
+ ///
+ ///
+ /// Make a new source that is attached to the named file. For example:
+ ///
+ /// using var source = Source.NewFromFile("myfile.jpg");
+ ///
+ /// You can pass this source to (for example) .
+ ///
+ /// Read from this filename.
+ /// A new .
+ /// If unable to create a new from .
+ public static Source NewFromFile(string filename)
+ {
+ var bytes = Encoding.UTF8.GetBytes(filename + char.MinValue); // Ensure null-terminated string
+ var pointer = Internal.VipsSource.NewFromFile(bytes);
+ if (pointer == IntPtr.Zero)
+ {
+ throw new VipsException($"can't create source from filename {filename}");
+ }
+
+ return new Source(pointer);
+ }
+
+ ///
+ /// Make a new source from a memory object.
+ ///
+ ///
+ /// Make a new source that is attached to the memory object. For example:
+ ///
+ /// using var source = Source.NewFromMemory(data);
+ ///
+ /// You can pass this source to (for example) .
+ ///
+ /// The memory object.
+ /// A new .
+ /// If unable to create a new from .
+ public static Source NewFromMemory(byte[] data)
+ {
+ var handle = GCHandle.Alloc(data, GCHandleType.Pinned);
+ var pointer = Internal.VipsSource.NewFromMemory(handle.AddrOfPinnedObject(), (nuint)data.Length);
+ if (pointer == IntPtr.Zero)
+ {
+ if (handle.IsAllocated)
+ {
+ handle.Free();
+ }
+
+ throw new VipsException("can't create input source from memory");
+ }
+
+ return new Source(pointer) { _dataHandle = handle };
+ }
+
+ ///
+ /// Make a new source from a memory object.
+ ///
+ ///
+ /// Make a new source that is attached to the memory object. For example:
+ ///
+ /// using var source = Source.NewFromMemory(data);
+ ///
+ /// You can pass this source to (for example) .
+ ///
+ /// The memory object.
+ /// A new .
+ /// If unable to create a new from .
+ public static Source NewFromMemory(string data) => NewFromMemory(Encoding.UTF8.GetBytes(data));
+
+ ///
+ /// Make a new source from a memory object.
+ ///
+ ///
+ /// Make a new source that is attached to the memory object. For example:
+ ///
+ /// using var source = Source.NewFromMemory(data);
+ ///
+ /// You can pass this source to (for example) .
+ ///
+ /// The memory object.
+ /// A new .
+ /// If unable to create a new from .
+ public static Source NewFromMemory(char[] data) => NewFromMemory(Encoding.UTF8.GetBytes(data));
+
+ ///
+ protected override void Dispose(bool disposing)
+ {
+ // release reference to our secret ref
+ if (_dataHandle.IsAllocated)
+ {
+ _dataHandle.Free();
+ }
+
+ // Call our base Dispose method
+ base.Dispose(disposing);
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/SourceCustom.cs b/vendor/NetVips/SourceCustom.cs
new file mode 100644
index 0000000..f372cf8
--- /dev/null
+++ b/vendor/NetVips/SourceCustom.cs
@@ -0,0 +1,117 @@
+using System.Buffers;
+using System.IO;
+using System.Runtime.InteropServices;
+
+namespace NetVips;
+
+///
+/// An source you can connect delegates to implement behaviour.
+///
+public class SourceCustom : Source
+{
+ ///
+ /// A read delegate.
+ ///
+ ///
+ /// The interface is exactly as .
+ /// The handler is given a number of bytes to fetch, and should return a
+ /// bytes-like object containing up to that number of bytes. If there is
+ /// no more data available, it should return .
+ ///
+ /// An array of bytes.
+ /// The maximum number of bytes to be read.
+ /// The total number of bytes read into the buffer.
+ public delegate int ReadDelegate(byte[] buffer, int length);
+
+ ///
+ /// A seek delegate.
+ ///
+ ///
+ /// The interface is exactly as . The handler is given
+ /// parameters for offset and whence with the same meanings. It also returns the
+ /// new position within the current source.
+ ///
+ /// Seek handlers are optional. If you do not set one, your source will be
+ /// treated as unseekable and libvips will do extra caching.
+ ///
+ /// A byte offset relative to the
+ /// parameter.
+ /// A value of type indicating the
+ /// reference point used to obtain the new position.
+ /// The new position within the current source.
+ public delegate long SeekDelegate(long offset, SeekOrigin origin);
+
+ ///
+ /// Attach a read delegate.
+ ///
+ public event ReadDelegate OnRead;
+
+ ///
+ /// Attach a seek delegate.
+ ///
+ public event SeekDelegate OnSeek;
+
+ ///
+ public SourceCustom() : base(Internal.VipsSourceCustom.New())
+ {
+ SignalConnect("read", (Internal.VipsSourceCustom.ReadSignal)ReadHandler);
+ SignalConnect("seek", (Internal.VipsSourceCustom.SeekSignal)SeekHandler);
+ }
+
+ ///
+ /// The internal read handler.
+ ///
+ /// The underlying pointer to the source.
+ /// A pointer to an array of bytes.
+ /// The maximum number of bytes to be read.
+ /// User data associated with the source.
+ /// The total number of bytes read into the buffer.
+ internal long ReadHandler(nint sourcePtr, nint buffer, long length, nint userDataPtr)
+ {
+ if (length <= 0)
+ {
+ return 0;
+ }
+
+ var tempArray = ArrayPool.Shared.Rent((int)length);
+ try
+ {
+ var readLength = OnRead?.Invoke(tempArray, (int)length);
+ if (!readLength.HasValue)
+ {
+ return -1;
+ }
+
+ if (readLength.Value > 0)
+ {
+ Marshal.Copy(tempArray, 0, buffer, readLength.Value);
+ }
+
+ return readLength.Value;
+ }
+ catch
+ {
+ return -1;
+ }
+ finally
+ {
+ ArrayPool.Shared.Return(tempArray);
+ }
+ }
+
+ ///
+ /// The internal seek handler.
+ ///
+ /// The underlying pointer to the source.
+ /// A byte offset relative to the
+ /// parameter.
+ /// A value of type indicating the
+ /// reference point used to obtain the new position.
+ /// User data associated with the source.
+ /// The new position within the current source.
+ internal long SeekHandler(nint sourcePtr, long offset, int whence, nint userDataPtr)
+ {
+ var newPosition = OnSeek?.Invoke(offset, (SeekOrigin)whence);
+ return newPosition ?? -1;
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/SourceStream.cs b/vendor/NetVips/SourceStream.cs
new file mode 100644
index 0000000..4fb191b
--- /dev/null
+++ b/vendor/NetVips/SourceStream.cs
@@ -0,0 +1,88 @@
+using System;
+using System.IO;
+
+namespace NetVips;
+
+///
+/// An source connected to a readable .
+///
+internal class SourceStream : SourceCustom
+{
+ ///
+ /// Read from this stream.
+ ///
+ private readonly Stream _stream;
+
+ ///
+ /// The start position within the stream.
+ ///
+ private readonly long _startPosition;
+
+ ///
+ internal SourceStream(Stream stream)
+ {
+ var seekable = stream.CanSeek;
+
+ _stream = stream;
+ _startPosition = seekable ? _stream.Position : 0;
+
+ OnRead += Read;
+ if (seekable)
+ {
+ OnSeek += Seek;
+ }
+ }
+
+ ///
+ /// Create a attached to an .
+ ///
+ /// Read from this stream.
+ /// A new .
+ /// If is not readable.
+ internal static SourceStream NewFromStream(Stream stream)
+ {
+ if (!stream.CanRead)
+ {
+ throw new ArgumentException("The stream should be readable.", nameof(stream));
+ }
+
+ return new SourceStream(stream);
+ }
+
+ ///
+ /// Attach a read handler.
+ ///
+ /// An array of bytes.
+ /// The maximum number of bytes to be read.
+ /// The total number of bytes read into the buffer.
+ public int Read(byte[] buffer, int length)
+ {
+ return _stream.Read(buffer, 0, length);
+ }
+
+ ///
+ /// Attach a seek handler.
+ ///
+ /// A byte offset relative to the
+ /// parameter.
+ /// A value of type indicating the
+ /// reference point used to obtain the new position.
+ /// The new position within the current stream.
+ public long Seek(long offset, SeekOrigin origin)
+ {
+ try
+ {
+ return origin switch
+ {
+ SeekOrigin.Begin => _stream.Seek(_startPosition + offset, SeekOrigin.Begin) - _startPosition,
+ SeekOrigin.Current => _stream.Seek(offset, SeekOrigin.Current) - _startPosition,
+ SeekOrigin.End => _stream.Seek(offset, SeekOrigin.End) - _startPosition,
+ _ => -1
+ };
+ }
+ catch
+ {
+ return -1;
+ }
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/Stats.cs b/vendor/NetVips/Stats.cs
new file mode 100644
index 0000000..a78a822
--- /dev/null
+++ b/vendor/NetVips/Stats.cs
@@ -0,0 +1,39 @@
+using NetVips.Internal;
+
+namespace NetVips;
+
+///
+/// A class that provides the statistics of memory usage and opened files.
+///
+///
+/// libvips watches the total amount of live tracked memory and
+/// uses this information to decide when to trim caches.
+///
+public static class Stats
+{
+ ///
+ /// Get the number of active allocations.
+ ///
+ public static int Allocations => Vips.TrackedGetAllocs();
+
+ ///
+ /// Get the number of bytes currently allocated `vips_malloc()` and friends.
+ ///
+ ///
+ /// libvips uses this figure to decide when to start dropping cache.
+ ///
+ public static int Mem => Vips.TrackedGetMem();
+
+ ///
+ /// Returns the largest number of bytes simultaneously allocated via vips_tracked_malloc().
+ ///
+ ///
+ /// Handy for estimating max memory requirements for a program.
+ ///
+ public static ulong MemHighwater => Vips.TrackedGetMemHighwater();
+
+ ///
+ /// Get the number of open files.
+ ///
+ public static int Files => Vips.TrackedGetFiles();
+}
\ No newline at end of file
diff --git a/vendor/NetVips/Target.cs b/vendor/NetVips/Target.cs
new file mode 100644
index 0000000..4d66e9a
--- /dev/null
+++ b/vendor/NetVips/Target.cs
@@ -0,0 +1,99 @@
+using System;
+using System.Text;
+
+namespace NetVips;
+
+///
+/// An output connection.
+///
+public class Target : Connection
+{
+ ///
+ internal Target(nint pointer) : base(pointer)
+ {
+ }
+
+ ///
+ /// Get the memory object held by the target when using .
+ ///
+ public byte[] Blob => (byte[])Get("blob");
+
+ ///
+ /// Make a new target to write to a file descriptor (a small integer).
+ ///
+ ///
+ /// Make a new target that is attached to the descriptor. For example:
+ ///
+ /// using var target = Target.NewToDescriptor(1);
+ ///
+ /// Makes a descriptor attached to stdout.
+ ///
+ /// You can pass this target to (for example) .
+ ///
+ /// Write to this file descriptor.
+ /// A new .
+ /// If unable to create a new from .
+ public static Target NewToDescriptor(int descriptor)
+ {
+ var pointer = Internal.VipsTarget.NewToDescriptor(descriptor);
+ if (pointer == IntPtr.Zero)
+ {
+ throw new VipsException($"can't create output target to descriptor {descriptor}");
+ }
+
+ return new Target(pointer);
+ }
+
+ ///
+ /// Make a new target to write to a file.
+ ///
+ ///
+ /// Make a new target that will write to the named file. For example:
+ ///
+ /// using var target = Target.NewToFile("myfile.jpg");
+ ///
+ /// You can pass this target to (for example) .
+ ///
+ /// Write to this this file.
+ /// A new .
+ /// If unable to create a new from .
+ public static Target NewToFile(string filename)
+ {
+ var bytes = Encoding.UTF8.GetBytes(filename + char.MinValue); // Ensure null-terminated string
+ var pointer = Internal.VipsTarget.NewToFile(bytes);
+ if (pointer == IntPtr.Zero)
+ {
+ throw new VipsException($"can't create output target to filename {filename}");
+ }
+
+ return new Target(pointer);
+ }
+
+ ///
+ /// Make a new target to write to an area of memory.
+ ///
+ ///
+ /// Make a new target that will write to memory. For example:
+ ///
+ /// using var target = Target.NewToMemory();
+ ///
+ /// You can pass this target to (for example) .
+ ///
+ /// After writing to the target, fetch the bytes from the target object with:
+ ///
+ /// var bytes = target.Blob;
+ ///
+ ///
+ /// A new .
+ /// If unable to create a new .
+ public static Target NewToMemory()
+ {
+ var pointer = Internal.VipsTarget.NewToMemory();
+ if (pointer == IntPtr.Zero)
+ {
+ throw new VipsException("can't create output target to memory");
+ }
+
+ return new Target(pointer);
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/TargetCustom.cs b/vendor/NetVips/TargetCustom.cs
new file mode 100644
index 0000000..9722c02
--- /dev/null
+++ b/vendor/NetVips/TargetCustom.cs
@@ -0,0 +1,180 @@
+using System.Buffers;
+using System.IO;
+using System.Runtime.InteropServices;
+
+namespace NetVips;
+
+///
+/// An target you can connect delegates to implement behaviour.
+///
+public class TargetCustom : Target
+{
+ ///
+ /// A write delegate.
+ ///
+ ///
+ /// The interface is the same as .
+ /// The handler is given a bytes-like object to write. However, the handler MUST
+ /// return the number of bytes written.
+ ///
+ /// An array of bytes.
+ /// The number of bytes to be written to the current target.
+ /// The total number of bytes written to the target.
+ public delegate long WriteDelegate(byte[] buffer, int length);
+
+ ///
+ /// A read delegate.
+ ///
+ ///
+ /// libtiff needs to be able to read on targets, unfortunately.
+ ///
+ /// An array of bytes.
+ /// The maximum number of bytes to be read.
+ /// The total number of bytes read into the buffer.
+ public delegate int ReadDelegate(byte[] buffer, int length);
+
+ ///
+ /// A seek delegate.
+ ///
+ ///
+ /// libtiff needs to be able to seek on targets, unfortunately.
+ ///
+ /// A byte offset relative to the
+ /// parameter.
+ /// A value of type indicating the
+ /// reference point used to obtain the new position.
+ /// The new position within the current target.
+ public delegate long SeekDelegate(long offset, SeekOrigin origin);
+
+ ///
+ /// A end delegate.
+ ///
+ ///
+ /// This optional handler is called at the end of write. It should do any
+ /// cleaning up, if necessary.
+ ///
+ /// 0 on success, -1 on error.
+ public delegate int EndDelegate();
+
+ ///
+ /// Attach a write delegate.
+ ///
+ public event WriteDelegate OnWrite;
+
+ ///
+ /// Attach a read delegate.
+ ///
+ ///
+ /// This is not called prior libvips 8.13.
+ ///
+ public event ReadDelegate OnRead;
+
+ ///
+ /// Attach a seek delegate.
+ ///
+ ///
+ /// This is not called prior libvips 8.13.
+ ///
+ public event SeekDelegate OnSeek;
+
+ ///
+ /// Attach a end delegate.
+ ///
+ public event EndDelegate OnEnd;
+
+ ///
+ public TargetCustom() : base(Internal.VipsTargetCustom.New())
+ {
+ var vips813 = NetVips.AtLeastLibvips(8, 13);
+
+ SignalConnect("write", (Internal.VipsTargetCustom.WriteSignal)WriteHandler);
+ if (vips813)
+ {
+ SignalConnect("read", (Internal.VipsTargetCustom.ReadSignal)ReadHandler);
+ SignalConnect("seek", (Internal.VipsTargetCustom.SeekSignal)SeekHandler);
+ }
+ SignalConnect(vips813 ? "end" : "finish", (Internal.VipsTargetCustom.EndSignal)EndHandler);
+ }
+
+ ///
+ /// The internal write handler.
+ ///
+ /// The underlying pointer to the target.
+ /// An array of bytes.
+ /// The number of bytes to be written to the current target.
+ /// User data associated with the target.
+ /// The total number of bytes written to the target.
+ internal long WriteHandler(nint targetPtr, byte[] buffer, int length, nint userDataPtr)
+ {
+ var bytesWritten = OnWrite?.Invoke(buffer, length);
+ return bytesWritten ?? -1;
+ }
+
+ ///
+ /// The internal read handler.
+ ///
+ /// The underlying pointer to the target.
+ /// A pointer to an array of bytes.
+ /// The maximum number of bytes to be read.
+ /// User data associated with the target.
+ /// The total number of bytes read into the buffer.
+ internal long ReadHandler(nint targetPtr, nint buffer, long length, nint userDataPtr)
+ {
+ if (length <= 0)
+ {
+ return 0;
+ }
+
+ var tempArray = ArrayPool.Shared.Rent((int)length);
+ try
+ {
+ var readLength = OnRead?.Invoke(tempArray, (int)length);
+ if (!readLength.HasValue)
+ {
+ return -1;
+ }
+
+ if (readLength.Value > 0)
+ {
+ Marshal.Copy(tempArray, 0, buffer, readLength.Value);
+ }
+
+ return readLength.Value;
+ }
+ catch
+ {
+ return -1;
+ }
+ finally
+ {
+ ArrayPool.Shared.Return(tempArray);
+ }
+ }
+
+ ///
+ /// The internal seek handler.
+ ///
+ /// The underlying pointer to the target.
+ /// A byte offset relative to the
+ /// parameter.
+ /// A value of type indicating the
+ /// reference point used to obtain the new position.
+ /// User data associated with the target.
+ /// The new position within the current target.
+ internal long SeekHandler(nint targetPtr, long offset, int whence, nint userDataPtr)
+ {
+ var newPosition = OnSeek?.Invoke(offset, (SeekOrigin)whence);
+ return newPosition ?? -1;
+ }
+
+ ///
+ /// The internal end handler.
+ ///
+ /// The underlying pointer to the target.
+ /// User data associated with the target.
+ /// 0 on success, -1 on error.
+ internal int EndHandler(nint targetPtr, nint userDataPtr)
+ {
+ return OnEnd?.Invoke() ?? 0;
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/TargetStream.cs b/vendor/NetVips/TargetStream.cs
new file mode 100644
index 0000000..50afe8c
--- /dev/null
+++ b/vendor/NetVips/TargetStream.cs
@@ -0,0 +1,132 @@
+using System;
+using System.IO;
+
+namespace NetVips;
+
+///
+/// An target connected to a writable .
+///
+internal class TargetStream : TargetCustom
+{
+ ///
+ /// Write to this stream.
+ ///
+ private readonly Stream _stream;
+
+ ///
+ /// The start position within the stream.
+ ///
+ private readonly long _startPosition;
+
+ ///
+ internal TargetStream(Stream stream)
+ {
+ var readable = stream.CanRead;
+ var seekable = stream.CanSeek;
+
+ _stream = stream;
+ _startPosition = seekable ? _stream.Position : 0;
+
+ OnWrite += Write;
+ if (readable)
+ {
+ OnRead += Read;
+ }
+ if (seekable)
+ {
+ OnSeek += Seek;
+ }
+ OnEnd += End;
+ }
+
+ ///
+ /// Create a which will output to a .
+ ///
+ /// Write to this stream.
+ /// A new .
+ /// If is not writable.
+ internal static TargetStream NewFromStream(Stream stream)
+ {
+ if (!stream.CanWrite)
+ {
+ throw new ArgumentException("The stream should be writable.", nameof(stream));
+ }
+
+ return new TargetStream(stream);
+ }
+
+ ///
+ /// Attach a write handler.
+ ///
+ /// An array of bytes.
+ /// The number of bytes to be written to the current stream.
+ /// The total number of bytes written to the stream.
+ private long Write(byte[] buffer, int length)
+ {
+ try
+ {
+ _stream.Write(buffer, 0, length);
+ }
+ catch
+ {
+ return -1;
+ }
+
+ return length;
+ }
+
+ ///
+ /// Attach a read handler.
+ ///
+ /// An array of bytes.
+ /// The maximum number of bytes to be read.
+ /// The total number of bytes read into the buffer.
+ public int Read(byte[] buffer, int length)
+ {
+ return _stream.Read(buffer, 0, length);
+ }
+
+ ///
+ /// Attach a seek handler.
+ ///
+ /// A byte offset relative to the
+ /// parameter.
+ /// A value of type indicating the
+ /// reference point used to obtain the new position.
+ /// The new position within the current stream.
+ public long Seek(long offset, SeekOrigin origin)
+ {
+ try
+ {
+ return origin switch
+ {
+ SeekOrigin.Begin => _stream.Seek(_startPosition + offset, SeekOrigin.Begin) - _startPosition,
+ SeekOrigin.Current => _stream.Seek(offset, SeekOrigin.Current) - _startPosition,
+ SeekOrigin.End => _stream.Seek(offset, SeekOrigin.End) - _startPosition,
+ _ => -1
+ };
+ }
+ catch
+ {
+ return -1;
+ }
+ }
+
+ ///
+ /// Attach a end handler.
+ ///
+ /// 0 on success, -1 on error.
+ public int End()
+ {
+ try
+ {
+ _stream.Flush();
+ }
+ catch
+ {
+ return -1;
+ }
+
+ return 0;
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/VOption.cs b/vendor/NetVips/VOption.cs
new file mode 100644
index 0000000..973fbb2
--- /dev/null
+++ b/vendor/NetVips/VOption.cs
@@ -0,0 +1,116 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.CompilerServices;
+
+namespace NetVips;
+
+///
+/// This class wraps a .
+/// This is used to call functions with optional arguments. See .
+///
+public class VOption : IEnumerable>
+{
+ private readonly Dictionary _internalDictionary = new();
+
+ ///
+ /// Returns an enumerator that iterates through the .
+ ///
+ /// A structure for the .
+ public IEnumerator> GetEnumerator() => _internalDictionary.GetEnumerator();
+
+ ///
+ IEnumerator IEnumerable.GetEnumerator() => _internalDictionary.GetEnumerator();
+
+ ///
+ /// Gets or sets the value associated with the specified key.
+ ///
+ /// The key of the value to get or set.
+ /// The value associated with the specified key.
+ public object this[string key]
+ {
+ get => _internalDictionary[key];
+ set => _internalDictionary[key] = value;
+ }
+
+ ///
+ /// Gets a collection containing the keys in the .
+ ///
+ public Dictionary.KeyCollection Keys => _internalDictionary.Keys;
+
+ ///
+ /// Gets the number of key/value pairs contained in the .
+ ///
+ /// The number of key/value pairs contained in the .
+ public int Count => _internalDictionary.Count;
+
+ ///
+ /// Adds the specified key and value to the .
+ ///
+ /// The key of the element to add.
+ /// The value of the element to add. The value can be null for reference types.
+ public void Add(string key, object value) => _internalDictionary.Add(key, value);
+
+ ///
+ /// Adds the specified key and value to the , if value is present.
+ ///
+ /// The key of the element to add.
+ /// The value of the element to add.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void AddIfPresent(string key, T? value) where T : struct
+ {
+ if (value.HasValue)
+ {
+ _internalDictionary.Add(key, value);
+ }
+ }
+
+ ///
+ /// Adds the specified key and class to the , if class is present.
+ ///
+ /// The key of the element to add.
+ /// The value of the element to add.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void AddIfPresent(string key, T cls) where T : class
+ {
+ if (cls != null)
+ {
+ _internalDictionary.Add(key, cls);
+ }
+ }
+
+ ///
+ /// Adds the specified key and array to the , if array is present.
+ ///
+ /// The key of the element to add.
+ /// The value of the element to add.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void AddIfPresent(string key, T[] array) where T : struct
+ {
+ if (array is { Length: > 0 })
+ {
+ _internalDictionary.Add(key, array);
+ }
+ }
+
+ ///
+ /// Determines whether the contains the specified key.
+ ///
+ /// The key to locate in the .
+ /// if the contains an element with the specified key; otherwise, .
+ public bool ContainsKey(string key) => _internalDictionary.ContainsKey(key);
+
+ ///
+ /// Removes the value with the specified key from the .
+ ///
+ /// The key of the element to remove.
+ /// if the element is successfully found and removed; otherwise, .
+ public bool Remove(string key) => _internalDictionary.Remove(key);
+
+ ///
+ /// Gets the value associated with the specified key.
+ ///
+ /// The key of the value to get.
+ /// When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.
+ /// if the contains an element with the specified key; otherwise, .
+ public bool TryGetValue(string key, out object value) => _internalDictionary.TryGetValue(key, out value);
+}
\ No newline at end of file
diff --git a/vendor/NetVips/VipsBlob.cs b/vendor/NetVips/VipsBlob.cs
new file mode 100644
index 0000000..375f86d
--- /dev/null
+++ b/vendor/NetVips/VipsBlob.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace NetVips;
+
+///
+/// Manage a .
+///
+internal class VipsBlob : SafeHandle
+{
+ ///
+ /// Initializes a new instance of the class
+ /// with the specified pointer to wrap around.
+ ///
+ /// The pointer to wrap around.
+ internal VipsBlob(nint pointer) : base(IntPtr.Zero, true)
+ {
+ // record the pointer we were given to manage
+ SetHandle(pointer);
+ }
+
+ ///
+ /// Get the data from a .
+ ///
+ /// Return number of bytes of data.
+ /// A containing the data.
+ internal nint GetData(out nuint length)
+ {
+ return Internal.VipsBlob.Get(this, out length);
+ }
+
+ ///
+ /// Decreases the reference count of the blob.
+ /// When its reference count drops to 0, the blob is finalized (i.e. its memory is freed).
+ ///
+ /// if the handle is released successfully; otherwise,
+ /// in the event of a catastrophic failure, .
+ protected override bool ReleaseHandle()
+ {
+ if (!IsInvalid)
+ {
+ // Free the VipsArea
+ Internal.VipsArea.Unref(handle);
+ }
+
+ return true;
+ }
+
+ ///
+ /// Gets a value indicating whether the handle is invalid.
+ ///
+ /// if the handle is not valid; otherwise, .
+ public override bool IsInvalid => handle == IntPtr.Zero;
+
+ ///
+ /// Get the number of bytes of data.
+ ///
+ internal ulong Length => Marshal.PtrToStructure(handle).Length;
+
+ ///
+ /// Get the reference count of the blob. Handy for debugging.
+ ///
+ internal int RefCount => Marshal.PtrToStructure(handle).Count;
+}
\ No newline at end of file
diff --git a/vendor/NetVips/VipsException.cs b/vendor/NetVips/VipsException.cs
new file mode 100644
index 0000000..ca70c86
--- /dev/null
+++ b/vendor/NetVips/VipsException.cs
@@ -0,0 +1,44 @@
+using System;
+using NetVips.Internal;
+
+namespace NetVips;
+
+///
+/// Our own exception class which handles the libvips error buffer.
+///
+public class VipsException : Exception
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public VipsException()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class with a specified error message.
+ ///
+ /// The message that describes the error.
+ public VipsException(string message)
+ : base($"{message}{Environment.NewLine}{VipsErrorBuffer()}")
+ {
+ Vips.ErrorClear();
+ }
+
+ ///
+ /// Initializes a new instance of the class with a specified error message
+ /// and a reference to the inner exception that is the cause of this exception.
+ ///
+ /// The error message that explains the reason for the exception.
+ /// The exception that is the cause of the current exception, or a null reference if no inner exception is specified.
+ public VipsException(string message, Exception inner)
+ : base($"{message}{Environment.NewLine}{VipsErrorBuffer()}", inner)
+ {
+ Vips.ErrorClear();
+ }
+
+ private static string VipsErrorBuffer()
+ {
+ return Vips.ErrorBuffer().ToUtf8String();
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/VipsObject.cs b/vendor/NetVips/VipsObject.cs
new file mode 100644
index 0000000..4287cfc
--- /dev/null
+++ b/vendor/NetVips/VipsObject.cs
@@ -0,0 +1,154 @@
+using System;
+using System.Runtime.InteropServices;
+using NetVips.Internal;
+
+namespace NetVips;
+
+///
+/// Manage a .
+///
+public class VipsObject : GObject
+{
+ ///
+ /// Attach a post-close delegate. This is called on finalization.
+ ///
+ ///
+ /// Useful for e.g. deleting the file associated with a temp image.
+ ///
+ public event Action OnPostClose
+ {
+ add => SignalConnect("postclose", value);
+ remove => SignalHandlersDisconnectByFunc(value);
+ }
+
+ ///
+ internal VipsObject(nint pointer) : base(pointer)
+ {
+ }
+
+ ///
+ /// Print a table of all active libvips objects. Handy for debugging.
+ ///
+ internal static void PrintAll()
+ {
+ GC.Collect();
+ Internal.VipsObject.PrintAll();
+ }
+
+ ///
+ /// slow! eeeeew.
+ ///
+ /// Arg to fetch.
+ /// The pspec for this arg.
+ private GParamSpec.Struct? GetPspec(string name)
+ {
+ var argument = Internal.VipsObject.GetArgument(this, name, out var pspec, out _, out _);
+
+ return argument != 0
+ ? default(GParamSpec.Struct?)
+ : Marshal.PtrToStructure(pspec);
+ }
+
+ ///
+ /// Get a GObject property.
+ ///
+ ///
+ /// The value of the property is converted to a C# value.
+ ///
+ /// Arg to fetch.
+ /// The GObject property.
+ internal object Get(string name)
+ {
+ var pspec = GetPspec(name);
+ if (!pspec.HasValue)
+ {
+ throw new VipsException("Property not found.");
+ }
+
+ var gtype = pspec.Value.ValueType;
+ using var gv = new GValue();
+ gv.SetType(gtype);
+
+ // this will add a reference for GObject properties, that ref will be
+ // unreferenced when the GValue is finalized
+ Internal.GObject.GetProperty(this, name, ref gv.Struct);
+
+ return gv.Get();
+ }
+
+ ///
+ /// Set a GObject property. The value is converted to the property type, if possible.
+ ///
+ /// The name of the property to set.
+ /// The value.
+ /// The GType of the property.
+ internal void Set(nint gtype, string name, object value)
+ {
+ using var gv = new GValue();
+ gv.SetType(gtype);
+ gv.Set(value);
+
+ Internal.GObject.SetProperty(this, name, in gv.Struct);
+ }
+
+ ///
+ /// Set a series of properties using a string.
+ ///
+ ///
+ /// For example:
+ /// "fred=12, tile"
+ /// "[fred=12]"
+ ///
+ /// Arguments as a string.
+ /// on success; otherwise, .
+ internal bool SetString(string stringOptions)
+ {
+ var result = Internal.VipsObject.SetFromString(this, stringOptions);
+ return result == 0;
+ }
+
+ ///
+ /// Get the GType of a GObject property.
+ ///
+ /// The name of the GType to get the type of.
+ /// A new instance of initialized to the GType or
+ /// if the property does not exist.
+ public nint GetTypeOf(string name)
+ {
+ var pspec = GetPspec(name);
+ if (!pspec.HasValue)
+ {
+ // need to clear any error, this is horrible
+ Vips.ErrorClear();
+ return IntPtr.Zero;
+ }
+
+ return pspec.Value.ValueType;
+ }
+
+ ///
+ /// Get the blurb for a GObject property.
+ ///
+ /// Arg to fetch.
+ /// The blurb.
+ public string GetBlurb(string name)
+ {
+ var pspec = GetPspec(name);
+ if (!pspec.HasValue)
+ {
+ return null;
+ }
+
+ var pspecValue = pspec.Value;
+ return Marshal.PtrToStringAnsi(GParamSpec.GetBlurb(in pspecValue));
+ }
+
+ ///
+ /// Get the description of a GObject.
+ ///
+ /// The description of a GObject.
+ public string GetDescription()
+ {
+ return Marshal.PtrToStringAnsi(Internal.VipsObject.GetDescription(this));
+ }
+}
\ No newline at end of file
diff --git a/vendor/NetVips/VipsProgress.cs b/vendor/NetVips/VipsProgress.cs
new file mode 100644
index 0000000..8e69214
--- /dev/null
+++ b/vendor/NetVips/VipsProgress.cs
@@ -0,0 +1,74 @@
+using System.Runtime.InteropServices;
+
+namespace NetVips;
+
+///
+/// Records a start time, and counts microseconds elapsed since that time.
+///
+[StructLayout(LayoutKind.Sequential)]
+public struct GTimer
+{
+ ///
+ /// Monotonic start time, in microseconds.
+ ///
+ public ulong Start;
+
+ ///
+ /// Monotonic end time, in microseconds.
+ ///
+ public ulong End;
+
+ ///
+ /// Is the timer currently active?
+ ///
+ [MarshalAs(UnmanagedType.I1)]
+ public bool Active;
+}
+
+///
+/// Struct we keep a record of execution time in. Passed to eval signal so
+/// it can assess progress.
+///
+[StructLayout(LayoutKind.Sequential)]
+public struct VipsProgress
+{
+ ///
+ /// Image we are part of.
+ ///
+ private nint Im;
+
+ ///
+ /// Time we have been running.
+ ///
+ public int Run;
+
+ ///
+ /// Estimated seconds of computation left.
+ ///
+ public int Eta;
+
+ ///
+ /// Number of pels we expect to calculate.
+ ///
+ public long TPels;
+
+ ///
+ /// Number of pels calculated so far.
+ ///
+ public long NPels;
+
+ ///
+ /// Percent complete.
+ ///
+ public int Percent;
+
+ ///
+ /// Start time.
+ ///
+ private nint StartPtr;
+
+ ///
+ /// Start time.
+ ///
+ public GTimer Start => Marshal.PtrToStructure(StartPtr);
+}
\ No newline at end of file
diff --git a/vendor/NetVips/common.props b/vendor/NetVips/common.props
new file mode 100644
index 0000000..0bd0075
--- /dev/null
+++ b/vendor/NetVips/common.props
@@ -0,0 +1,37 @@
+
+
+ NetVips
+ .NET binding for libvips
+ Kleis Auke Wolthuizen
+ en-US
+ Kleis Auke Wolthuizen
+ libvips;bindings;image-processing
+ https://kleisauke.github.io/net-vips
+ MIT
+ git
+ https://github.com/kleisauke/net-vips
+
+ false
+ false
+
+ 11
+
+ 3
+ 1
+ 0
+
+ $(APPVEYOR_BUILD_NUMBER)
+ 0
+
+ -develop
+
+
+ PRERELEASE_NIGHTLY
+ $(DefineConstants);$(PrereleaseLabelConstants)
+
+ $(Major).$(Minor).$(Revision).$(BuildNumber)
+ $(Major).$(Minor).$(Revision).$(BuildNumber)
+ $(Major).$(Minor).$(Revision).$(BuildNumber)$(PrereleaseLabel)
+ $(Major).$(Minor).$(Revision).$(BuildNumber)$(PrereleaseLabel)
+
+
\ No newline at end of file
diff --git a/vendor/NetVips/net6.0/Image.cs b/vendor/NetVips/net6.0/Image.cs
new file mode 100644
index 0000000..6cfded9
--- /dev/null
+++ b/vendor/NetVips/net6.0/Image.cs
@@ -0,0 +1,171 @@
+#if NET6_0_OR_GREATER
+
+using System;
+using System.Runtime.InteropServices;
+using NetVips.Internal;
+
+namespace NetVips;
+
+///
+/// Wrap a object.
+///
+public partial class Image
+{
+ #region helpers
+
+ ///
+ /// Find the name of the load operation vips will use to load a buffer.
+ ///
+ ///
+ /// For example "VipsForeignLoadJpegBuffer". You can use this to work out what
+ /// options to pass to .
+ ///
+ /// The buffer to test.
+ /// Length of the buffer.
+ /// The name of the load operation, or .
+ private static unsafe string FindLoadBuffer(void* data, ulong size) =>
+ Marshal.PtrToStringAnsi(VipsForeign.FindLoadBuffer(data, size));
+
+ ///
+ /// Find the name of the load operation vips will use to load a buffer.
+ ///
+ ///
+ /// For example "VipsForeignLoadJpegBuffer". You can use this to work out what
+ /// options to pass to .
+ ///
+ /// The buffer to test.
+ /// The name of the load operation, or .
+ public static unsafe string FindLoadBuffer(ReadOnlySpan data)
+ {
+ fixed (byte* dataFixed = data)
+ {
+ return FindLoadBuffer(dataFixed, (ulong)data.Length);
+ }
+ }
+
+ #endregion
+
+ #region constructors
+
+ ///
+ /// Load a formatted image from memory.
+ ///
+ ///
+ /// This behaves exactly as , but the image is
+ /// loaded from the memory object rather than from a file. The memory
+ /// object can be a string or buffer.
+ ///
+ /// The memory object to load the image from.
+ /// Load options as a string. Use for no options.
+ /// Hint the expected access pattern for the image.
+ /// The type of error that will cause load to fail. By
+ /// default, loaders are permissive, that is, .
+ /// Optional options that depend on the load operation.
+ /// A new .
+ /// If unable to load from .
+ public static unsafe Image NewFromBuffer(
+ ReadOnlySpan data,
+ string strOptions = "",
+ Enums.Access? access = null,
+ Enums.FailOn? failOn = null,
+ VOption kwargs = null)
+ {
+ fixed (byte* dataFixed = data)
+ {
+ var operationName = FindLoadBuffer(dataFixed, (ulong)data.Length);
+ if (operationName == null)
+ {
+ throw new VipsException("unable to load from buffer");
+ }
+
+ var options = new VOption();
+ if (kwargs != null)
+ {
+ options.Merge(kwargs);
+ }
+
+ options.AddIfPresent(nameof(access), access);
+ options.AddFailOn(failOn);
+
+ options.Add("string_options", strOptions);
+
+ var ptr = Internal.VipsBlob.Copy(dataFixed, (nuint)data.Length);
+ if (ptr == IntPtr.Zero)
+ {
+ throw new VipsException("unable to load from buffer");
+ }
+
+ using var blob = new VipsBlob(ptr);
+ return Operation.Call(operationName, options, blob) as Image;
+ }
+ }
+
+ ///
+ /// Wrap an image around a memory array.
+ ///
+ /// A .
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Number of bands.
+ /// Band format.
+ /// A new .
+ /// If unable to make image from .
+ public static unsafe Image NewFromMemory(
+ ReadOnlyMemory data,
+ int width,
+ int height,
+ int bands,
+ Enums.BandFormat format) where T : unmanaged
+ {
+ var handle = data.Pin();
+ var vi = VipsImage.NewFromMemory(handle.Pointer, (nuint)data.Length, width, height, bands,
+ format);
+ if (vi == IntPtr.Zero)
+ {
+ handle.Dispose();
+
+ throw new VipsException("unable to make image from memory");
+ }
+
+ var image = new Image(vi) { MemoryPressure = data.Length };
+
+ // Need to release the pinned MemoryHandle when the image is closed.
+ image.OnPostClose += () => handle.Dispose();
+
+ return image;
+ }
+
+ ///
+ /// Like , but
+ /// for , so we must copy as it could be allocated on the stack.
+ ///
+ /// A .
+ /// Image width in pixels.
+ /// Image height in pixels.
+ /// Number of bands.
+ /// Band format.
+ /// A new .
+ /// If unable to make image from .
+ public static unsafe Image NewFromMemoryCopy(
+ ReadOnlySpan data,
+ int width,
+ int height,
+ int bands,
+ Enums.BandFormat format) where T : unmanaged
+ {
+ fixed (T* dataFixed = data)
+ {
+ var vi = VipsImage.NewFromMemoryCopy(dataFixed, (nuint)data.Length, width, height, bands, format);
+ if (vi == IntPtr.Zero)
+ {
+ throw new VipsException("unable to make image from memory");
+ }
+
+ return new Image(vi) { MemoryPressure = data.Length };
+ }
+ }
+
+ #endregion
+}
+
+#endif
\ No newline at end of file
diff --git a/vendor/NetVips/net6.0/Source.cs b/vendor/NetVips/net6.0/Source.cs
new file mode 100644
index 0000000..2beb512
--- /dev/null
+++ b/vendor/NetVips/net6.0/Source.cs
@@ -0,0 +1,47 @@
+#if NET6_0_OR_GREATER
+
+using System;
+
+namespace NetVips;
+
+///
+/// An input connection.
+///
+public partial class Source
+{
+ ///
+ /// Make a new source from a memory object.
+ ///
+ ///
+ /// Make a new source that is attached to the memory object. For example:
+ ///
+ /// using var source = Source.NewFromMemory(data);
+ ///
+ /// You can pass this source to (for example) .
+ ///
+ /// The memory object.
+ /// A new .
+ /// If unable to create a new from .
+ public static unsafe Source NewFromMemory(ReadOnlySpan data)
+ {
+ fixed (byte* dataFixed = data)
+ {
+ var ptr = Internal.VipsBlob.Copy(dataFixed, (nuint)data.Length);
+ if (ptr == IntPtr.Zero)
+ {
+ throw new VipsException("can't create input source from memory");
+ }
+
+ using var blob = new VipsBlob(ptr);
+ var pointer = Internal.VipsSource.NewFromBlob(blob);
+ if (pointer == IntPtr.Zero)
+ {
+ throw new VipsException("can't create input source from memory");
+ }
+
+ return new Source(pointer);
+ }
+ }
+}
+
+#endif
\ No newline at end of file