Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change --lossy algorithm to use current colorspace.
* The loss score is scaled to errors in the current colorspace by normalizing to the distance between rgb(0,0,0) and rgb(0,0,LOSS). * Reset accumulated error at the start of each line (don't want to carry error into a different region of the image). * The previous difference algorithm would accumulate differences in the difference score. The new algorithm does not. Rather, the error term is used only to eliminate candidates. A color is a valid candidate iff it is both close enough to the real pixel, and close enough to the real pixel modified by accumulated error. * Rather than choosing the longest sequence with minimum error, compute a score that considers both length and error. The results look reasonable, but the argument to `--lossy` has different effects. For `--gamma=1`, this commit results in better compression than the former commit (1.644M v. 2.202M), on the falling-beecat gif from pull request #16, at the cost of modest posterization (long runs of the same pixel, rather than dithering). For `--gamma=srgb`, this commit compresses worse than the old version, but with fewer artifacts, and `--lossy=40` still looks ok.
- Loading branch information