How to resize an animated gif image using C#?

Took me a while to find this, but finally found a solution: Install Magick.NET via NuGet, license can be found here: https://magick.codeplex.com/license Example code: var newWidth = 100; using (var collection = new MagickImageCollection(new FileInfo(@”C:\test.gif”))) { collection.Coalesce(); foreach (var image in collection) { image.Resize(newWidth, 0); } collection.Write(@”c:\resized.gif”); } From my tests, this works with alpha … Read more

Animated gif only loops once in Chrome and Firefox

I was facing the same problem with my GIF encoder/decoder class I wrote some time ago (and improving from time to time). I found out the solution for this just yesterday. The GIF is completely fine the problem is on a modern internet browser’s side. Affected browsers are Opera, IE, and Chrome (didn’t test others). … Read more

Can a PictureBox show animated GIF in Windows Application?

Put a PictureBox on a form and then specify a picture file with a Gif extension. Or: Programatically animate a gif Image loading frames into a PictureBox with code, here’s the Gif class: VB.NET Imports System.Drawing.Imaging Imports System.Drawing Public Class GifImage Private gifImage As Image Private dimension As FrameDimension Private frameCount As Integer Private currentFrame … Read more

How to use Animated Gif in a delphi form

It’s pretty simple in modern Delphi. It’s all built in. Drop a TImage onto the form and load the animated GIF into the Picture property. Then, start the animation by means of the Animate property: (Image1.Picture.Graphic as TGIFImage).Animate := True; You can control the animation with AnimateLoop and AnimateSpeed. It should be pretty easy to … Read more

.gif image doesn’t moves on adding it to the JTabbed pane

Let me demonstrate the hole you are digging yourself into You could do… BufferedImage img = ImageIO.read(this.getClass().getResource(“anigif.gif”)); ImageIcon icon = new ImageIcon(img); JLabel label = new JLabel(icon); add(label); Or you could do… Now, this is woefully inadequate and is designed for example purposes only. It does not support disposal methods or optimized Gifs…so you can … 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); }

tech