Builds atlas texture from a bunch of input images.

Overview

Build Status

Atlasc

@septag

atlasc is a command-line program that builds atlas texture from a bunch of input images.

Main Features

  • Cross-platform. Runs on linux/macOS/windows.
  • No dependencies
  • Outputs atlas description to human-readable json format. Generated images are png.
  • Alpha trimming.
  • Mesh sprites.
  • Scaling
  • Can build as static library

drawsprite-wire
screenshot taken from rizz sprite example

Build

It has built and tested on the following platforms:

  • Windows: Tested on Windows10 with visual studio 14 2015 update 3 (Win64).
  • Linux: Tested on ubuntu 16 with clang (6.0.0) and gcc (7.3.0). Package requirements:
  • MacOS: Tested on MacOS High Sierra - AppleClang 9.1.0

Usage

atlasc image1.png image2.png -o output.json [extra args]

Arguments:

-h --help                           - Print help text
-V --version                        - Print version
-i --input=<Filepath>               - Input image file(s)
-o --output=<Filepath>              - Output file
-W --max-width(=Pixels)             - Maximum output image width (default:1024)
-H --max-height(=Pixels)            - Maximum output image height (default:1024)
-B --border(=Pixels)                - Border size for each sprite (default:2)
-2 --pot                            - Make output image size power-of-two
-P --padding(=Pixels)               - Set padding for each sprite (default:1)
-m --mesh                           - Make sprite meshes
-M --max-verts(=Number)             - Set maximum vertices for each generated sprite mesh (default:25)
-A --alpha-threshold(=Number)       - Alpha threshold for cropping (0..255)
-s --scale(=Number)                 - Set scale for individual images (default:1.0)

Static Library

To build atlasc as static library instead of command-line tool, set STATC_LIB in cmake options.

cmake . -DSTATIC_LIB=1

There are three methods for creating atlases using the library:

  • Load from image files and output to image file: atlasc_make
  • Load from image files and return atlas in memory: atlasc_make_inmem
  • Load from images loaded in memory and return atlas in memory: atlasc_make_inmem_fromem

For more information, read the header file atlasc.h

TODO

  • Support for islands. currently, there is a limitation that individual images should not have islands of pixels
  • Optimizations. It's a very early implementation and probably some parts of it has to be optimized

Open-Source libraries used

  • sx: Portable base library
  • sjson: Fast and portable single-header C file Json encoder/decoder
  • stb: stb single-file public domain libraries for C/C++
  • sproutline: A small single-file library for sprite outline extraction and simplification
  • delanuay: Relatively Robust Divide and Conquer 2D Delaunay Construction Algorithm

License (BSD 2-clause)

Copyright 2019 Sepehr Taghdisian. All rights reserved.

https://github.com/septag/atlasc

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

   1. Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.

   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You might also like...
Texture Packer for Game Development Using MaxRects Algorithm
Texture Packer for Game Development Using MaxRects Algorithm

Overview Texture Packer for Game Development Using MaxRects Algorithm. Note: The game assets used in this example were download from Grassland Tileset

Basis Universal GPU Texture Codec
Basis Universal GPU Texture Codec

basis_universal Basis Universal Supercompressed GPU Texture Codec Basis Universal is a "supercompressed" GPU texture data interchange system that supp

