Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Animated Gif to Sprite

Author
Message
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 6th Sep 2014 22:58
As the tittle says, many times we've needed to open an animated gif and manually coloring all the outline with a new color...normally black. I came up with a snippet that can do this in a less cumbersome way .I hope it can be useful for someone. This is what I have so far.





I tested also with .avi files, and it works.
Example attached.

Cheers.

I'm not a grumpy grandpa
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 8th Sep 2014 05:13
This is awesome i need to try it.Currently browsing from my phone though.Maybe tomorow, we will see what will be the effect of the full moon, might just crash on the bed after work.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 8th Sep 2014 11:43
Quote: " we will see what will be the effect of the full moon, might just crash on the bed after work."


Sometimes I resolved some tricks on bed This code is good for using animated gifs that we find on the net and use as an animated sprite. We need to know how many frames has the animated gif with some other program .... no way to guess how many frames with Dbpro Commands

I'm not a grumpy grandpa
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 8th Sep 2014 21:57
For some reason the demo don't work for me...i see just the sign Press Space and that's it.Almost asleep allready i'll take second look tomorow.Too tired now.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 8th Sep 2014 22:23 Edited at: 8th Sep 2014 22:29
So much has changed that the new version is not able to run a simple code .

I'm using version 1.074. Attached an exe file.


Edit: just tested now with 1.077 and works fine to me

I'm not a grumpy grandpa
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 9th Sep 2014 00:38
Nope.Same thing.If i remove:

It shows only 1 of the images repeatedly.There is no animation.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 9th Sep 2014 11:45 Edited at: 9th Sep 2014 11:50
Quote: "If i remove :
if col<600000 then dot i,a,rgb(0,0,0) `600000 will be enough to get rid of black color"


You shouldn't remove this line . Exactly this line is the one that fill every frame into black . Removing this line, you should see something like this:



Here's the code you need to load an animation...just test if you can see it .



I'm not a grumpy grandpa
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 9th Sep 2014 13:23
I see exactly what you posted but it's flickering.And the code snippet from the above post is working corect.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 9th Sep 2014 13:36 Edited at: 9th Sep 2014 15:44
Quote: "I see exactly what you posted but it's flickering.And the code snippet from the above post is working corect."


OK Thanks for test. I have several PC at home and not all of them works in the same way...I think it could be a problem of the graphic cards. I noticed not all of them read the rgb color in the same way, and we have to play with the rgbr,rgbg,rgbb .

For example, in my old PC this works:

col=point(x,y)

In new one I had to write:

col=rgbr(point(x,y)) ...any sense ?

https://www.youtube.com/watch?v=Yjx1ROJ--oA

I'm not a grumpy grandpa
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 10th Sep 2014 00:27
A lot of workarounds for something that should work right from the box...I hope i live long enough to see DBPRO Elite and i hope it will cut the crap.

I'm not sure how to fiddle with those commands, and surely if you want to actually use this in a game it will still be a pain as you must have a way to know how the user's graphics reads colors...

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 10th Sep 2014 01:17 Edited at: 10th Sep 2014 01:21
Quote: "I'm not sure how to fiddle with those commands"

If you refer command poin(x,y), it is useful to guess the pixel colour of a certain pixel in the screen .

Now a day all good PC's comes with powerful graphic cards, but most of us still use our old PC's older than five years o more . That's why some times single codes works in one PC and not in other. I don't mean that your PC is old or outdated, that could happens even if it is Amd or Pentium. About Dbpro Elite, not sure if I will live so long to see this miracle

Cheers.

I'm not a grumpy grandpa
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 24th Sep 2014 23:01
I couldn't run your demo either - the one from your download on 8th September where you say "Edit: just tested now with 1.077 and works fine to me ".

I'm using U77 and I get "Error 2002: cannot load animation at line 2" .

That line is simply loading the animation. Any ideas?



Powered by Free Banners
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 25th Sep 2014 00:36
Quote: "That line is simply loading the animation. Any ideas? "


It loads an animated gif and fill in black the whole contour around.

Can you load animated gifs successfully ?

Try this code to check if you see the animated gif.


In works Ok in all my PC's with 1.074 and 1.077

I'm not a grumpy grandpa
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Sep 2014 17:28
No it doesn't work on my laptop. Other gif files fail with the same error. I'll check my other machines when they've finished upgrading Norton, Windows etc (one hasn't been used for two months and the other for two years ).



Powered by Free Banners
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Sep 2014 21:05
The demos work fine on my old Vista desktop. I wonder why my newish laptop complains about GIF files



Powered by Free Banners
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 25th Sep 2014 23:37
Quote: " I wonder why my newish laptop complains about GIF files"


Yes, it could be something about the graphic card . What about when you test shaders? it need a powerful machine

I'm not a grumpy grandpa
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 26th Sep 2014 02:08
Quote: "What about when you test shaders?"


Shaders are fine on this machine. For some reason DBPro will not allow me to open GIF files using load animation. I have no idea what could cause that on one machine. Perhaps GIF files need specific codecs or something like that? On the other hand they open OK in Windows. It's a bit baffling.



Powered by Free Banners

Login to post a reply

Server time is: 2026-07-17 22:13:51
Your offset time is: 2026-07-17 22:13:51