Update to dither v2.2.0 to support transparent images

This commit is contained in:
makeworld
2021-05-09 16:26:56 -04:00
parent 2404e20cd3
commit 7593701803
8 changed files with 13 additions and 12 deletions

View File

@@ -3,8 +3,8 @@
title: DIDDER
section: 1
header: User Manual
footer: didder
date: May 01, 2021
footer: didder v1.0.0-3-g2404e20
date: May 09, 2021
---
# NAME
@@ -22,7 +22,7 @@ The most important parts of this manual are highlighted in the **TIPS** section,
Homepage: <https://github.com/makeworld-the-better-one/didder>
# GLOBAL OPTIONS
# OPTIONS
**-i**, **\--in** *PATH*
Set the input file. This flag can be used multiple times to dither multiple images with the same palette and method. A *PATH* of \'**\-**' stands for standard input.

View File

@@ -10,7 +10,6 @@
didder is an extensive, fast, and accurate command-line image dithering tool. It is designed to work well for both power users as well as pipeline scripting.
It is backed by my [dithering library](https://github.com/makeworld-the-better-one/dither), and is unique in its correctness and variety of dithering algorithms. No online or offline tool I know of provides as many options, while being correct (linearizing the image).
It does not support images that make use of the alpha channel (transparency), but it will in the future.
## Types of dithering supported
@@ -48,6 +47,7 @@ More methods of dithering are being worked on, such as Riemersma, Yuliluoma, and
- Process multiple images with one command
- Combine multiple images into an animated GIF
- Uses all CPU cores when possible
- Support images with transparency (alpha channel is kept the same)
## Installation

View File

@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 2.13
.\"
.TH "DIDDER" "1" "May 01, 2021" "didder " "User Manual"
.TH "DIDDER" "1" "May 09, 2021" "didder v1.0.0-3-g2404e20" "User Manual"
.hy
.SH NAME
.PP
@@ -22,7 +22,7 @@ The most important parts of this manual are highlighted in the
\f[B]TIPS\f[R] section, make sure you check it out!
.PP
Homepage: <https://github.com/makeworld-the-better-one/didder>
.SH GLOBAL OPTIONS
.SH OPTIONS
.TP
\f[B]-i\f[R], \f[B]--in\f[R] \f[I]PATH\f[R]
Set the input file.

View File

@@ -21,7 +21,7 @@ The most important parts of this manual are highlighted in the **TIPS** section,
Homepage: <https://github.com/makeworld-the-better-one/didder>
# GLOBAL OPTIONS
# OPTIONS
**-i**, **\--in** *PATH*
: Set the input file. This flag can be used multiple times to dither multiple images with the same palette and method. A *PATH* of \'**\-**' stands for standard input.

2
go.mod
View File

@@ -4,7 +4,7 @@ go 1.16
require (
github.com/disintegration/imaging v1.6.2
github.com/makeworld-the-better-one/dither/v2 v2.1.0
github.com/makeworld-the-better-one/dither/v2 v2.2.0
github.com/urfave/cli/v2 v2.3.0
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb
)

4
go.sum
View File

@@ -5,8 +5,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/makeworld-the-better-one/dither/v2 v2.1.0 h1:ihYRtKQDkZwZutaCeRf1vYaq1Jqoy2mZGZR8BNZZK2I=
github.com/makeworld-the-better-one/dither/v2 v2.1.0/go.mod h1:VBtN8DXO7SNtyGmLiGA7IsFeKrBkQPze1/iAeM95arc=
github.com/makeworld-the-better-one/dither/v2 v2.2.0 h1:VTMAiyyO1YIO07fZwuLNZZasJgKUmvsIA48ze3ALHPQ=
github.com/makeworld-the-better-one/dither/v2 v2.2.0/go.mod h1:VBtN8DXO7SNtyGmLiGA7IsFeKrBkQPze1/iAeM95arc=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=

View File

@@ -257,8 +257,8 @@ func recolor(src image.Image) image.Image {
b := img.Bounds()
for y := b.Min.Y; y < b.Max.Y; y++ {
for x := b.Min.X; x < b.Max.X; x++ {
// Image pixel -> convert to RGBA -> find palette index using `m`
// -> find recolor palette color using index -> set color
// Image pixel -> convert to RGBA -> find recolor palette color using map
// -> set color
img.Set(x, y, paletteToRecolor[color.RGBAModel.Convert(img.At(x, y))])
}
}

View File

@@ -100,6 +100,7 @@ func preProcess(c *cli.Context) error {
r, g, b, _ := c.RGBA()
if r != g || g != b {
grayscale = false
break
}
}
}