PHP – Create simple animated GIF from two JPEG images? [closed]

For a nice, quick and more recent solution, see this SO answer. For an even more recent solution, here is my fork of it, with a number of small fixes & improvements. An example of it from an actual application: $anim = new GifCreator\AnimGif(); $gif = $anim->create($image_files); //file_put_contents(“test.gif”, $gif); header(“Content-type: image/gif”); echo $gif; (Requires PHP5.3 … Read more

Showing gif in android

Good start. Gotta make it more useful for loading different gifs after being added to the view and for either assets or resources. Also, for devices with hardware acceleration I was getting blank views, so I turned it off for this GIFView. Also, be sure to put animated gifs in the res/drawable-xhdpi directory (or assets … Read more

How to CREATE a transparent gif (or png) with PIL (python-imaging)

The following script creates a transparent GIF with a red circle drawn in the middle: from PIL import Image, ImageDraw img = Image.new(‘RGBA’, (100, 100), (255, 0, 0, 0)) draw = ImageDraw.Draw(img) draw.ellipse((25, 25, 75, 75), fill=(255, 0, 0)) img.save(‘test.gif’, ‘GIF’, transparency=0) and for PNG format: img.save(‘test.png’, ‘PNG’)

play downloaded Gif image in android

I am using the below custom View instead of Image View. public class SampleView extends View { private Movie mMovie; private long mMovieStart; public SampleView(Context context) { super(context); setFocusable(true); java.io.InputStream is; is = context.getResources().openRawResource(R.drawable.girl_dances); mMovie = Movie.decodeStream(is); } public SampleView(Context context, AttributeSet attrSet) { super(context, attrSet); setFocusable(true); java.io.InputStream is; is = context.getResources().openRawResource(R.drawable.girl_dances); mMovie = Movie.decodeStream(is); … Read more

matplotlib save animation in gif error

This is because matplotlib does not support GIFs without external programs. If you have imagemagick correctly installed and configured, this should work: import matplotlib matplotlib.use(‘Agg’) import matplotlib.pyplot as plt import matplotlib.animation import numpy as np def init_animation(): global line line, = ax.plot(x, np.zeros_like(x)) ax.set_xlim(0, 2*np.pi) ax.set_ylim(-1,1) def animate(i): line.set_ydata(np.sin(2*np.pi*i / 50)*np.sin(x)) return line, fig = … Read more

Show animated GIF

Using Swing you could simply use a JLabel: public static void main(String[] args) throws MalformedURLException { URL url = new URL(“<url_to_animated_gif>”); Icon icon = new ImageIcon(url); JLabel label = new JLabel(icon); JFrame f = new JFrame(“Animation”); f.getContentPane().add(label); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); }