gif

How to extract frames from a TGifImage into Bitmaps?

淺唱寂寞╮ 提交于 2021-02-06 11:40:47
问题 The demo below tries to draw the GIF on form's canvas. It doesn't work. The image won't advance. How to make it work? procedure TForm1.FormCreate(Sender: TObject); begin GIF := TGIFImage.Create; GIF.LoadFromFile('c:\2.gif'); end; procedure TForm1.FormDestroy(Sender: TObject); begin GIF.Free; end; procedure TForm1.Button1Click(Sender: TObject); VAR i: Integer; begin REPEAT for i:= 0 to GIF.Images.Count-1 DO begin DisplayGifFrame(i); Sleep(30); end; UNTIL FALSE; end; procedure TForm1

How to extract frames from a TGifImage into Bitmaps?

我怕爱的太早我们不能终老 提交于 2021-02-06 11:40:44
问题 The demo below tries to draw the GIF on form's canvas. It doesn't work. The image won't advance. How to make it work? procedure TForm1.FormCreate(Sender: TObject); begin GIF := TGIFImage.Create; GIF.LoadFromFile('c:\2.gif'); end; procedure TForm1.FormDestroy(Sender: TObject); begin GIF.Free; end; procedure TForm1.Button1Click(Sender: TObject); VAR i: Integer; begin REPEAT for i:= 0 to GIF.Images.Count-1 DO begin DisplayGifFrame(i); Sleep(30); end; UNTIL FALSE; end; procedure TForm1

How to compress gif effectively to reduce size?

爱⌒轻易说出口 提交于 2021-01-29 11:24:32
问题 We use gifs for our blog extensively. We used to embed tenor nano gifs(90px height maintaining aspect ratio, used for GIF previews and shares on mobile) in it. Now we wanted to create our own gifs and are using the following command to convert mp4 to gif while maintaining the properties of tenor's nano gif. using ffmpeg version 4.1.4 But we observed a huge difference in size between the gif we created and the one created using tenor. ffmpeg -i input.mp4 -filter_complex "[0:v]fps=10,scale=-1

GIF lose animation on upload

感情迁移 提交于 2021-01-28 13:50:49
问题 I have a project with Laravel 7.1 and Backpack and I lose the animation of the GIF images on upload. CRUD $this->crud->addField([ 'name' => 'photo', 'label' => 'Imagen ES', 'type' => 'image', 'upload' => false, 'prefix' => 'uploads/', ]); MODEL public function setPhotoAttribute($value){ $year = date('Y'); $attribute_name = "photo"; $disk = "uploads"; $destination_path = "/noticias/$year"; // if the image was erased if ($value==null) { // delete the image from disk \Storage::disk($disk)-

GIF animation on canvas with frame control

不想你离开。 提交于 2021-01-28 10:42:02
问题 I have some frames within gif and i want to play them on canvas with collision detection. Is there someway how to extract frames from gif with javascript? 回答1: The short answer is that JavaScript has no simple way of controlling the current frame of an Animated GIF. The long answer is that there are sort-of ways to do what you want with just JS, but they are very much convoluted hacks. Example of hackish way: Create a canvas and don't add it to the DOM (so this won't be seen by anyone). In a

GIF animation on canvas with frame control

ぐ巨炮叔叔 提交于 2021-01-28 10:40:44
问题 I have some frames within gif and i want to play them on canvas with collision detection. Is there someway how to extract frames from gif with javascript? 回答1: The short answer is that JavaScript has no simple way of controlling the current frame of an Animated GIF. The long answer is that there are sort-of ways to do what you want with just JS, but they are very much convoluted hacks. Example of hackish way: Create a canvas and don't add it to the DOM (so this won't be seen by anyone). In a

How to get frame delay from animated gif?

三世轮回 提交于 2021-01-28 03:13:17
问题 I try resize animated gif. I resize each frame as bitmap and then make new animated gif but I don't know how to get frame delay for same speed animation as in original gif. uses Gifimg; procedure TForm1.FormCreate(Sender: TObject); var gif: TGIFImage; bmp,bmp2: TBitmap; i:integer; gifren: TGIFRenderer; gif2:TGifImage; begin gif:=TGIFImage.Create; gif2:=tgifimage.Create; bmp:=TBitmap.Create; bmp2:=TBitmap.Create; gif.LoadFromFile('d:\z.gif'); gifren:=TGIFRenderer.Create(gif); for i:=0 to gif

Extract key frames from GIF using Python

给你一囗甜甜゛ 提交于 2021-01-27 06:59:29
问题 I want to compress a GIF image by extracting 15 frames from the GIF that preferably should be distinct. I'm using Python and Pillow library and I didn't find any way to get the number of frames a GIF has in the Pillow docs. Neither did I find how to extract a specific frame from a GIF, because Pillow restricts that. Is there any way to extract frames without iterating through each frame consequently? Is there a more advanced Python library for GIF processing? 回答1: For the number of frames,

Extract key frames from GIF using Python

拜拜、爱过 提交于 2021-01-27 06:56:53
问题 I want to compress a GIF image by extracting 15 frames from the GIF that preferably should be distinct. I'm using Python and Pillow library and I didn't find any way to get the number of frames a GIF has in the Pillow docs. Neither did I find how to extract a specific frame from a GIF, because Pillow restricts that. Is there any way to extract frames without iterating through each frame consequently? Is there a more advanced Python library for GIF processing? 回答1: For the number of frames,

Stop gif image from repeating in matplotlib

て烟熏妆下的殇ゞ 提交于 2021-01-20 07:07:09
问题 I searched for other similar questions but that didn't solve my problem. Below is a simple code that generates an animation in the form of a gif image in matplotlib: import numpy as np import matplotlib.pylab as plt import matplotlib.animation as anm fig = plt.figure() def draw(i): x = np.linspace(0, 5, num = 1000) y = np.sin(x-i*0.1) plt.clf() plt.plot(x, y, 'r-') anim = anm.FuncAnimation(fig, draw, frames = 10, interval = 500, repeat = False) anim.save('test.gif', fps = 1, writer =