{"id":21945984,"url":"https://github.com/mateoconlechuga/convimg","last_synced_at":"2025-04-22T21:32:32.184Z","repository":{"id":45065621,"uuid":"47855426","full_name":"mateoconlechuga/convimg","owner":"mateoconlechuga","description":"Image palette quantization","archived":false,"fork":false,"pushed_at":"2025-04-10T05:35:20.000Z","size":1301,"stargazers_count":31,"open_issues_count":1,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-18T13:48:53.512Z","etag":null,"topics":["png","ti84plusce"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mateoconlechuga.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-12-11T23:05:26.000Z","updated_at":"2025-04-10T05:33:37.000Z","dependencies_parsed_at":"2024-01-17T07:04:18.561Z","dependency_job_id":"d1e57926-6a65-408c-995c-299f4f92c587","html_url":"https://github.com/mateoconlechuga/convimg","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateoconlechuga%2Fconvimg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateoconlechuga%2Fconvimg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateoconlechuga%2Fconvimg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateoconlechuga%2Fconvimg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mateoconlechuga","download_url":"https://codeload.github.com/mateoconlechuga/convimg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250328561,"owners_count":21412635,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["png","ti84plusce"],"created_at":"2024-11-29T04:21:19.638Z","updated_at":"2025-04-22T21:32:32.159Z","avatar_url":"https://github.com/mateoconlechuga.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# convimg [![Build Status](https://github.com/mateoconlechuga/convimg/actions/workflows/make.yml/badge.svg)](https://github.com/mateoconlechuga/convimg/actions/workflows/make.yml) [![Coverity Scan](https://scan.coverity.com/projects/23542/badge.svg)](https://scan.coverity.com/projects/mateoconlechuga-convimg)\n\nThis program is used to convert images to particular color formats and source includes.\nIt primarily is used for the TI-84+CE and related calculator series, however can be used as a standalone program.\n\n## Command Line Help\n\n    Usage:\n        convimg [options]\n\n    Optional options:\n        -i, --input \u003cyaml file\u003e  Input file, format is described below.\n        -n, --new                Create a new template YAML file.\n        -h, --help               Show this screen.\n        -v, --version            Show program version.\n        -c, --clean              Deletes files listed in 'convimg.out' and exits.\n        -t, --threads \u003ccount\u003e    Set number of threads when converting. Default 4.\n        -l, --log-level \u003clevel\u003e  Set program logging level:\n                                 0=none, 1=error, 2=warning, 3=normal\n    Optional icon options:\n        --icon \u003cfile\u003e            Create an icon for use by shell.\n        --icon-description \u003ctxt\u003e Specify icon/program description.\n        --icon-format \u003cfmt\u003e      Specify icon format, 'ice' or 'asm'.\n        --icon-output \u003coutput\u003e   Specify icon output filename.\n\n    YAML File Format:\n\n        A YAML file is a human-readable text file that is used by this program\n        to create palettes, convert images, and output the results to a supported\n        format. A palette is a list of colors that an image or group of images uses.\n        This saves memory by having a fixed number of colors rather than storing\n        a color for every pixel in the image.\n\n        The YAML file consists of three key components: palette generation, image\n        conversion, and output formatting. These components are broken down into\n        different sections of a YAML file, shown below:\n\n            palettes:\n              - name: mypalette           : Palette and name of palette\n                images: automatic         : Automatically get list of images\n\n            converts:\n              - name: myimages            : Convert images section\n                palette: mypalette        : Use the above generated palette\n                images:                   : List of input images\n                  - image1.png\n                  - image2.png\n                  - image3.png\n\n            outputs:                      : List of outputs\n              - type: c                   : Sets the output format to C\n                include-file: gfx.h       : File name containing all images/palettes\n                palettes:                 : Start of palettes list in the output\n                  - mypalette             : Name of each palette, separated by line\n                converts:                 : Converted sections, based on name\n                  - myimages              : Name of each convert section\n\n    To create the above template, use the '--new' command line option.\n    By default 'convimg.yaml' in the same directory the program is executed\n    will be used for conversion - this can be overriden with the -i flag.\n    The following describes each section of the YAML file in more detail, and\n    the available options for conversion.\n\n    --------------------------------------------------------------------------------\n\n    palettes:\n        The YAML palettes section constists of a list of different palettes to be\n        generated. List entires start with the name of the palette to create.\n\n         - name: \u003cpalette name\u003e       : Name of palette. This is used by the\n                                      : convert blocks for detecting which\n                                      : palette to use, as well as the name\n                                      : used in the output code files.\n                                      : Required parameter.\n\n           max-entries: \u003cnum\u003e         : Number of maximum colors available\n                                      : in the palette. Range is 2-256.\n                                      : Default is 256.\n\n           fixed-entries:             : Adds fixed color entries to the\n                                      : palette. The format is:\n                                      :\n                                      :  fixed-entries:\n                                      :    - color: {index: 0, r: 9, g: 10, b: 0}\n                                      :    - color: {index: 1, r: 2, g: 83, b: 5}\n                                      :    - color: {index: 2, hex: \"#945D3A\"}\n                                      :    - color: {index: 3, hex: \"#C54DCE\"}\n                                      :\n                                      : Note the spaces between key/value pairs.\n                                      : 'index' represents the palette entry\n                                      : used for the color, r is the red amount,\n                                      : g is the green amound, and b is the blue\n                                      : amount of the color. This is often\n                                      : called the \"rgb\" value of a color.\n                                      : A quoted \"hex\" string beginning with '#'\n                                      : can also be used instead.\n                                      : 'exact' is used to match colors exactly\n                                      : to the input color before quantization.\n                                      : It is an optional parameter, defaults to\n                                      : 'false' but can be 'true'.\n                                      : Fixed entries can also be supplied via\n                                      : an image, 1 pixel in height (and a\n                                      : width \u003c= 256) where each pixel in the\n                                      : image represents an entry:\n                                      :\n                                      :   fixed-entries:\n                                      :     - image: palette.png\n                                      :\n                                      : There can be up to 256 fixed entries.\n                                      : With the image method, the starting\n                                      : index is 0 and increments by 1 moving\n                                      : from left to right.\n\n           quality: \u003cvalue\u003e           : Sets the quality of the generated palette.\n                                      : Value range is 1-10, where 1 is the worst\n                                      : and 10 is the best. Lower quality may use\n                                      : less palette entries.\n                                      : Default is 8.\n\n           images: \u003coption\u003e           : A list of images separated by a newline\n                                      : and indented with a leading '-'\n                                      : character. These images are quantized\n                                      : in order to produce a palette that\n                                      : best matches with these images.\n                                      : \u003coption\u003e can be 'automatic' to\n                                      : automatically get the images from the\n                                      : convert blocks that are using them,\n                                      : without having to specify the images\n                                      : twice. Note that common \"globbing\"\n                                      : patterns can be used, such as '*'.\n\n    --------------------------------------------------------------------------------\n\n    converts:\n        The YAML converts section constists of a list of different \"groups\" of\n        images to be converted that share similar properties, such as the palette\n        used, or the compression mode. The available options are:\n\n         - name: \u003cconvert name\u003e       : Name of convert. This is used by the\n                                      : outputs for detecting which converted\n                                      : images to output.\n                                      : Required parameter.\n\n           palette: \u003cpalette name\u003e    : Name of palette used to quantize images\n                                      : against. This is the name of a palette\n                                      : block. Built-in palettes also exist,\n                                      : namely 'xlibc' and 'rgb332'.\n\n           palette-offset: \u003cindex\u003e    : Converts assuming a palette has\n                                      : a different base index.\n                                      : Defaults to '0'.\n\n           images:                    : A list of images separated by a newline\n                                      : and indented with a leading '-'\n                                      : character. These images are quantized\n                                      : against the palette.\n                                      : Note that common \"globbing\"\n                                      : patterns can be used, such as '*'.\n\n           tilesets:                  : A group of tilesets. There can be only one\n                                      : tileset group per conversion block.\n                                      : Tilesets are special images consisting of\n                                      : multiple \"tiles\" of fixed width and\n                                      : height. The format for this option is:\n                                      :\n                                      : tilesets:\n                                      :   tile-width: 16\n                                      :   tile-height: 16\n                                      :   images:\n                                      :     - tileset1.png\n                                      :     - tileset2.png\n                                      :\n                                      : Above, each tileset in the list is\n                                      : composed of tiles of a width and height\n                                      : of 16 pixels. Tile numbers are determined\n                                      : starting from the top left, moving right\n                                      : to the bottom-right.\n                                      : Optional fields are:\n                                      :   'tile-rotate': rotate tiles 90, 180, 270.\n                                      :   'tile-flip-x': flip tiles across x axis.\n                                      :   'tile-flip-y': flip tiles across y axis.\n                                      :   'pointer-table': output tile pointers\n\n           transparent-index: \u003cindex\u003e : Transparent color index in the palette\n                                      : that represents a transparent color.\n                                      : This only is used in two cases!\n                                      : When converting 'rlet' images,\n                                      : or for assigning pixels in the source\n                                      : image that have an alpha channel.\n                                      : If the alpha chanel is 0 in an pixel,\n                                      : the converted output will be assigned\n                                      : this value.\n                                      : Generally, you want transparency to be.\n                                      : defined as a 'fixed-entry' color in the\n                                      : palette instead of using this option.\n                                      : Default is '0'.\n\n           style: \u003cmode\u003e              : Style controls the converted format of\n                                      : images. In 'palette' mode, converted\n                                      : images map 1-1 where each pixel byte\n                                      : represents a palette index.\n                                      : In 'rlet' mode, the transparent color\n                                      : index is used to compress runs of\n                                      : transparent colors, essentially reducing\n                                      : the output size if there are many\n                                      : transparent pixels.\n                                      : In 'direct' mode, the color format\n                                      : defined by the 'color-format' option\n                                      : converts the input image colors to the\n                                      : desired format. This may prevent some\n                                      : palette-specific options from being used.\n                                      : Default is 'palette'.\n\n           color-format: \u003cformat\u003e     : In direct style mode, sets the colorspace\n                                      : for the converted pixels. The available\n                                      : options are 'rgb565', 'bgr565', 'rgb888',\n                                      : 'bgr888', and 'rgb1555'.\n                                      : Default is 'rgb565'.\n\n           compress: \u003cmode\u003e           : Images can be optionally compressed after\n                                      : conversion and quantization.\n                                      : Available compression modes are below.\n\n           width-and-height: \u003cbool\u003e   : Optionally control if the width and\n                                      : height should be placed in the converted\n                                      : image; the first two bytes respectively.\n                                      : Default is 'true'\n\n           flip-x: \u003cbool\u003e             : Flip input images vertically across the\n                                      : x-axis\n\n           flip-y: \u003cbool\u003e             : Flip input images horizontally across the\n                                      : y-axis\n\n           rotate: \u003cdegrees\u003e          : Rotate input images 0, 90, 180, 270 degrees\n\n           bpp: \u003cbits-per-pixel\u003e      : Map input pixels to number of output bits.\n                                      : Available options are 1, 2, 4, 8.\n                                      : For example, a value of 2 means that 1 pixel\n                                      : in the input image maps to 2 bits of output.\n                                      : The palette option 'max-entries' should be\n                                      : used to limit the palette size for this\n                                      : option to ensure correct quantization.\n                                      : Default is '8'.\n\n           omit-indices: [\u003clist\u003e]     : Omits the specified palette indices\n                                      : from the converted image. May be useful\n                                      : by a custom drawing routine. A comma\n                                      : separated list in [] should be provided.\n\n    --------------------------------------------------------------------------------\n\n    outputs:\n        The YAML file outputs section is a list of different \"groups\" of outputs,\n        differing in types or images. The currently available formats are:\n\n         - type: c                    : C source and header files\n         - type: asm                  : Assembly and include files\n         - type: bin                  : Binary and listing files\n         - type: basic                : Single string formatted file\n         - type: appvar               : TI archived AppVar format\n\n        The different options available for outputs are:\n\n           include-file: \u003cfile\u003e       : Output file containing all the graphics\n                                      : Defaults to \"gfx.h\", \"gfx.inc\",\n                                      : \"bin.txt\", and \"basic.txt\" for C, Asm,\n                                      : Binary, and BASIC formats respectively.\n\n           palettes:                  : A list of generated palettes, separated\n                                      : by a newline and indented with the '-'\n                                      : character.\n\n           converts:                  : A list of convert sections, separated\n                                      : by a newline and indented with the '-'\n                                      : character.\n\n           directory: \u003cdirectory\u003e     : Supply the name of the output directory.\n                                      : Defaults to the current directory.\n\n           prepend-palette-sizes:     : Prepend the palette with a 2-byte\n               \u003cbool\u003e                 : entry containing the total size in\n                                      : bytes of the palette.\n                                      : Default is 'false'.\n\n           const: \u003cbool\u003e              : Only applicable to C outputs.\n                                      : Adds the 'const' parameter to output types.\n                                      : Default is 'false'.\n\n       AppVars are a special type of output and require a few more options.\n       The below options are only available for AppVars, however the above\n       options can also be used.\n\n           name: \u003cappvar name\u003e        : Name of AppVar, maximum 8 characters.\n                                      : Required parameter.\n\n           source-format: \u003cformat\u003e    : Source files to create to access\n                                      : image and palette data. format can be\n                                      : 'c', 'ice', 'asm', or 'none'.\n                                      : Default is 'none'.\n\n           source-init: \u003cbool\u003e        : Whether to output AppVar initialization\n                                      : code for loading and setting up image\n                                      : and palette pointers. Default is 'true'\n                                      : Only compatible with source-format: 'c'.\n\n           lut-entries: \u003cbool\u003e        : Embeddeds a lookup table (LUT) for\n                                      : determining the image offsets in the\n                                      : appvar. Format consists of an entry\n                                      : containing the table size, followed by\n                                      : the LUT entries. Entry sizes are\n                                      : controlled via the parameter\n                                      : 'lut-entry-size'. Default is 'false'.\n\n           lut-entry-size: \u003cint\u003e      : Controls the size of LUT entries. Can be\n                                      : '2' for 2-byte or '3' for 3-byte entries.\n                                      : Default is '3'.\n\n           compress: \u003cmode\u003e           : Compress AppVar data.\n                                      : The AppVar then needs to be decompressed\n                                      : to access image and palette data.\n                                      : Optional parameter.\n                                      : Available compression modes are below.\n\n           header-string: \u003cstring\u003e    : Prepends \u003cstring\u003e to the start of the\n                                      : AppVar's data.\n                                      : Use double quotes to properly interpret\n                                      : escape sequences.\n\n           archived: \u003cbool\u003e           : 'true' makes the AppVar archived, while\n                                      : 'false' leaves it unarchived.\n                                      : Default is 'false'.\n\n           comment: \u003cstring\u003e          : AppVar 8xv comment section string\n\n    --------------------------------------------------------------------------------\n\n    Available Compression Modes:\n        These different compression modes can be used to achieve different results.\n        Some provide better compression ratio at the cost of slower compression,\n        and potentially slower decompression as well.\n\n           \"zx0\"                    : Best ratio, slowest (de)compression\n\n           \"zx7\"                    : Moderate ratio, moderate (de)compression\n\n           \"lz4\"                    : Worst ratio, fastest (de)compression\n\n    --------------------------------------------------------------------------------\n\n    Credits:\n        (c) 2017-2025 by Matt \"MateoConLechuga\" Waltz.\n\n        This program utilizes the following libraries:\n            libimagequant: (c) 2009-2022 by Kornel Lesiński.\n            libyaml: (c) 2006-2022 by Ingy döt Net \u0026 Kirill Simonov.\n            stb: (c) 2017 by Sean Barrett.\n            lz4: (c) 2011-2020 by Yann Collet.\n            zx0,zx7: (c) 2012-2022 by Einar Saukas.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateoconlechuga%2Fconvimg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmateoconlechuga%2Fconvimg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateoconlechuga%2Fconvimg/lists"}