GS and Gif images

Håkan Stenholm hokan.stenholm@REDACTED
Tue Apr 4 19:26:46 CEST 2006


Eric Shun wrote:

>Hello,
>
>I have two questions:
>
>1) How can I resize an image with gs?
>  
>
You can't (to the best of my knowledge)

>2) I have to simulate an animation with 5 gifs (like an animated gif). I
>tried this:
>
>loop(Image) ->
>  gs:config(Image,Canvas,[{load_gif,"1.gif"}]),
>  timer:sleep(10),
>  gs:config(Image,Canvas,[{load_gif,"2.gif"}]),
>  timer:sleep(10),
>  gs:config(Image,Canvas,[{load_gif,"3.gif"}]),
>  timer:sleep(10),
>  gs:config(Image,Canvas,[{load_gif,"4.gif"}]),
>  timer:sleep(10),
>  gs:config(Image,Canvas,[{load_gif,"5.gif"}]),
>  timer:sleep(10),
> loop(Image).
>
>The problem is: Doing this, the memory doesn't stop to grow... until
>overflow...
>How can I do that properly?
>  
>

Hmm, I wonder if the memory should overflow in this case ?
There are a couple of other options that may work:

* load pictures once and use  gs:config(...) to raise or lower certain 
images (assuming that they are not supposed to move around).
* use gs:destroy/1 to periodicly remove a gui widget and hopefully its 
associated memory
* it may also be possible to move unused images ofscreen, e.g. by 
putting the image at a negative x and y coordinates or beyond the area 
of the window (e.g. x = 10000, y = 10000).




More information about the erlang-questions mailing list