- Home /
How do I import TGA, DDS, GIF, PCX and BMP files at runtime?
Hi, Is there a solution to load at runtime, from any location on disk the following file formats: TGA, DDS, PCX, GIF, BMP ? It also should work both - in Editor and Runtime.
I am aware of WWW class, which lets me load JPG and PNG formats, which is fine (I will need to load PNG files too), but not enough.
I'm also aware of Resource.Load() function, but these files need to be loaded from outside of Unity project folder.
I have also come across this asset on AS, but it's been retired from the Asset Store. And the author had not replied to me. https://forum.unity3d.com/threads/advanced-importer.248725/
If such a solution does not exist - how do I go about writing my own image loaders?
Thanks.
Answer by dpoly · Sep 14, 2017 at 04:05 AM
There is an answer here for BMP: http://answers.unity3d.com/questions/1308973/how-to-load-a-bmp-file-in-binary.html (without trailing dot).
Basically you have to roll your own, or get code from someone else who did. From the bits up.
Thanks - that's what I was afraid to hear... The link does not work though.
Surely you noticed the link got a trailing dot? Try it now. [bug in web site editor] Note you can also use System.Drawing.
Sorry, I didn't look at the link itself - just clicked on it! Thanks for fixing it.
I actually wrote a gif importer as well, but it's not polished for release. It's also ment to load and decode / decompress the gif data structure on a low level. Since the GIF format has quite a few features it doesn't have to be just a single image. GIF is a crazy format and it's a pity that its potential isn't used by most gif readers / writers. A gif file could be used as a generic meta data file. It consists of logical blocks and support custom application extensions.
Lately i'm not very keen on working on it. There are already some GIF solutions on the assetstore as far as i remember. Though if enough people are interested in a GIF solution i may continue ^^.
Hey, if you ever finish it, let me know. I don't feel crazily enthusiastic about re-inventing the wheel, so would be happy to purchase an asset that can do these kind of low-level yet essential things.
Your answer
Follow this Question
Related Questions
Runtime Normal Map Import Issues 0 Answers
How can I import 2 texture from 1 image? 1 Answer
Runtime loading normal texture 1 Answer
Changing terrain texture at runtime 1 Answer