Dear,
I am using Magick.NET-Q16-AnyCPU.dll version 7.12.0.0 in web app hosted in IIS
The app generates GIF using provided background image superimposed with number of smaller images (assets).
Assets are being scaled, rotated and positioned over background.
Typical background: 340x520 jpg.
Typical asset: 250x250 png.
Approximate number of assets - 100
Approximate number of frames - 60-80
Generation of GIF takes up to 2 minutes on the Azure app service.
I need to cut that time down al least to 30 seconds.
Please advise.
Thank you
How to speed up GIF creation.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to speed up GIF creation.
GIFs take time to generate, since they have to be quantized to 256 colors or less. You might consider using one common color table for all frames.
Imagemagick's color quantization is slow but does a good job. You might be able to speed it up by using a different tree-depth. See https://imagemagick.org/script/command- ... #treedepth
Imagemagick's color quantization is slow but does a good job. You might be able to speed it up by using a different tree-depth. See https://imagemagick.org/script/command- ... #treedepth
Re: How to speed up GIF creation.
Thank you for the prompt reply.
Yes, I am applying Quantize():
web.config
<add key="QuantizeColors" value="256" />
ImageMagick.QuantizeSettings settings = new ImageMagick.QuantizeSettings();
settings.Colors = quantizeColors; // from config
image.Quantize(settings);
Question:
I am compiling each frame by composing each asset on the frame.
Initially the frame is the clone of bkg image.
Will it be faster if the frame is initially set to transparent (empty) rectangle, and at the end, when all assets are placed on the frame, i compose the background image placing transparent-background frame on top of the background image?
Yes, I am applying Quantize():
web.config
<add key="QuantizeColors" value="256" />
ImageMagick.QuantizeSettings settings = new ImageMagick.QuantizeSettings();
settings.Colors = quantizeColors; // from config
image.Quantize(settings);
Question:
I am compiling each frame by composing each asset on the frame.
Initially the frame is the clone of bkg image.
Will it be faster if the frame is initially set to transparent (empty) rectangle, and at the end, when all assets are placed on the frame, i compose the background image placing transparent-background frame on top of the background image?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to speed up GIF creation.
Sorry, I cannot answer that. I do not use Magick.Net
Re: How to speed up GIF creation.
Anybody around who knows Magick.NET ins and outs?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to speed up GIF creation.
Why would it be faster? Placing the assets on a background image needs the same processing as on a transparent image, and then you would need an extra operation to place the result on the background. But you can test it to find out.gfilkov wrote:Will it be faster if the frame is initially set to transparent (empty) rectangle, and at the end, when all assets are placed on the frame, i compose the background image placing transparent-background frame on top of the background image?
If you use the same assets and background on every frame, I assume you are not re-reading them. And I assume you are doing no other superfluous work.
EDIT to add: And I suppose you don't need floating-point, so have built IM without HDRI. Perhaps Q8 is sufficient.
snibgo's IM pages: im.snibgo.com
Re: How to speed up GIF creation.
> Perhaps Q8 is sufficient
This is important, thank you!
I am still using Magick.NET-Q16-AnyCPU.dll, by inertia.
I have started with that lib, then had to cut down the size and color depth, trying to speed up my app, but did not change DLL.
I will change the lib and see how much it helped.
Thanks
This is important, thank you!
I am still using Magick.NET-Q16-AnyCPU.dll, by inertia.
I have started with that lib, then had to cut down the size and color depth, trying to speed up my app, but did not change DLL.
I will change the lib and see how much it helped.
Thanks