[GH-ISSUE #115] Encoders and file size #101

Open
opened 2026-02-26 08:45:19 +03:00 by kerem · 13 comments
Owner

Originally created by @druellan on GitHub (Mar 25, 2017).
Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/115

Hi! I'm trying to understand how the different encoders work. But so far I'm not getting the results I expected.

I'm using a somehow complex GIF as a test:

abstract02

This GIF was exported from Photoshop and it's about 2mb in size.
Saving the GIF from the 2.6 editor without modifications and using several encoders, I get this results:

Encoder GIF size
Photoshop 2.082 MB
System 3.963 MB
1.0 - quality 1 6.773 MB
1.0 - quality 20 6.773 MB
1.0 - quality 10 - unchanged pixels 6.740 MB
1.0 - quality 10 - unchanged - dummy color 5.372 MB
2.0 - 250 colors 6.803 MB
2.0 - 250 colors - unchanged 6.772 MB
2.0 - 250 colors - unchanged - dummy color 5.384 MB

I wasn't expecting better results than Photoshop, but twice the size as the best result, seems odd.
Are those results correct?

All the files can be downloaded from: https://www.dropbox.com/s/yjnm6um1resgjbr/abstract02.zip?dl=0

Thanks!

Originally created by @druellan on GitHub (Mar 25, 2017). Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/115 Hi! I'm trying to understand how the different encoders work. But so far I'm not getting the results I expected. I'm using a somehow complex GIF as a test: ![abstract02](https://cloud.githubusercontent.com/assets/6965667/24321816/519dd2c4-1134-11e7-884b-0f7db25731ef.gif) This GIF was exported from Photoshop and it's about 2mb in size. Saving the GIF from the 2.6 editor without modifications and using several encoders, I get this results: | Encoder | GIF size | |---|---| | Photoshop | 2.082 MB | | System | 3.963 MB | | 1.0 - quality 1 | 6.773 MB | | 1.0 - quality 20 | 6.773 MB | | 1.0 - quality 10 - unchanged pixels | 6.740 MB | | 1.0 - quality 10 - unchanged - dummy color | 5.372 MB | | 2.0 - 250 colors | 6.803 MB | | 2.0 - 250 colors - unchanged | 6.772 MB | | 2.0 - 250 colors - unchanged - dummy color | 5.384 MB | I wasn't expecting better results than Photoshop, but twice the size as the best result, seems odd. Are those results correct? All the files can be downloaded from: https://www.dropbox.com/s/yjnm6um1resgjbr/abstract02.zip?dl=0 Thanks!
Author
Owner

@NickeManarin commented on GitHub (Mar 30, 2017):

Yeah, that's it.

Photoshop is a 27 years old professional (thus very expensive) software (probably) made by several full-time developers using a very powerful language (C/C++).

ScreenToGif is a 2 years old indie (free, no ads) software made (during weekends) by 1 developer using a little bit slower managed language (C#).

Also, image encoding algorithms are quite hard for me. Specially color quantization, something that Photoshop is way better.

If you know someone up to the challenge to help me out improving the encoding algorithms, just say the word. :)

<!-- gh-comment-id:290418418 --> @NickeManarin commented on GitHub (Mar 30, 2017): Yeah, that's it. Photoshop is a 27 years old professional (thus very expensive) software (probably) made by several full-time developers using a very powerful language (C/C++). ScreenToGif is a 2 years old indie (free, no ads) software made (during weekends) by 1 developer using a little bit slower managed language (C#). Also, image encoding algorithms are quite hard for me. Specially color quantization, something that Photoshop is way better. If you know someone up to the challenge to help me out improving the encoding algorithms, just say the word. :)
Author
Owner

@druellan commented on GitHub (Mar 30, 2017):

Hi @NickeManarin thanks for the answer.

I'm by no means implying you did a bad job or that your (free) work should be at the same level as an expensive professional tool. I'm just puzzled about the results here, wondering if there is some kind of bug, but anyway, your algorithms seems to work well if you are using the tool for screen capture, so...

<!-- gh-comment-id:290556575 --> @druellan commented on GitHub (Mar 30, 2017): Hi @NickeManarin thanks for the answer. I'm by no means implying you did a bad job or that your (free) work should be at the same level as an expensive professional tool. I'm just puzzled about the results here, wondering if there is some kind of bug, but anyway, your algorithms seems to work well if you are using the tool for screen capture, so...
Author
Owner

@NickeManarin commented on GitHub (Apr 2, 2017):

Oh, it's alright :D

From what I understand, with more colors and more color changes, the gif tends to be bigger.

I don't have Photoshop installed, but I once saw that you can add dithering and change how the type of palette. This could greatly decrease the file size.

I'll take a look at your examples to see how they behave.

<!-- gh-comment-id:291006146 --> @NickeManarin commented on GitHub (Apr 2, 2017): Oh, it's alright :D From what I understand, with more colors and more color changes, the gif tends to be bigger. I don't have Photoshop installed, but I once saw that you can add dithering and change how the type of palette. This could greatly decrease the file size. I'll take a look at your examples to see how they behave.
Author
Owner

@ronosaurus commented on GitHub (May 12, 2017):

Nicke, are you able to incorporate existing libraries like these:

On-line example:

<!-- gh-comment-id:301068745 --> @ronosaurus commented on GitHub (May 12, 2017): Nicke, are you able to incorporate existing libraries like these: - https://kornel.ski/lossygif - https://github.com/pornel/giflossy On-line example: - https://ezgif.com/optimize
Author
Owner

@NickeManarin commented on GitHub (May 12, 2017):

I'm currently working on a new "Recorder" experience, I should focus on this afterwards. Thanks.

<!-- gh-comment-id:301091461 --> @NickeManarin commented on GitHub (May 12, 2017): I'm currently working on a new "Recorder" experience, I should focus on this afterwards. Thanks.
Author
Owner

@Kristinita commented on GitHub (Mar 15, 2018):

1. Summary

GIF's have very big size for me.

If I insert ScreenToGIF GIF to web page → user browser will hangs.

2. Example

ScreenToGIF 2.12.1.

Project file.

15-second GIF size:

  • Encoder 2.0 — 7.6 MB,
  • Encoder 1.0 — 11.1 MB,
  • ffmpeg — 11.7 MB,
  • apng — 35.7 MB,
  • System — 37.9 MB,
  • Gifski — I have a bug.

But video have normal size:

  • ffmpeg mp4 — 2.1 MB.

3. Not helped

Yes, I can use image optimizers, but they slightly reduce GIF size.

Thanks.

<!-- gh-comment-id:373291777 --> @Kristinita commented on GitHub (Mar 15, 2018): ### 1. Summary GIF's have very big size for me. If I insert ScreenToGIF GIF to web page → user browser will hangs. ### 2. Example ScreenToGIF 2.12.1. [**Project file**](https://app.box.com/s/01r47zfo1t7tprgo8ck84wfij2zpzr7c). 15-second GIF size: + Encoder 2.0 — 7.6 MB, + Encoder 1.0 — 11.1 MB, + ffmpeg — 11.7 MB, + apng — 35.7 MB, + System — 37.9 MB, + Gifski — I have a bug. But video have normal size: + ffmpeg mp4 — 2.1 MB. ### 3. Not helped Yes, I can use image optimizers, but they slightly reduce GIF size. Thanks.
Author
Owner

@vatterspun commented on GitHub (Mar 16, 2018):

I'm by no means implying you did a bad job or that your (free) work should be at the same level as an expensive professional tool.

Yeah man, you're doing an amazing job. I've stepped away from some of the animation stuff I was doing years ago but if I had more time I'd be all over this program.

Saving the GIF from the 2.6 editor without modifications and using several encoders, I get this results

There are a few ways to optimize GIFs that I've seen:

  1. Cut out things (colors, frames, detail, etc), which you've sort of already addressed.

  2. Analysis between frames of what hasn't changed. It's a very dumb version of what modern video players do. If you were to rip apart the Photoshop GIF file, you'd probably see huge swaths of the image missing from frame to frame.

In messing around with the format, I've seen that some GIF encoders are better than others at this, but I'm not sure of the current status. However, with the 256 color limitation, I've been arguing that animated PNG (#129) is more worth your time and effort, since there are at host of great PNG compression tools out there that could be put to the task. You might find something more interesting than the black box of "Photoshop does it somehow".

<!-- gh-comment-id:373566857 --> @vatterspun commented on GitHub (Mar 16, 2018): > I'm by no means implying you did a bad job or that your (free) work should be at the same level as an expensive professional tool. Yeah man, you're doing an amazing job. I've stepped away from some of the animation stuff I was doing years ago but if I had more time I'd be all over this program. > Saving the GIF from the 2.6 editor without modifications and using several encoders, I get this results There are a few ways to optimize GIFs that I've seen: 1. Cut out things (colors, frames, detail, etc), which you've sort of already addressed. 2. Analysis between frames of what hasn't changed. It's a very dumb version of what modern video players do. If you were to rip apart the Photoshop GIF file, you'd probably see huge swaths of the image missing from frame to frame. In messing around with the format, I've seen that some GIF encoders are better than others at this, but I'm not sure of the current status. However, with the 256 color limitation, I've been arguing that animated PNG (#129) is more worth your time and effort, since there are at host of great PNG compression tools out there that could be put to the task. You might find something more interesting than the black box of "Photoshop does it somehow".
Author
Owner

@NickeManarin commented on GitHub (Mar 16, 2018):

Gifski — I have a bug.

@Kristinita I'll investigate that issue.

<!-- gh-comment-id:373577822 --> @NickeManarin commented on GitHub (Mar 16, 2018): > Gifski — I have a bug. @Kristinita I'll investigate that issue.
Author
Owner

@NickeManarin commented on GitHub (Mar 16, 2018):

@vatterspun

[...] I've been arguing that animated PNG (#129) is more worth your time and effort [...]

Indeed. I just wished that all major browsers had support for it. I'm looking at you, Edge/IE.

Anyway, with the next release (v2.14), I want to implement a "Save as PSD". Let's see if it's easy to do that and if it's possible to export with the timestamps.

<!-- gh-comment-id:373578532 --> @NickeManarin commented on GitHub (Mar 16, 2018): @vatterspun > [...] I've been arguing that animated PNG (#129) is more worth your time and effort [...] Indeed. I just wished that all major browsers had support for it. I'm looking at you, Edge/IE. Anyway, with the next release (v2.14), I want to implement a "Save as PSD". Let's see if it's easy to do that and if it's possible to export with the timestamps.
Author
Owner

@druellan commented on GitHub (Mar 16, 2018):

ffmpeg mp4 — 2.1 MB.

If you're converting from video files, chances are the GIF encoder is not going to do a great job.

First, is not possible to compete with a lossy algorithm, but also, the "noise" the mp4 algorithm introduces into the video kills the GIF compression. GIF compression usually works detecting unchanged pixels frame to frame, a frame with mp4 "noise" is going to be vastly different to the next one, even if we can't perceive the variations, GIF compressors usually can, and that increases the file size even more.

<!-- gh-comment-id:373692627 --> @druellan commented on GitHub (Mar 16, 2018): > ffmpeg mp4 — 2.1 MB. If you're converting from video files, chances are the GIF encoder is not going to do a great job. First, is not possible to compete with a lossy algorithm, but also, the "noise" the mp4 algorithm introduces into the video kills the GIF compression. GIF compression usually works detecting unchanged pixels frame to frame, a frame with mp4 "noise" is going to be vastly different to the next one, even if we can't perceive the variations, GIF compressors usually can, and that increases the file size even more.
Author
Owner

@vatterspun commented on GitHub (Mar 17, 2018):

Indeed. I just wished that all major browsers had support for it. I'm looking at you, Edge/IE.

I'd say it's just a matter of time. They're really down to browser customers that are either companies or people who don't mess with anything that isn't already installed on their computer. As such I'd think they'll do that to keep pace.

Frankly, support of the format by an easy-to-use and mature animation editor like yours goes much further toward broad adoption than the various posts I've done around the web.

<!-- gh-comment-id:373957769 --> @vatterspun commented on GitHub (Mar 17, 2018): > Indeed. I just wished that all major browsers had support for it. I'm looking at you, Edge/IE. I'd say it's just a matter of time. They're really down to browser customers that are either companies or people who don't mess with anything that isn't already installed on their computer. As such I'd think they'll do that to keep pace. Frankly, support of the format by an easy-to-use and mature animation editor like yours goes *much* further toward broad adoption than the various posts I've done around the web.
Author
Owner

@Kristinita commented on GitHub (Jan 30, 2019):

Type: Questions

@NickeManarin,

1. APNG

Have you tried implemented APNG Assembler? Its developers write about it:

Creates highly optimized APNG files, uses lots of tricks to make them as small as possible

2. FFmpeg

Have you tried implemented optimize GIFs with FFmpeg as in this article?

So we needed to crunch the gifs down to the smallest possible size

Thanks.

<!-- gh-comment-id:458982135 --> @Kristinita commented on GitHub (Jan 30, 2019): **`Type: Questions`** @NickeManarin, ### 1. APNG Have you tried implemented [**APNG Assembler**](https://sourceforge.net/projects/apngasm/)? [**Its developers write about it**](http://littlesvr.ca/apng/): > Creates highly optimized APNG files, uses lots of tricks to make them as small as possible ### 2. FFmpeg Have you tried implemented optimize GIFs with FFmpeg as in [**this article**](https://cassidy.codes/blog/2017/04/25/ffmpeg-frames-to-gif-optimization/)? > So we needed to crunch the gifs down to the smallest possible size Thanks.
Author
Owner

@vatterspun commented on GitHub (Feb 2, 2019):

Indeed. I just wished that all major browsers had support for it. I'm looking at you, Edge/IE.

I'd say it's just a matter of time.

Looks like that ended up being accurate: https://www.theverge.com/2018/12/4/18125238/microsoft-chrome-browser-windows-10-edge-chromium ... It looks like the next Microsoft web browser will support APNG along with all other Chrome-based browsers. And Internet Explorer already has very low usage numbers (I'm seeing 2.55% from statista.com as of Dec '18)

<!-- gh-comment-id:459997337 --> @vatterspun commented on GitHub (Feb 2, 2019): >> Indeed. I just wished that all major browsers had support for it. I'm looking at you, Edge/IE. > I'd say it's just a matter of time. Looks like that ended up being accurate: https://www.theverge.com/2018/12/4/18125238/microsoft-chrome-browser-windows-10-edge-chromium ... It looks like the next Microsoft web browser will support APNG along with all other Chrome-based browsers. And Internet Explorer already has very low usage numbers (I'm seeing 2.55% from statista.com as of Dec '18)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ScreenToGif#101
No description provided.