Class IcnsWriterOptions
Options for writing ICNS. Each raster becomes one PNG entry, or one entry per size in Sizes; entries are 8-bit RGBA, sorted smallest first, and a table of contents comes first as macOS writes it. EXIF, XMP and IPTC are not written.
public sealed class IcnsWriterOptions : WriterOptions
- Inheritance
-
IcnsWriterOptions
- Inherited Members
Examples
// A macOS app icon: 16 to 1024, each resized from one raster. A raster that is not square is centred on transparency.
logo.Save("app.icns", new IcnsWriterOptions { Sizes = IcnsWriterOptions.MacSizes, Filter = Egami.Operations.ResampleFilter.Lanczos3 });
// Hand-drawn small sizes: each raster goes in the entry size it fills, centred on transparency.
using Raster<Rgba8> drawn16 = logo.Derive(ops => ops.Fit(16, 16));
using Raster<Rgba8> large = logo.Derive(ops => ops.Fit(512, 512));
Raster.SaveAll([large, drawn16], "drawn.icns");
Properties
Default
Gets the default options.
public static IcnsWriterOptions Default { get; }
Property Value
Filter
Gets the filter that resizes rasters to their entries, as for Resize. Defaults to Bicubic.
public ResampleFilter Filter { get; init; }
Property Value
MacSizes
Gets the sizes an app icon has on macOS: 16, 32, 64, 128, 256, 512 and 1024, the ones each point size needs at 1× and 2×.
public static IReadOnlyList<int> MacSizes { get; }
Property Value
Sizes
Gets the square sizes to write, each one of MacSizes, or null (the default) to write each raster at the largest of those sizes that it fills, so a raster of one of those sizes is written as it is. Each size comes from a raster of exactly that size when one is given, otherwise from the largest raster resized with Filter; a raster that is not square is fitted inside the square and centred on transparency.
public IReadOnlyList<int>? Sizes { get; init; }
Property Value
Exceptions
- ArgumentOutOfRangeException
A size is not one of MacSizes.
- ArgumentException
The list is empty or names a size twice.