.GIF support, viable?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

.GIF support, viable?

Post by AnonymousTipster »

I'm currently working on an app which requires .gif support. Animated preferably, but standard will work too. Problem is that .gif is no longer an open format, which poses a problem, because there isn't a libgif in SVN, and the .gif loader in SDLimage seems quite closely tied to SDL for a standard file - char load.
What i'm asking is: has anybody worked .gif support into a project of theirs, or does anyone know of a way that I could incorporate .gifs into my app without changing the format?

Failing that, does anyone know of any simple libraries that I could port for the PSP?

EDIT: I've found a small loader in a program called iiviewer which may help me. I'd still like to know if this has been done before though
seventoes
Posts: 79
Joined: Sun Oct 02, 2005 4:50 am

Post by seventoes »

well gif is a copywrited technology...

Just open the pix in paint and then save them as a .png and use libpng
Gary13579
Posts: 93
Joined: Mon Aug 15, 2005 7:43 am

Post by Gary13579 »

seventoes wrote:well gif is a copywrited technology...

Just open the pix in paint and then save them as a .png and use libpng
There's probably a reason he needs it to be GIF and not PNG.
I saw a GIF viewer in PSP PDA (formerly known as PSP Notepad), but I don't think it is open source, and it really isn't the best (some colors get screwed up).
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

Gary13579 wrote:
seventoes wrote:well gif is a copywrited technology...

Just open the pix in paint and then save them as a .png and use libpng
There's probably a reason he needs it to be GIF and not PNG.
I saw a GIF viewer in PSP PDA (formerly known as PSP Notepad), but I don't think it is open source, and it really isn't the best (some colors get screwed up).
PSP-PDA uses the SDL_Image library from the svn, so the gif reading is implemented in that library and it's open source.
Maybe, the ungif library could be ported to have better gif support.
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

I'll have a look into ungif, and continue looking at iiviewer. Hopefully it will work OK.
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

seventoes wrote:well gif is a copywrited technology...

Just open the pix in paint and then save them as a .png and use libpng
AFAIK using GIF was never a problem, but the LZW algorithm. But looks like the patent expired last year: http://www.unisys.com/about__unisys/lzw
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

Well, that's good news. Do all .gifs use the LZW algorithm, or was it an improvement that Unisys introduced?

EDIT: Seeing as the patents have expired, that means I can use libgif instead of libungif. I can't find libgif (there doesn't seem to be a homepage like for png and jpeg), but I can find libungif.
Is there much difference between libgif and libungif?
Zenurb
Posts: 106
Joined: Fri Sep 30, 2005 8:33 am
Location: United Kingdom
Contact:

Post by Zenurb »

Just convert your GIFs to MNG and use the lovely animated png format instead.
Proud Dvorak User
US 1.5 PSP (Original)
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

It's not that simple, if I could change the format, then I would. I don't have control over 3rd party images, and .gif is a popular format that I need to support.
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

AnonymousTipster wrote:Is there much difference between libgif and libungif?
I read once that there is no much difference when reading gif files, only when creating them (in this case, libgif is better)
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

Ok, i'll have a look at libungif in the morning. Thanks.
digihoe
Posts: 108
Joined: Sat May 14, 2005 7:40 pm

Post by digihoe »

You need GIF for browser port, right? Are you planing any javascript support BTW? I think it is essential...

Good luck and best regards!
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

Yes. I haven't looked too deep into Dillo's source code yet, if it supports javascript, then the 1.5 browser will too. If not, we'll hopefully build in some basic support, but only for simple essential commands like close() addbookmark() etc, but not good enough for games.
The GU based graphical engine is coming along quite nicely, and it supports .PNG, i'm in the process of adding .jpg. Afterwards, I want to add .gif and TTF support.
I'm just hoping that we'll actually end up with a functioning browser, because if so, the sky is the limit (built-in media view/playing, VoIP, Online Radio stations, flash support etc.).
Zenurb
Posts: 106
Joined: Fri Sep 30, 2005 8:33 am
Location: United Kingdom
Contact:

Post by Zenurb »

