← [author guide](../author-guide.md) A patch with **`"Action": "EditImage"`** changes part of an image loaded by the game. Any number of content packs can edit the same asset. You can extend an image downwards by just patching past the bottom (Content Patcher will expand the image to fit). **🌐 In other languages: [zh (中文)](../zh/author-guide/action-editimage.md)**. ## Contents * [Usage](#usage) * [Format](#format) * [Examples](#examples) * [See also](#see-also) ## Usage ### Format An `EditImage` patch consists of a model under `Changes` (see examples below) with these fields:
The part of the source image to copy. Defaults to the whole source image.
This is specified as an object with the X and Y pixel coordinates of the top-left corner, and the pixel width and height of the area. Its fields may contain tokens.
`ToArea` |The part of the target image to replace. Defaults to the same size as `FromArea`, positioned at the top-left corner of the spritesheet.
This is specified as an object with the X and Y pixel coordinates of the top-left corner, and the pixel width and height of the area. Its fields may contain tokens.
If you specify an area past the bottom edge of the image, the image will be resized automatically to fit.
`PatchMode` |How to apply `FromArea` to `ToArea`. Defaults to `Replace`.
Possible values:Replace: replace every pixel in the target area with your source image. If the source image has transparent pixels, the target image will become transparent there.Overlay: draw your source image over the target area. If the source image has transparent or semi-transparent pixels, the target image will 'show through' those pixels. Opaque pixels will replace the target pixels.`Mask`: apply the source image as a _transparency mask_, which subtracts the opacity of each pixel in the mask from the same pixel in the target image. For example, a fully opaque pixel in the mask results in a fully transparent pixel in the final image. (Colors in the mask image are ignored; only transparency matters.)
The `Mask` mode is often used to delete specific areas in a spritesheet before editing in new sprites, which is much more efficient than having a separate edit for each sprite.
| field | purpose |
Priority |
_(optional)_ When multiple patches or mods edit the same asset, the order in which they should be applied. The possible values are `Early`, `Default`, and `Late`. The default value is `Default`. The patches for an asset (across all mods) are applied in this order: 1. by earliest to latest priority; 2. then by mod load order (e.g. based on dependencies); 3. then by the order the patches are listed in your `content.json`. If you need a more specific order, you can use a simple offset like `"Default + 2"` or `"Late - 10"`. The default levels are -1000 (early), 0 (default), and 1000 (late). This field does _not_ support tokens, and capitalization doesn't matter. > [!TIP] > Priorities can make your changes harder to follow and troubleshoot. Suggested best practices: > * Consider only using very general priorities when possible (like `Late` for a cosmetic overlay > meant to be applied over base edits from all mods). > * There's no need to set priorities relative to _your own_ patches, since you can just list them > in the order they should be applied. |
TargetLocale |
_(optional)_ The locale code to match in the asset name. For example, setting `"TargetLocale": "fr-FR"` will only edit the French localized form of the asset (e.g. `Animals/Dinosaur.fr-FR`). This can be an empty string to only edit the base unlocalized asset. If omitted, it's applied to all localized and unlocalized variants of the asset. |