[Tiler] Durden version 1.3 (c) 2024 Carl Svensson, www.datagubbe.se.
Find unique, arbitrarily-sized tiles in a given image and mark and/or
save them in new files.

This program may be distributed and used free of charge.
The program, in whole or in part, may not be modified or
sold without the explicit written consent of the author.
Disclaimer: This program comes without any warranty whatsoever.
            Use it at your own risk.

Arguments:
  <FILENAME>
    The source image for counting, extracting and marking tiles.
    Files are expected to be in non-lossy bitmap formats in RGB, RGBA
    or with a fixed, indexed palette.
  w=<TILE WIDTH>   (Default 16)
    Set tile width to the supplied value.
    Must be a multiple of the source image width.
  h=<TILE HEIGHT>  (Default 16)
    Set tile height to the supplied value.
    Must be a multiple of the source image height.
  wh=<TILE SIZE>   (Default 16)
    Sets tile width and tile height to the supplied value.
    Must be a multiple of the source image height.
  m=<MARK INDEX>   (Default None)
    A palette index in a fixed-palette source image used for
    marking repeating tiles (see below).

Flags:
  mark   Mark repeating tiles in a copy of the source image and save the copy.
         * In a 24-bit RGB image, repeating tiles will be marked with red
           (RGB 255, 0, 0).
         * In an 8-bit indexed image, repeating tiles will be marked with
           the palette index supplied using the "m=" argument.

  alpha  Mark repeating tiles with half opacity alpha channel. Requires
         that the source image is in RGBA format.

  save   Cut unique tiles out and save them. The resulting tiles are
         saved in a directory called "<FILE_NAME>_tiles". If the
         directory doesn't exist, it will be created.

Examples:
  $ durden "my image.png" wh=8 save
      * Find unique 8x8 pixel tiles in the file "my image.png"
      * Save all unique tiles in a directory that will be
        named "my image.png_tiles".

  $ durden "sea_back.png" w=16 h=8 mark m=255
      * Find unique 16x8 pixel tiles in the file "sea_back.png".
      * Mark all repeating tiles with the colour in palette index 255.
      * Save the result in "marked_sea_back.png".

  $ durden "bg_graphics.png" mark alpha
      * Find unique 16x16 pixel tiles in the file "bg_graphics.png".
      * Mark all repeating tiles with half opacity alpha channel.
      * Save the result in "marked_bg_graphics.png".
