PeachImage
PeachImage
ResizeOptions Class
Options controlling Resize(int, int, ResizeOptions) and Resize(int, int, ResizeOptions).
public class ResizeOptions
Inheritance System.Object → ResizeOptions
| Properties | |
|---|---|
| AlwaysCopy | When true, Resize(int, int, ResizeOptions) always returns a new, independently owned image, even when the source already fits (Max) or already has the requested size (Crop and Pad) and the result would otherwise be the source itself. Disposing the result and the source can then never interfere. Defaults to false. |
| Anchor | Which part of the source survives cropping (Crop), or where the source sits within the padded canvas (Pad). Defaults to MiddleCenter. Ignored for Exact and Max. |
| BackgroundColor | The fill color used by Pad for the padded border around the source. When null, defaults to white if the target PixelFormat has no alpha channel, or transparent if it does. Ignored for every other ResizeMode. |
| CopyMetadata | When true, the resized image carries the source’s resolution and metadata profiles (ICC, EXIF, XMP, ...), which Resize(int, int, ResizeOptions) otherwise drops. EXIF is carried unchanged, so apply the image’s orientation first (see ApplyOrientationInPlace(ImageOrientation)), which resets it. Defaults to false. |
| Filter | The resampling filter to reconstruct pixel values with. Defaults to Bicubic. |
| MaxDegreeOfParallelism | The most threads one resize call may use. -1 (the default) leaves it to the library, which fans out over up to System.Environment.ProcessorCount workers; 1 resizes sequentially on the calling thread. The limit is per call, not global: concurrent calls each use up to this many, so cap the total with TaskScheduler. Does not change the output. |
| Mode | How the requested width/height is interpreted. Defaults to Exact. Set to Max to instead treat width/height as a bounding box — the largest size that fits within it, preserving aspect ratio, without ever upscaling. |
| TaskScheduler | An optional scheduler the resize’s parallel work runs on, so a host can share one limit across concurrent calls (for example the System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.ConcurrentScheduler of a pair created with a bounded concurrency level). null (the default) uses the thread pool. |