Converts common image formats (PNG, JPG, etc.) to GPU-native compressed (BCn, ETC, ASTC) in KTX containers.

Overview

img2ktx

img2ktx is a simple command-line utility.

It currently runs on Windows, Linux and MacOS.

It loads images with stb_image. Supported formats include JPEG, PNG, BMP, TGA, GIF, etc.

It optionally generates mipmap chains with stb_image_resize.

It compresses the mipmaps to BC1, BC3, BC7, ETC1, or ASTC with Intel's ISPC Texture Compressor. It can also output uncompressed 32-bit RGBA images. Only the Windows ispc_texcomp library is included in the repo; users on other platforms must provide their own.

It writes the compressed images to a KTX file. If more than one image is provided with identical dimensions, the output KTX file can be either a 2D texture array or a cubemap.

Compile

img2ktx uses submodules for its dependencies. After cloning the repository, be sure to fetch these dependencies:

$ git submodule update --init

Then use CMake 3.15+ to generate a project file for your platform.

Binaries

Download pre-built binaries from the Releases page.

TODO

img2ktx may eventually do the following things as well (but no promises):

  • Output DDS files, because inevitably somebody is going to ask for it.
  • Convert animated GIFs directly into array textures, because what 3D graphics application isn't improved by animated GIFs?
Comments
  • Expose additional compression options

    Expose additional compression options

    Compressonator allows more customizable compression, including a speed/quality slider and various format-specific tweaks. See which ones are worth exposing.

    enhancement 
    opened by cdwfs 3
  • Add version info / changelog

    Add version info / changelog

    As I'm about to release a major update, this seems as good a time as any to start tracking what's changed.

    • [ ] Changes.txt file
    • [ ] Version info (hooked up to -v)
    enhancement 
    opened by cdwfs 1
  • Consider licensing this code

    Consider licensing this code

    I would love it if you released this code under a license so that it could be integrated into other projects without worries. The MIT license would be savory. The image compressor appears to already be MIT, and the STB stuff is public domain.

    opened by a-day-old-bagel 1
  • compile problem

    compile problem

    Machine : ubuntu 18.04

    [ 33%] Building CXX object CMakeFiles/img2ktx.dir/img2ktx.cpp.o
    [ 66%] Building CXX object CMakeFiles/img2ktx.dir/build_version.cpp.o
    [100%] Linking CXX executable img2ktx
    /usr/bin/ld: cannot find -lIMG2KTX_ISPC_TEXCOMP_LIB-NOTFOUND
    collect2: error: ld returned 1 exit status
    CMakeFiles/img2ktx.dir/build.make:112: recipe for target 'img2ktx' failed
    make[2]: *** [img2ktx] Error 1
    CMakeFiles/Makefile2:99: recipe for target 'CMakeFiles/img2ktx.dir/all' failed
    make[1]: *** [CMakeFiles/img2ktx.dir/all] Error 2
    Makefile:90: recipe for target 'all' failed
    make: *** [all] Error 2
    
    opened by Cvjark 0
  • Move compression backend to Compressonator

    Move compression backend to Compressonator

    Motivation:

    • ispc_texcomp hasn't been updated in years, including merging some PRs for significant-looking bugfixes. Compressonator is under active development (for now).
    • ispc_texcomp requires a fancy custom compiler, which complicates the build process and hinders both distribution and CI/testing. Compressonator can be easily built from source on any platform with a relatively modern C++ compiler.
    • Compressonator supports more output formats than ispc_texcomp.
    enhancement 
    opened by cdwfs 3
  • DEADLYSIGNAL when compress into BC3 format

    DEADLYSIGNAL when compress into BC3 format

    I use cmake to build the library then run: ./img2ktx -o out.ktx -f BC3 input/not_kitty.png here's not_kitty.png: not_kitty.zip

    Loaded input/not_kitty.png -- width=32 height=32 comp=3
    compressing mip 0 layer 0: width=32 height=32 pitch_x=32 pitch_y=32
    AddressSanitizer:DEADLYSIGNAL
    =================================================================
    ==3641==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x0000008c0f2a bp 0x7ffd3a604c00 sp 0x7ffd3a604778 T0)
    ==3641==The signal is caused by a READ memory access.
    ==3641==Hint: address points to the zero page.
        #0 0x8c0f29 in _fini (/opt/img2ktx/img2ktx+0x8c0f29)
    
    AddressSanitizer can not provide additional info.
    SUMMARY: AddressSanitizer: SEGV (/opt/img2ktx/img2ktx+0x8c0f29) in _fini
    ==3641==ABORTING
    
    bug 
    opened by frokaikan 2
