UNPKG

appiconkit

Version:

An app icon/image assets generator for Apple platforms and favicon for web.

68 lines (67 loc) 2.87 kB
declare type ImageFormat = 'bmp' | 'gif' | 'jpeg' | 'png' | 'tiff' | 'default'; declare type IconPlatform = 'ios' | 'iphone' | 'ipad' | 'watchos' | 'watch' | 'macos' | 'mac' | 'web'; declare type GeneratorType = 'icon' | 'image' | 'iconset' | 'imageset'; interface GeneratorOption { type: GeneratorType; platform: IconPlatform; width?: number; height?: number; format?: ImageFormat; } interface ResizeOption { width: number; height: number; filename?: string; format?: ImageFormat; } /** * Generator class for iconset/imageset. */ declare class IconGenerator { /** * Constructs an IconGenerator object. */ constructor(); /** * Generates .appiconset with a given image. Image must be larger than 1024x1024. * @param inputPath path of input image * @param outputPath path of output app icon * @param platform platform of app icon (ios | watchos | macos) */ generateIconSet(inputPath: string, outputPath: string, platform?: IconPlatform): Promise<void>; /** * Generates .imageset with a given image. * Parameters width and height are for generated @1x image. If both weight and * height are given, the image will be resized to exactly weight and height. If * one of width and height is given, it will automatically choose the other * dimension for the resized images. If none of them is given, the original image * is used as @3x. * @param inputPath path of input image * @param outputPath path of output image set * @param width @1x width of the output image * @param height @1x height of the output image */ generateImageSet(inputPath: string, outputPath: string, width?: number, height?: number): Promise<void>; /** * Generates .appiconset or .imageset or favicon with a given image. * @param inputPath path of input image * @param outputPath path of output images * @param generatorOption options for image generator */ generateImageAssets(inputPath: string, outputPath: string, generatorOption?: GeneratorOption): Promise<void>; /** * Generate web manifest icon images. * @param inputPath path of input image. * @param outputPath path of output image. */ generateWebIconImages(inputPath: string, outputPath: string): Promise<void>; /** * Generate resized images with generic options. * @param inputPath path of input image. * @param outputPath path of output image. * @param options generic options for resizing images. */ generateImages(inputPath: string, outputPath: string, options: Array<ResizeOption>): Promise<void>; private createDirectoryIfNeeded; } export { GeneratorOption, GeneratorType, IconGenerator, IconPlatform, ImageFormat, ResizeOption, };