Mipmaps
The mipmap plugin generates mipmaps for images, creating multiple resolutions of the same image. This is particularly useful for optimizing graphics in web games, where different resolutions are needed for various screen sizes and device capabilities.
info
When generating multiple resolutions, the plugin assumes that the original image is at the highest resolution. The plugin will then generate lower-resolution versions of the image based on the specified template and resolutions.
Example
Original


import { mipmap } from "@assetpack/core/image";
export default {
...
pipes: [
...
// these options are the default values, all options shown here are optional
mipmap({
template: "@%%x",
resolutions: { default: 1, low: 0.5 }, // { high: 2, default: 1, low: 0.5 }
fixedResolution: "default",
}),
]
};
Example: custom resolution
Original


import { mipmap } from "@assetpack/core/image";
export default {
...
pipes: [
...
mipmap({
resolutions: { high: 2, default: 1, low: 0.5 },
}),
]
};
API
Option | Type | Description |
---|---|---|
template | string | A template for denoting the resolution of the images. Defaults to @%%x . |
resolutions | object | An object containing the resolutions that the images will be resized to. Defaults to { default: 1, low: 0.5 } . |
fixedResolution | string | A resolution used if the fix tag is applied e.g. Resolution must match one found in resolutions. Defaults to default . |
Tags
Tag | Folder/File | Description |
---|---|---|
fix | both | If present the fixedResolution will be used. No other resolutions will be generated. Note that the image will be resized to the resolution specified in fixedResolution . If you don't want the image to be resized please use the nomip tag. |
nomip | both | If present mipmaps will not be generated. |
Example: fixed resolution
Original

