Swiftpack.co -  lennartstolz/TGAImage as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Truevision TGA (TARGA) raster graphics support for Swift.
.package(url: "https://github.com/lennartstolz/TGAImage.git", from: "1.1.1")


Truevision TGA (TARGA) raster graphics support for Swift.

Build codecov


  • Swift 5.3


This package provides a Swift interface for the Truevision TGA (TARGA) raster graphics file format.


var image = TGAImage(width: 4, height: 1, color: .white)

// 🎨 Changing the color by pixel
image[0, 0] = .red
image[1, 0] = .green
image[2, 0] = .blue
image[3, 0] = [255, 165, 0]

// 💾 Writing the '.tga' data to disk
let data = image.tgaData()
data.write(to: url)


This library follows the file format specification version 2.0 (January 1991).

Supported Image Types

# Description Support
1 Uncompressed, color-mapped images ✖️
2 Uncompressed, true-color images
3 Uncompressed, black and white (unmapped) images ✖️
9 Run-length encoded, color-mapped images ✖️
10 Run-length encoded, true-color images ✖️
 11  Run-length encoded, black and white images ✖️


TGAImage is MIT Licensed.


Stars: 5
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API