Comments (6)
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.
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.
Cheers, good to know! Will give the "import-first" approach a go... in due course ;D
from tga.
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.
That makes sense to me.
from tga.
@blezek thanks for that fork, solved my problem
from tga.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tga.