AnonymousTipster wrote:Yes. I haven't looked too deep into Dillo's source code yet, if it supports javascript, then the 1.5 browser will too. If not, we'll hopefully build in some basic support, but only for simple essential commands like close() addbookmark() etc, but not good enough for games.
The GU based graphical engine is coming along quite nicely, and it supports .PNG, i'm in the process of adding .jpg. Afterwards, I want to add .gif and TTF support.
I'm just hoping that we'll actually end up with a functioning browser, because if so, the sky is the limit (built-in media view/playing, VoIP, Online Radio stations, flash support etc.).
Building a browser from the ground up may be your only option
Proud Dvorak User
US 1.5 PSP (Original)
shifty
Posts: 32
Joined: Thu Jun 16, 2005 8:59 am
Location: MIT
Contact:

gif expires soon

Post by shifty »

1) according to
http://www.gnu.org/philosophy/gif.html
the LZW (part of GIF) patent will expire in August 2006! You might as well go
for it in the meantime! Who's going to bother with a few teenagers
with a free distribution over the next year? A good place to find
gif source code is the "xv" source code (a prg for displaying GIFs, jpegs,
etc under the x window operating system). I've ported that code myself
several times. it's pretty clean. The author is pretty wacky. Here's his
webpage: http://www.trilon.com/xv/ And here's the
downloads page for source: http://www.trilon.com/xv/downloads.html

2) Yes, you can have legal GIFs that don't use LZW! They're just not
compressed, so they end up being very big, like 8-bit color indexed
BMP files. I wouldn't waste my time with this though :P

3) no idea if that code is supports animations, but if you get that far, then
I'll dig up my gif animator source code I got from some kid in Germany
for you.
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Re: gif expires soon

Post by Shine »

shifty wrote:1) according to
http://www.gnu.org/philosophy/gif.html
the LZW (part of GIF) patent will expire in August 2006!
The footnote on this page says:
We were able to search the patent databases of the USA, Canada, Japan, and the European Union. The Unisys patent expired on 20 June 2003 in the USA, in Europe it expired on 18 June 2004, in Japan patent expired on 20 June 2004 and in Canada it expired on 7 July 2004. The U.S. IBM patent expires 11 August 2006, (we are still searching the databases of other countries).
I don't know, what the IBM patent exactly is, but I think chances are good, that IBM doesn't care, if some homebrew program uses GIF images and looks like if you don't live in the USA, it is no problem at all any more :-) But of course, MNG is better for small animated graphics, because it supports true color.
seventoes
Posts: 79
Joined: Sun Oct 02, 2005 4:50 am

Post by seventoes »

Wow.. now i look at who started the post and i realize why he cant convert the images xD Im not sure if he wants me revieling his project.. but PSPU put it on the front page so i guess its ok....

Hes workin on a web browser :D *happy happy*

I know he already has png, jpeg, and ttf (fonts) support, i dont know about anything else but i know its coming along well.
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

OK, well. I've got the latest source of libungif. I've made the library and installed it to the library directory. Putting -lungif in the makefile works, and my app can find the gif_lib.h file. However, I get undefined references to the library functions, such as DGifOpenFilename(). The structs work fine (e.g. GifFileType), it's just the functions.
Can anyone help?
User avatar
daurnimator
Posts: 38
Joined: Sun Dec 11, 2005 8:36 pm
Location: melbourne, australia

Post by daurnimator »

How did you go with this?
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

Well, it appears that libungif will compile the library fine (with errors elsewhere, but the library is formed OK), but it doesn't link correctly, and gives me errors like: undefined reference to 'DGifOpenFileName'
I'm sure i've seen this problem before with libraries, but I have forgotten how to solve it.
.: Smerity :.
Posts: 9
Joined: Sat Feb 04, 2006 11:43 pm
Contact:

Post by .: Smerity :. »

Doesn't that usually mean that the Makefile hasn't been told to link the library, thus isn't finding the reference functions?

Not sure what the signifier would be for libungif though...

-lgif or -lungif maybe?