Single source file ASTC texture decompression in C++ (derived from Google's open source Android project)

astc_dec astc_dec is a single source file ASTC texture decompressor with the Apache 2.0 license, derived from Google's open source Android sources. Th

Simple font renderer library written in Opengl 3.3 using stb_truetype.h to load a packed bitmap into texture of a .ttf font.
Simple font renderer library written in Opengl 3.3 using stb_truetype.h to load a packed bitmap into texture of a .ttf font.

mv_easy_font Simple font renderer library written in Opengl 3.3 using stb_truetype.h to load a packed bitmap into texture of a .ttf font. Uses instanc

An efficient texture-free GLSL procedural noise library

Wombat An efficient texture-free GLSL procedural noise library Source: https://github.com/BrianSharpe/Wombat Derived from: https://github.com/BrianSha

Gaming Input Peripherals Device Firewall for Windows.
Gaming Input Peripherals Device Firewall for Windows.

HidHide ⚠️ Compiling a signed BETA release is in the works, please be patient! ⚠️ Introduction Microsoft Windows offers support for a wide range of hu

Valorant cheat that abuses Logitech GHUB driver input management.

valorant-cheat Valorant cheat that uses Logitech GHUB driver input management and color detection. features Triggerbot with customizable delay (VK_SHI

🎨 HiColor is a program for converting images to 15- and 16-bit RGB color
🎨 HiColor is a program for converting images to 15- and 16-bit RGB color

HiColor is a program for converting images to 15- and 16-bit RGB color, the color depth of old display modes known as “high color”. In 15-bit mode images have 5 bits for each of red, green, and blue, and the last bit is reserved. In 16-bit mode green, the color the human eye is generally most sensitive to, gets 6 bits.

Universal State Monitor software for home automation input devices

Universal State Monitor Copyright 2019-2021 SuperHouse Automation Pty Ltd www.superhouse.tv A binary state monitor for DIY home automation projects. T

Comments
  • Truncating last column and last row

    Truncating last column and last row

    Problem:

    Given this 16x16 image in input:

    0

    This 24x24 image is outputted:

    level_tiles

    Truncating last column (blue) and last row (red).

    How to reproduce:

    atlasc 0.png -o level_tiles

    Rest of the story:

    I was looking for a command line texture packer, with no graphical interface, with just the very exact options your tool exposes, and I am very satisfied. Easy to build (about time for everyone to finally switch to CMake), no dependencies outside of the codebase. Just fantastic.

    That being said, I am afraid there's a bug.

    My use case is packing a bunch of uniform, 16x16 tiles that I will use in my tile renderer. I also utilize the mesh option, so to parse UVs and normalize them during game's runtime, and use outputted index buffer.

    So I found out that using outputted UVs pixel bleeding occurs. As I investigated, UVs seemed to be OK (16x16), also no half-pixel correction was needed on my side.

    I looked at the tilesheet outputted from atlasc and I was bewildered - every tile was 15x15 instead of 16x16 given in input.

    My call was:

    atlasc *.png -o level_tiles -B 0 -P 0 -m -W 512 -H 512 -2

    Am I using atlasc wrong?

    opened by dbeef 4
  • Out of memory with an image 1px in size

    Out of memory with an image 1px in size

    I currently get a out of memory error if one of my images has only the size of 1px

    0 && "Out of memory!"[1] 81873 trace trap ./tools/osx/atlasc -s 0.8 -2 -o assets/atlas.json -i assets/tiles/*.png

    opened by pjako 1
Owner
Sepehr Taghdisian
https://twitter.com/septagh http://glitterbombg.com/blog
Sepehr Taghdisian
Builds and runs an exported image classification impulse on ESP32 Cam

ESP32 Cam and Edge Impulse How to run custom inference on a ESP32 cam using Edge Impulse. Material This code has been tested the AI Thinker ESP32 Cam

Edge Impulse 56 Sep 10, 2022
Custom kernel for sweet based on Delta, builds hosted on @sweet_epsilon on Telegram (GH releases are outdated)

Linux kernel ============ This file was moved to Documentation/admin-guide/README.rst Please notice that there are several guides for kernel develop

Udit Karode 14 Mar 29, 2022
My builds of suckless software

I recently switched to dwm from i3wm, it took me a while to get used to the dwm stuff and also the suckless way. After dwm, came st and then slstatus

Kushagra Jain 2 Nov 19, 2021
Useful cmake macros that help with: compiler/linker flags, collecting sources, PCHs, Unity builds and other stuff.

ucm - useful cmake macros ucm is a collection of cmake macros that help with: managing compiler/linker flags collecting source files with grouping in

Viktor Kirilov 193 Sep 9, 2022
This FreeRTOS example builds a simple Timer application for Linux using the ESP-IDF

Supported Targets Linux This FreeRTOS example builds a simple Timer application for Linux using the ESP-IDF. Build Source the IDF environment as usual

null 13 Apr 4, 2022
Automated builds/mirrors of various PS3SDKs for Linux systems.

Working PS3SDK Binaries NOTICE: This repo is now deprecated. SDK builds have moved here, and SDK mirrors have moved here. Prepares and releases workin

null 3 Jan 29, 2022
Pre-compiled builds for CVE-2021-4034

CVE-2021-4034 Precompiled builds for CVE-2021-4034. Of course you shouldn't trust precompiled builds :) This release works slightly different: first a

null 11 Jun 13, 2022
Stack-based texture generation tool written in C99!

Stack-based texture generation tool written in C99! Brought to you by @zaklaus and contributors Introduction zpl.texed is a cross-platform stack-based

zpl | pushing the boundaries of simplicity. 19 Sep 10, 2022
Fast single source file BC7/BPTC texture encoder with perceptual metric support

Note: Since this repo was created, we've released two new codecs with better BC7 encoders: https://github.com/richgel999/bc7enc_rdo https://github.com

Rich Geldreich 142 Apr 11, 2022