Job Offer - Programmer Import animated gif to surface and export animated gif

  • Thread starter Deleted member 16767
  • Start date
D

Deleted member 16767

Guest
This is a paid job for my painting software. Please PM me if you know how to do this.
 
D

Deleted member 16767

Guest
Edit: I'll do the animation UI myself, but the animated gif extension I can not do on my own.
 
Last edited by a moderator:
D

Deleted member 16767

Guest
Still looking. I also need to export it aside from importing it.
 
D

Deleted member 16767

Guest
Still looking. I use layer_sprite_create to draw stuff btw.
 
Try this:
GML:
/// load_surface_gif(fname, removeback);
/// @param fname
/// @param removeback
/*
    load a gif to a surface(s) [as many as there are frames in GIF]
    *** MUST BE DONE IN DRAW EVENT
    *** DO NOT RUN CONTINUOUSLY
*/



var _fname = argument0,    /// GIF file
    _remove = argument1, /// whether to remove background color (set alpha to 0)
    _sprite = sprite_add(_fname, 1, _remove, false, 0, 0), /// sprite creation code
    _surfArray = [];    /// surface to transfer sprite to
   
//------------ calculate necessary surface size ----------//
var _w = sprite_get_width(_sprite),    /// width of the surface
    _h = sprite_get_height(_sprite), /// height of the surface
    _qty = sprite_get_number(_sprite);
   
/// create surface(s)
for (var i = 0; i < _qty; ++i) {
    _surfArray[i] = surface_create(_w,_h);
    //------------ Transfer sprite to surface ----------------//
    surface_set_target(_surfArray[i]);
    draw_clear_alpha(c_black,0);
    draw_sprite(_sprite,i,0,0);
    surface_reset_target();
};

/// clean up sprite
sprite_delete(_sprite);

/// return array of surfaces
return(_surfArray);
Also:
GML:
gif_add_surface(gif_index, surface, delay_time, [xoffset], [yoffset]);
And finally:
GML:
gif_save(gif_index, fname);
*** Working on version that has all frames ***
 
Last edited:

Tazdraperm

Member
Try this:
GML:
/// load_surface_gif(fname, removeback);
/// @param fname
/// @param removeback
/*
    load a gif to a surface(s) [as many as there are frames in GIF]
    *** MUST BE DONE IN DRAW EVENT
    *** DO NOT RUN CONTINUOUSLY
*/



var _fname = argument0,    /// GIF file
    _remove = argument1, /// whether to remove background color (set alpha to 0)
    _sprite = sprite_add(_fname, 1, _remove, false, 0, 0), /// sprite creation code
    _surfArray = [];    /// surface to transfer sprite to
   
//------------ calculate necessary surface size ----------//
var _w = sprite_get_width(_sprite),    /// width of the surface
    _h = sprite_get_height(_sprite), /// height of the surface
    _qty = sprite_get_number(_sprite);
   
/// create surface(s)
for (var i = 0; i < _qty; ++i) {
    _surfArray[i] = surface_create(_w,_h);
    //------------ Transfer sprite to surface ----------------//
    surface_set_target(_surfArray[i]);
    draw_clear_alpha(c_black,0);
    draw_sprite(_sprite,i,0,0);
    surface_reset_target();
};

/// clean up sprite
sprite_delete(_sprite);

/// return array of surfaces
return(_surfArray);
Also:
GML:
gif_add_surface(gif_index, surface, delay_time, [xoffset], [yoffset]);
And finally:
GML:
gif_save(gif_index, fname);
Unfortunately, sprite_add only loads first frame from the gif.
 
D

Deleted member 16767

Guest
Would absolutely appreciate a GMS 2.3 gif upload code, as my old one is not supported by GMS 2.3.
 
D

Deleted member 16767

Guest
Most of the 2.2 stuff should port over well to 2.3. Or, are you trying to change the project structure?
It gives a DoAdd error on a global variable I call gif. It's the "if gif < 0". I have the code for the gif already that someone did for me. It's a pretty big script with buffers and stuff (which I will not post here, because I paid for it).
 
Fair.
And it makes hard to say anything, then. You can have that person to port it over to 2.3, or hire someone else to do so.
 
Top