Art Engine
Core Plugins
Image Layers Attributes

Image Layers Attributes Generator

The Image Layers Attributes Generator is a core generator plugin designed to generate attributes and assets for image layers in the Art Engine. It takes an input dataset of image layers and their options, calculates unique DNA for each generated item, and randomly selects attributes based on the provided weights. It also handles edge cases for assets that depend on specific attribute combinations.

Adding the plugin

  1. Import the plugin object:
const { ArtEngine, generators } = require("@hashlips-lab/art-engine");
  1. Setup a base path:
const BASE_PATH = __dirname;
  1. Add the plugin to an instance of the Art Engine:
const ae = new ArtEngine({
  cachePath: `${BASE_PATH}/cache`,
  outputPath: `${BASE_PATH}/output`,
  useCache: false,
  generators: [
    new generators.ImageLayersAttributesGenerator({
      dataSet: "apes", // Replace "apes" with your actual dataset key
      startIndex: 1,   // Start index for generating items
      endIndex: 10,    // End index for generating items
    // Add more generators if needed...
  // Add inputs, renderers, and exporters as required...


  • dataSet: A string representing the key of the input dataset containing image layers and their options. The dataset should be set up using the Image Layers Input plugin.
  • startIndex: An integer representing the starting index for generating items.
  • endIndex: An integer representing the ending index for generating items.


The Image Layers Attributes Generator depends on the Image Layers Input plugin, which provides the input dataset structure with image layers and their options. The apes key is used as an example dataset key, but in your project, you should replace it with the actual key used for your image layers input.



This plugin adheres to the base generator interface called GeneratorInterface<GeneratorDataType>.


The Image Layers Attributes Generator plugin is a prime example of a generator in the Art Engine ecosystem. It adheres to the core generator interface and implements specialized output interfaces for the attributes it generates.

Two custom interfaces are essential for the Image Layers Attributes Generator:

  • ImageLayersGeneratorInterface:
export default interface ImageLayersGeneratorInterface {
  assets: {
    path: string;
    xOffset: number;
    yOffset: number;
    zOffset: number;
  • ItemAttributesGeneratorInterface:
export default interface ItemAttributesGeneratorInterface {
  dna: string;
  attributes: {
    [traitName: string]: string;

In the context of the Image Layers Attributes Generator, these interfaces define the structure of the generated attributes. The generator can produce either image layer information or item attributes.

The ImageLayersAttributesGenerator class encapsulates this functionality and implements the GeneratorInterface by utilizing the GeneratorOutput type:

type GeneratorOutput =
  | ImageLayersGeneratorInterface
  | ItemAttributesGeneratorInterface;
class ImageLayersAttributesGenerator
  implements GeneratorInterface<GeneratorOutput> {
  // Implementation details

This enables the Image Layers Attributes Generator to seamlessly integrate into the Art Engine, produce diverse attributes, and contribute to the creation of layered and customizable artwork.