Go package for decoding and encoding TARGA image format

tga

tga is a Go package for decoding and encoding TARGA image format.

It supports RLE and raw TARGA images with 8/15/16/24/32 bits per pixel, monochrome, truecolor and colormapped images. It also correctly handles origins, attribute type in extensions area and successfully passes TGA 2.0 conformance suite (http://googlesites.inequation.org/tgautilities).

Encoding an image doesn't involve conversion if it's image.Gray, image.RGBA or image.NRGBA. Other types are converted to image.NRGBA prior to encoding.

Installation

$ go get github.com/ftrvxmtrx/tga

Documentation and examples

tga on godoc.org

License

Code is licensed under the MIT license (see LICENSE.MIT).

Several sample image files in testdata directory are copyright to TrueVision, Inc. and are freely available, free of charge and under no licensing terms at http://googlesites.inequation.org/tgautilities

These sample images (and those which were converted from them) are:

bw.png
cbw8.tga
ccm8.tga
color.png
ctc16.tga
ctc24.tga
ctc32.tga
ubw8.tga
ucm8.tga
utc16.tga
utc24.tga
utc32.tga
Owner
Sigrid Solveig Haflínudóttir
Sigrid Solveig Haflínudóttir
Similar Resources

Imaging is a simple image processing package for Go

Imaging is a simple image processing package for Go

Imaging Package imaging provides basic image processing functions (resize, rotate, crop, brightness/contrast adjustments, etc.). All the image process

Dec 30, 2022

Go Perceptual image hashing package

goimagehash Inspired by imagehash A image hashing library written in Go. ImageHash supports: Average hashing Difference hashing Perception hashing Wav

Jan 3, 2023

golang package to find the K most dominant/prominent colors in an image

golang package to find the K most dominant/prominent colors in an image

prominentcolor Find the K most dominant colors in an image The Kmeans function returns the K most dominant colors in the image, ordered in the order o

Nov 7, 2022

package for convert DataURLs to image

convert base64 DataURLs to image

Oct 18, 2021

A Go package converting a monochrome 1-bit bitmap image into a set of vector paths.

A Go package converting a monochrome 1-bit bitmap image into a set of vector paths.

go-bmppath Overview Package bmppath converts a monochrome 1-bit bitmap image into a set of vector paths. Note that this package is by no means a sophi

Mar 22, 2022

magicimage is a simple image validation & save with rich feature package for net/http

Installation go get github.com/IndominusByte/magicimage Usage examples A few usage examples can be found below. See the documentation for the full lis

Feb 5, 2022

A simple API written in Go that creates badges in SVG format, based on the requested route.

A simple API written in Go that creates badges in SVG format, based on the requested route. Those graphics can be used to style README.md files, or to add tags to webpages.

Jul 2, 2021

Snippit - Creates syntax-highlighted code snippets in png or svg format

Snippit - Creates syntax-highlighted code snippets in png or svg format

snippit creates syntax-highlighted code snippets in png or svg format. Installat

Oct 10, 2022

Image processing library and rendering toolkit for Go.

blend Image processing library and rendering toolkit for Go. (WIP) Installation: This library is compatible with Go1. go get github.com/phrozen/blend

Nov 11, 2022
Comments
  • rgb32_top_left_rle_colormap.tga invalid

    rgb32_top_left_rle_colormap.tga invalid

    I'm pretty sure (but not 100% convinced as it's possible I'm misunderstanding something) that rgb32_top_left_rle_colormap.tga isn't actually a valid TGA file.

    I've run it through TGAPACK.EXE from Truevision's TGA Utilities Package (with the -unpack option and also having removed the footer as it doesn't like footers) and the resulting file has indices out of the range of the colour map. Some TGA loaders are giving an error related to this, but I've seen a lot of incomplete and broken TGA loaders over the past couple of weeks, so I'm not reading too much into that. It's completely possible that the image would work fine if someone tried loading it on an actual Truevision card. If so, I'd be thankful for an explanation of what's going on.

  • use more color models

    use more color models

    Go already supports Palette and Gray models, so at least some colormapped/monochrome images can be stored in Go without much convertion. Takes less space too.

  • Decoder works great when used in isolation. Does not play with other decoders (such as the image/png/jpg built-ins)?

    Decoder works great when used in isolation. Does not play with other decoders (such as the image/png/jpg built-ins)?

    The TGA decoding itself works flawlessly, awesome work.

    Now, my issue... it's really quite strange!

    So first off, with this use-case A it works great: I have one Go program where both image/png and ftrvxmtrx/tga are imported directly (not "anonymously" via _ underscore). It just converts TGAs to PNGs --- so decodes TGA and encodes PNGs both directly, without Go's "automagical looking for the registered decoder". All works fine, source here

    Now I have another use-case B which i can't seem to get working properly with the tga package:

    • So I have a simple texture loader that imports both image/jpeg and image/png as unnamed/anon _ (underscore) packages and then later does a simple image.Decode()
    • This simple loader works in two test apps that both load jpg and png textures (both local and over http). image.Decode finds the right decoder just from the byte stream / io.Reader supplied to it
    • If I just add ftrvxmtrx/tga as an unnamed/anon _ (underscore) package to the above simple loader, and don't even attempt to load TGAs (ie. the two test apps remain unchanged and still only attempt to load jpg and png files!) none of those get decoded properly anymore.

    So I must conclude: just importing tga unnamed/anonymously/side-effect-only screws up all other registered image decoders. Direct named import however does not seem to affect at least other encoders (not sure about other decoders, not a use-case right now).

    (Note since I am in OpenGL my geometry just remains black but I verified that just importing ftrvxmtrx/tga as _ kills the whole image.Decode() functionality, removing the tga import all textures get decoded and loaded again perfectly.)

    So not sure if tga is supposed to work as an unnamed / side-effect import like the other decoders or only directly... any thoughts? ;)

Related tags
darkroom - An image proxy with changeable storage backends and image processing engines with focus on speed and resiliency.
darkroom - An image proxy with changeable storage backends and image processing engines with focus on speed and resiliency.

Darkroom - Yet Another Image Proxy Introduction Darkroom combines the storage backend and the image processor and acts as an Image Proxy on your image

Dec 6, 2022
Pure Go encoder/decoder of the QOI image format

QOI - The “Quite OK Image” format for fast, lossless image compression package and small utilities in native Go, quite OK implementation See qoi.h for

Nov 12, 2022
An API which allows you to upload an image and responds with the same image, stripped of EXIF data

strip-metadata This is an API which allows you to upload an image and responds with the same image, stripped of EXIF data. How to run You need to have

Nov 25, 2021
Easily customizable Social image (or Open graph image) generator

fancycard Easily customizable Social image (or Open graph image) generator Built with Go, Gin, GoQuery and Chromedp Build & Run Simply, Clone this rep

Jan 14, 2022
Imgpreview - Tiny image previews for HTML while the original image is loading
Imgpreview - Tiny image previews for HTML while the original image is loading

imgpreview This is a Go program that generates tiny blurry previews for images t

May 22, 2022
asciigrid is a Go package that implements decoder and encoder for the Esri ASCII grid format, also known as ARC/INFO ASCII GRID.

asciigrid asciigrid is a Go package that implements decoder and encoder for the Esri ASCII grid format, also known as ARC/INFO ASCII GRID. Install go

Jul 3, 2022
Go package captcha implements generation and verification of image and audio CAPTCHAs.
Go package captcha implements generation and verification of image and audio CAPTCHAs.

Package captcha ⚠️ Warning: this captcha can be broken by advanced OCR captcha breaking algorithms. import "github.com/dchest/captcha" Package captch

Dec 30, 2022
:eyeglasses: Go library for [d]encoding glTF 2.0 files
:eyeglasses: Go library for [d]encoding glTF 2.0 files

gltf A Go module for efficient and robust serialization/deserialization of glTF 2.0, a royalty-free specification for the efficient transmission and l

Jan 1, 2023
Pbm - Package ppm implements a Portable Bit Map (PBM) image decoder and encoder written in Go

Package pbm import "github.com/slashformotion/pbm" Package pbm implements a Portable Bit Map (PBM) image decoder and encoder. The supported image col

Jan 5, 2022
Go package for fast high-level image processing powered by libvips C library

bimg Small Go package for fast high-level image processing using libvips via C bindings, providing a simple programmatic API. bimg was designed to be

Jan 2, 2023