add new flag -g to compress gifs#32
Merged
SHKnudsen merged 2 commits intoSHKnudsen:Node-Markdown-generator-toolfrom Aug 18, 2021
Merged
add new flag -g to compress gifs#32SHKnudsen merged 2 commits intoSHKnudsen:Node-Markdown-generator-toolfrom
SHKnudsen merged 2 commits intoSHKnudsen:Node-Markdown-generator-toolfrom
Conversation
add gif compression by quantization to 32k colors in debug leave console open until readline for easy log reading
Owner
|
LGTM |
SHKnudsen
approved these changes
Aug 17, 2021
pinzart90
reviewed
Aug 17, 2021
| //images.Optimize(); | ||
| //images.OptimizeTransparency(); | ||
| //reduce color bit depth from 8 to 5. | ||
| images.Quantize(new QuantizeSettings() { Colors = 32768 }); |
Collaborator
Author
There was a problem hiding this comment.
yes (2^5) bits per red, green, and blue 32*32*32 = 32k colors. Normal 8 bit per channel can support: 16777216 colors.
|
@mjkkirschner I thought that gifs never worked for documentation. Is it that after this change they now can be rendered or were they always supported and this is only for compression? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where animated gifs were not optimized at all. There are a few issues.
gifs/animated gifs are quite complex - if they have been optimized before using certain methods -they cannot be optimized again - for example, if they contain frames with different internal sizes. (an optimization technique)
it's possible to undo this and then optimize with image magick, but I found this to be too slow ~ 10 minutes for 40 gifs.
Instead I found that using quantization (color reduction to 32k colors) works very well, is quite fast, and produces results about 10% - 50% reduction per gif.
running the tool on RevitNodes.dll and Revit dictionary takes 33 seconds before this change, and 99 seconds after this change - the folder is reduced from 44megs to 38 megs. (we don't have that many .gifs in the Revit dictionary content today, only 40.)
because reducing the .gif's is still quite slow overall, and⚠️ ❗ not lossless I added a separate flag for it, this is handy for quickly debugging other parts of the tool or avoiding the gif image changes.
also now in debug mode leave console open until console.readline for easier log reading.
this is a pathologically bad example because it has a ton of colors used in the animation.
1Meg

900kB