(and just for curiosity sakes, have you ported over libungif yourself, or is it at an SVN somewhere? Can't see it on svn.pspdev.org)

-Edit-
Confirmed as -lungif at http://mail.gnome.org/archives/gnome-li ... 01803.html
Last edited by .: Smerity :. on Sat Feb 18, 2006 8:13 pm, edited 1 time in total.
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

Makefile:
TARGET = browser
OBJS = main.o p_sprint.o

INCDIR = "/home/Paul/pspgames/freetype/include"
CFLAGS = -O2 -G0 -Wall -I../curl/include -L../curl -I../libungif/lib -L../libungif/lib/.libs
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LDFLAGS =
LIBS= -lcurl -lpsp_req -lpspdebug -lpspsdk -lpspwlan -lpspnet_apctl -lpspnet_resolver -lc -lpspnet_inet -lpspnet -lstdc++ -lpspgum -lpspgu -lpng -ljpeg -lungif -lz -lm -lfreetype -lpsppower

I'm pretty sure that i'm including the library and neccessary headers.
libungif.a comes out as 202kb, FYI, just in case it isn't compiling fully.

Also, in the .libs directory, there is a dgif_lib.a file, which may need to be included, but I don't know what it's signifier would be.

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Eclipse
PSP_EBOOT_ICON = "icon0.png"
PSP_EBOOT_PIC1 = "eclipsebg.png"

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak

EDIT: I found somewhere that you can fix this problem by adding exern "C" around the #include <gif_lib.h> but that doesn't help me, as I am already in C, not C++
.: Smerity :.
Posts: 9
Joined: Sat Feb 04, 2006 11:43 pm
Contact:

Post by .: Smerity :. »

Not exactly sure what to suggest then.

Check your libungif source to make sure that DGifOpenFileName is in dgif_lib, it seems they excluded it for the GBA version (just incase you're using the GBA tree).

- When Compiling for Game Boy Advance, file functions are not needed so
exclude DGifOpenFileName(), DGifOpenFileHandle(), DGifSlurp(), and
PrintGifError().


http://cvs.sourceforge.net/viewcvs.py/l ... iew=markup

If it's only that single command then it may very well be something to do with the GBA tree, as you'd usually get a lot more errors from a completely missing lib I'd assume

Checking out other probable causes now
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

Any DGif function causes the undefined reference, so I also get the same error with DGifGetRecordName DGifCloseFile DGifGetScreenDesc DGifGetLine. So it clearly can't find any of the functions, which would suggest a missing library, but it's definitely -lungif, and my makefile is pointing to the directory where it is: -L../libungif/lib/.libs
I know it can find the .h files, as it doesn't complain about using the structures such as GifFileType *gifFile; GifRecordType *gifType; GifPixelType *gifLine;
.: Smerity :.
Posts: 9
Joined: Sat Feb 04, 2006 11:43 pm
Contact:

Post by .: Smerity :. »

http://mail.gnome.org/archives/gnome-li ... 01246.html

He said that he worked around it using -lgif...

He seems to be getting all the same errors as you

The reply quotes -
Hmm: this sometimes happens because you ran "./autogen.sh" before you
had the gif library installed, and then you installed the gif library
but did not remove config.cache in imlib.


<I should also apologise, at this point I'm clutching at straws...>
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

I think that reply was in relation to imlib, so he ran the ./autogen.sh for imlib without having the libungif libraries installed.
If I put in -lgif, the linker complains that it cannot find it.

EDIT: And in response to your earlier question, I got libungif from it's homepage, and compiled it straight off. As I said, it compiled the library fine, but errored out later on with example sources (I think). When compiling the library, there isn't anything particular you need to do to get it to compile for the PSP, is there?
.: Smerity :.
Posts: 9
Joined: Sat Feb 04, 2006 11:43 pm
Contact:

Post by .: Smerity :. »

Yeah, sorry mate, if I suggested anything else now I'd be completely clutching at straws. Hopefully someone with more experience in this area can come in and be a hero.

Best of luck...
MikeDX
Posts: 30
Joined: Wed Oct 19, 2005 9:24 am

Post by MikeDX »

seventoes wrote:well gif is a copywrited technology...

Just open the pix in paint and then save them as a .png and use libpng
there is NOTHING about what you have said that makes any sense whatsoever.

However, the LZW patent expired last year worldwide and quite a few OSS projects have reimplemented GIF with LZW supprt.
AnonymousTipster
Posts: 197
Joined: Fri Jul 01, 2005 2:50 am

Post by AnonymousTipster »

Can anyone help with this?
It is crucial that the browser has .gif support, and to do so, I need this library.
Post Reply