diff --git a/go.mod b/go.mod index f180b76..ae9347d 100644 --- a/go.mod +++ b/go.mod @@ -2,9 +2,4 @@ module github.com/pepabo/oyaki go 1.19 -require ( - github.com/disintegration/imaging v1.6.2 - github.com/h2non/bimg v1.1.9 -) - -require golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 // indirect +require github.com/h2non/bimg v1.1.9 diff --git a/go.sum b/go.sum index 9d879fe..0133487 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,2 @@ -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/h2non/bimg v1.1.9 h1:WH20Nxko9l/HFm4kZCA3Phbgu2cbHvYzxwxn9YROEGg= github.com/h2non/bimg v1.1.9/go.mod h1:R3+UiYwkK4rQl6KVFTOFJHitgLbZXBZNFh2cv3AEbp8= -golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 h1:hVwzHzIUGRjiF7EcUjqNxk3NCfkPxbDKRdnNE1Rpg0U= -golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/webp_test.go b/webp_test.go index d53f3e8..73e95d2 100644 --- a/webp_test.go +++ b/webp_test.go @@ -6,10 +6,7 @@ import ( "net/http" "net/http/httptest" "os" - "os/exec" "testing" - - "github.com/disintegration/imaging" ) func TestProxyWebP(t *testing.T) { @@ -60,47 +57,6 @@ func TestConvJPG2WebP(t *testing.T) { } -func BenchmarkConvJPG2WebP_OldCwebpMethod(b *testing.B) { - tmpF, err := os.CreateTemp("/tmp", "") - if err != nil { - b.Fatal("failed to create tmp file") - } - defer tmpF.Close() - defer os.Remove(tmpF.Name()) - - f, err := os.Open("./testdata/oyaki.jpg") - if err != nil { - b.Fatal("failed to open testdata") - } - defer f.Close() - - // to re-use src bytes - src, err := io.ReadAll(f) - if err != nil { - b.Fatal("failed to open testdata") - } - - b.ResetTimer() - for i := 0; i < b.N; i++ { - b.StopTimer() - srcBuf := bytes.NewBuffer(src) - b.StartTimer() - img, err := imaging.Decode(srcBuf, imaging.AutoOrientation(true)) - if err != nil { - b.Fail() - } - - if err := imaging.Encode(tmpF, img, imaging.JPEG); err != nil { - b.Fail() - } - - params := []string{"-quiet", "-mt", "-jpeg_like", f.Name(), "-o", "-"} - if _, err = exec.Command("cwebp", params...).Output(); err != nil { - b.Fail() - } - } -} - func BenchmarkConvJPG2WebP_bimg(b *testing.B) { f, err := os.Open("./testdata/oyaki.jpg") if err != nil {