Skip to content

Commit

Permalink
Use official tiff package only
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshineplan committed Aug 12, 2023
1 parent 878543f commit eb11c3a
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 29 deletions.
2 changes: 0 additions & 2 deletions convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"io"
"os"

_ "github.com/sunshineplan/tiff"

"github.com/disintegration/imaging"
)

Expand Down
11 changes: 5 additions & 6 deletions converter/go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
module converter

go 1.20
go 1.21

require (
github.com/sunshineplan/imgconv v1.1.4
github.com/sunshineplan/tiff v0.0.0-20220128141034-29b9d69bd906
github.com/sunshineplan/utils v0.1.45
github.com/sunshineplan/imgconv v0.0.0-00010101000000-000000000000
github.com/sunshineplan/utils v0.1.46
)

require (
Expand All @@ -17,8 +16,8 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/sunshineplan/pdf v1.0.5 // indirect
golang.org/x/image v0.9.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/image v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

Expand Down
14 changes: 6 additions & 8 deletions converter/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@ github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/sunshineplan/pdf v1.0.5 h1:hPdpaqMZEHY99kDO5fBfmHrojBpmxbVsNreVALcFWEU=
github.com/sunshineplan/pdf v1.0.5/go.mod h1:Ljdz22+kL80CUXCIGdRUwA7PsfB7gj7ni4U71k5ZHp4=
github.com/sunshineplan/tiff v0.0.0-20220128141034-29b9d69bd906 h1:+yYRCj+PGQNnnen4+/Q7eKD2J87RJs+O39bjtHhPauk=
github.com/sunshineplan/tiff v0.0.0-20220128141034-29b9d69bd906/go.mod h1:O+Ar7ouRbdfxLgoZLFz447/dvdM1NVKk1VpOQaijvAU=
github.com/sunshineplan/utils v0.1.45 h1:HGRgIhIttxkDsOP6Z4+UH2D7nBUG5gqFdKGQ6WvDmTs=
github.com/sunshineplan/utils v0.1.45/go.mod h1:Wx+eubdt52Vl0l7U6gGjtP6VGrA5jqLeqWNDckGXL8I=
github.com/sunshineplan/utils v0.1.46 h1:m43TSqYY0K+n5rY93+7Hr1UCWvtWQYve31nB7G5Us9g=
github.com/sunshineplan/utils v0.1.46/go.mod h1:7zhDUGgKo2FMFzs7j6IL7B/lh3BRuE7rb7R7IgGOAfc=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.9.0 h1:QrzfX26snvCM20hIhBwuHI/ThTg18b/+kcKdXHvnR+g=
golang.org/x/image v0.9.0/go.mod h1:jtrku+n79PfroUbvDdeUWMAI+heR786BofxrbiSF+J0=
golang.org/x/image v0.11.0 h1:ds2RoQvBvYTiJkwpSFDwCcDFNX7DqjL2WsUgTNk0Ooo=
golang.org/x/image v0.11.0/go.mod h1:bglhjqbqVuEb9e9+eNR45Jfu7D+T4Qan+NhQk8Ck2P8=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
Expand All @@ -47,8 +45,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
Expand Down
5 changes: 1 addition & 4 deletions converter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"time"

"github.com/sunshineplan/imgconv"
_ "github.com/sunshineplan/tiff"
"github.com/sunshineplan/utils/flags"
"github.com/sunshineplan/utils/progressbar"
"github.com/sunshineplan/utils/workers"
Expand Down Expand Up @@ -62,7 +61,7 @@ func usage() {
--quality
set jpeg or pdf quality (range 1-100, default: 75)
--compression
set tiff compression type (none, lzw, jpeg, deflate, default: lzw)
set tiff compression type (none, lzw, deflate, default: lzw)
--auto-orientation
auto orientation (default: false)
--watermark
Expand Down Expand Up @@ -123,8 +122,6 @@ func main() {
ct = imgconv.TIFFUncompressed
case "lzw":
ct = imgconv.TIFFLZW
case "jpeg":
ct = imgconv.TIFFJPEG
case "deflate":
ct = imgconv.TIFFDeflate
default:
Expand Down
5 changes: 1 addition & 4 deletions format.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (

"github.com/disintegration/imaging"
"github.com/sunshineplan/pdf"
"github.com/sunshineplan/tiff" // decode tiff format, not check IFD tags order
"golang.org/x/image/bmp"
"golang.org/x/image/tiff"
_ "golang.org/x/image/webp" // decode webp format
)

Expand Down Expand Up @@ -68,7 +68,6 @@ const (
TIFFLZW
TIFFCCITTGroup3
TIFFCCITTGroup4
TIFFJPEG
)

func (c TIFFCompression) value() tiff.CompressionType {
Expand All @@ -81,8 +80,6 @@ func (c TIFFCompression) value() tiff.CompressionType {
return tiff.CCITTGroup3
case TIFFCCITTGroup4:
return tiff.CCITTGroup4
case TIFFJPEG:
return tiff.JPEG
}
return tiff.Uncompressed
}
Expand Down
1 change: 0 additions & 1 deletion format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func TestEncode(t *testing.T) {
{Format: PNG, EncodeOption: []EncodeOption{PNGCompressionLevel(png.DefaultCompression)}},
{Format: GIF, EncodeOption: []EncodeOption{GIFNumColors(256), GIFDrawer(draw.FloydSteinberg), GIFQuantizer(nil)}},
{Format: TIFF, EncodeOption: []EncodeOption{TIFFCompressionType(TIFFLZW)}},
{Format: TIFF, EncodeOption: []EncodeOption{TIFFCompressionType(TIFFJPEG)}},
{Format: BMP},
{Format: PDF, EncodeOption: []EncodeOption{Quality(75)}},
}
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
module github.com/sunshineplan/imgconv

go 1.20
go 1.21

require (
github.com/disintegration/imaging v1.6.2
github.com/sunshineplan/pdf v1.0.5
github.com/sunshineplan/tiff v0.0.0-20220128141034-29b9d69bd906
golang.org/x/image v0.11.0
)

Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/sunshineplan/pdf v1.0.5 h1:hPdpaqMZEHY99kDO5fBfmHrojBpmxbVsNreVALcFWEU=
github.com/sunshineplan/pdf v1.0.5/go.mod h1:Ljdz22+kL80CUXCIGdRUwA7PsfB7gj7ni4U71k5ZHp4=
github.com/sunshineplan/tiff v0.0.0-20220128141034-29b9d69bd906 h1:+yYRCj+PGQNnnen4+/Q7eKD2J87RJs+O39bjtHhPauk=
github.com/sunshineplan/tiff v0.0.0-20220128141034-29b9d69bd906/go.mod h1:O+Ar7ouRbdfxLgoZLFz447/dvdM1NVKk1VpOQaijvAU=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
Expand Down

0 comments on commit eb11c3a

Please sign in to comment.