Releases(preview-20170425)
Owner
Cort
Cort
Better lossless compression than PNG with a simpler algorithm

Zpng Small experimental lossless photographic image compression library with a C API and command-line interface. It's much faster than PNG and compres

Chris Taylor 214 Dec 23, 2022
An image and texture viewer for tga, png, apng, exr, dds, gif, hdr, jpg, tif, ico, webp, and bmp files

An image and texture viewer for tga, png, apng, exr, dds, gif, hdr, jpg, tif, ico, webp, and bmp files. Uses Dear ImGui, OpenGL, and Tacent. Useful for game devs as it displays information like the presence of an alpha channel and querying specific pixels for their colour.

Tristan Grimmer 159 Dec 31, 2022
pngtostl is a program that converts a PNG image into STL 3D models

pngtostl is a program that converts a PNG image into a litophane, in STL format, suitable to be printed by entry level 3D printers.

Salvatore Sanfilippo 157 Dec 17, 2022
Converts file formats supported by AdPlug to VGM format.

adlib2vgm Converts file formats supported by AdPlug to VGM format. Notice This tool is originally designed to work with the RetroWave OPL3 Sound Card.

SudoMaker 16 Nov 25, 2022
Compressed Log Processor (CLP) is a free tool capable of compressing text logs and searching the compressed logs without decompression.

CLP Compressed Log Processor (CLP) is a tool capable of losslessly compressing text logs and searching the compressed logs without decompression. To l

null 516 Dec 30, 2022
PNGFuse is a cross-platform application that allows you to embed and extract full zlib-compressed files within PNG metadata.

PNGFuse PNGFuse is a portable, lightweight, and cross-platform application written in C++ that allows you to embed and extract full zlib-compressed fi

Eta 3 Dec 29, 2021
A resource pack converter from Optifine/MCPatcher formats to other formats

MCPatcherPatcher++ A resource pack converter from Optifine format to newer and alternative formats. This project uses C++ as the language. This might

supsm 108 Dec 20, 2022
Single header KTX/DDS reader

dds-ktx: Portable single header DDS/KTX reader for C/C++ @septag Parses from memory blob. No allocations No dependencies Single-header for easy integr

Sepehr Taghdisian 89 Dec 26, 2022
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

Rich Geldreich 29 Dec 5, 2022
C++ (with python bindings) library for easily reading/writing/manipulating common animation particle formats such as PDB, BGEO, PTC. See the discussion group @ http://groups.google.com/group/partio-discuss

Partio - A library for particle IO and manipulation This is the initial source code release of partio a tool we used for particle reading/writing. It

Walt Disney Animation Studios 412 Dec 29, 2022
Distributed (Deep) Machine Learning Community 682 Dec 28, 2022
This code converts a point cloud obtained by a Velodyne VLP16 3D-Lidar sensor into a depth image mono16.

pc2image This code converts a point cloud obtained by a Velodyne VLP16 3D-Lidar sensor into a depth image mono16. Requisites ROS Kinetic or Melodic Ve

Edison Velasco Sánchez 6 May 18, 2022
Small header-only C library to decompress any BC compressed image

Small header-only C library to decompress any BC compressed image

null 92 Jan 1, 2023
Arduino PNG image decoder library

An 'embedded-friendly' (aka Arduino) PNG image decoding library

Larry Bank 102 Jan 6, 2023
Suman Raj Khanal 7 Nov 24, 2021
Second life for famous JPEGView - fast and tiny viewer/editor for JPEG, BMP, PNG, WEBP, TGA, GIF and TIFF images with a minimalist GUI and base image processing.

JPEGView-Image-Viewer-and-Editor Updated Dec 07 2021. Version 1.1.1.0 has been released. Download link1, link2 added. Second life for famous JPEGView

Ann Hatt 40 Dec 27, 2022
Image decoding for many popular formats for Simple Directmedia Layer.

SDL_image 2.0 The latest version of this library is available from: http://www.libsdl.org/projects/SDL_image/ This is a simple library to load image

Simple Directmedia Layer 263 Dec 27, 2022
Like feh, but better, faster, more image formats, simpler, more lightweight, animation support, and better UI

Like feh, but better, faster, more image formats, simpler, more lightweight, animation support, and better UI

martin 11 Oct 23, 2022