Giter VIP home page Giter VIP logo

Comments (6)

ftrvxmtrx avatar ftrvxmtrx commented on September 2, 2024 1

The problems lays in the TGA format itself.
For side-effect-only decoders to work, image.RegisterFormat must be called in the decoder's init(). It accepts the header argument, which allows image package choose the right decoder based on the header.
Unfortunately TGA doesn't have one :)
So the only solution I could come up with is importing as _ "github.com/ftrvxmtrx/tga" BEFORE any other image decoder, so it tries using TGA decoder only after all other decoders.
Not sure if it's possible to return some kind of "not so faulty" error from image decoder, so it actually tries other decoders as well.

from tga.

blezek avatar blezek commented on September 2, 2024 1

FWIW, there is a fork that removes the automatic registration of TGA, replacing with a tga.RegisterFormat() function.

https://github.com/dblezek/tga

from tga.

 avatar commented on September 2, 2024

Cheers, good to know! Will give the "import-first" approach a go... in due course ;D

from tga.

pmezard avatar pmezard commented on September 2, 2024

FWIW, decoder tests do not pass for me with Go 1.5 on OSX. I suppose the assumptions about the package registration order may have been broken during the compiler refactoring. Registering it as a default fallback sounds brittle to me. If TGA format does not lend itself to sniffing, then you should probably not try to do it.

What about integrating @dblezek changes or something similar?

from tga.

dmitshur avatar dmitshur commented on September 2, 2024

That makes sense to me.

from tga.

Yugloocamai avatar Yugloocamai commented on September 2, 2024

@blezek thanks for that fork, solved my problem

from tga.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.