diff --git a/go.mod b/go.mod index a870810..0c556d6 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,5 @@ module github.com/disintegration/imaging -require golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 +go 1.23.5 + +require golang.org/x/image v0.23.0 diff --git a/go.sum b/go.sum index 17bf738..8ec2c9e 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,2 @@ -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= +golang.org/x/image v0.23.0 h1:HseQ7c2OpPKTPVzNjG5fwJsOTCiiwS4QdsYi5XU6H68= +golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY= diff --git a/io.go b/io.go index f6c6da8..adebd24 100644 --- a/io.go +++ b/io.go @@ -9,7 +9,6 @@ import ( "image/jpeg" "image/png" "io" - "io/ioutil" "os" "path/filepath" "strings" @@ -69,7 +68,7 @@ func Decode(r io.Reader, opts ...DecodeOption) (image.Image, error) { go func() { defer close(done) orient = readOrientation(pr) - io.Copy(ioutil.Discard, pr) + io.Copy(io.Discard, pr) }() img, _, err := image.Decode(r) @@ -91,7 +90,6 @@ func Decode(r io.Reader, opts ...DecodeOption) (image.Image, error) { // // // Load an image and transform it depending on the EXIF orientation tag (if present). // img, err := imaging.Open("test.jpg", imaging.AutoOrientation(true)) -// func Open(filename string, opts ...DecodeOption) (image.Image, error) { file, err := fs.Open(filename) if err != nil { @@ -264,7 +262,6 @@ func Encode(w io.Writer, img image.Image, format Format, opts ...EncodeOption) e // // // Save the image as JPEG with optional quality parameter set to 80. // err := imaging.Save(img, "out.jpg", imaging.JPEGQuality(80)) -// func Save(img image.Image, filename string, opts ...EncodeOption) (err error) { f, err := FormatFromFilename(filename) if err != nil { @@ -339,7 +336,7 @@ func readOrientation(r io.Reader) orientation { if size < 2 { return orientationUnspecified // Invalid block size. } - if _, err := io.CopyN(ioutil.Discard, r, int64(size-2)); err != nil { + if _, err := io.CopyN(io.Discard, r, int64(size-2)); err != nil { return orientationUnspecified } } @@ -352,7 +349,7 @@ func readOrientation(r io.Reader) orientation { if header != exifHeader { return orientationUnspecified } - if _, err := io.CopyN(ioutil.Discard, r, 2); err != nil { + if _, err := io.CopyN(io.Discard, r, 2); err != nil { return orientationUnspecified } @@ -372,7 +369,7 @@ func readOrientation(r io.Reader) orientation { default: return orientationUnspecified // Invalid byte order flag. } - if _, err := io.CopyN(ioutil.Discard, r, 2); err != nil { + if _, err := io.CopyN(io.Discard, r, 2); err != nil { return orientationUnspecified } @@ -384,7 +381,7 @@ func readOrientation(r io.Reader) orientation { if offset < 8 { return orientationUnspecified // Invalid offset value. } - if _, err := io.CopyN(ioutil.Discard, r, int64(offset-8)); err != nil { + if _, err := io.CopyN(io.Discard, r, int64(offset-8)); err != nil { return orientationUnspecified } @@ -401,12 +398,12 @@ func readOrientation(r io.Reader) orientation { return orientationUnspecified } if tag != orientationTag { - if _, err := io.CopyN(ioutil.Discard, r, 10); err != nil { + if _, err := io.CopyN(io.Discard, r, 10); err != nil { return orientationUnspecified } continue } - if _, err := io.CopyN(ioutil.Discard, r, 6); err != nil { + if _, err := io.CopyN(io.Discard, r, 6); err != nil { return orientationUnspecified } var val uint16 diff --git a/io_test.go b/io_test.go index f0f3768..181f48b 100644 --- a/io_test.go +++ b/io_test.go @@ -9,7 +9,6 @@ import ( "image/draw" "image/png" "io" - "io/ioutil" "os" "path/filepath" "strings" @@ -26,7 +25,7 @@ type badFS struct{} func (badFS) Create(name string) (io.WriteCloser, error) { if name == "badFile.jpg" { - return badFile{ioutil.Discard}, nil + return badFile{io.Discard}, nil } return nil, errCreate } @@ -93,7 +92,7 @@ func TestOpenSave(t *testing.T) { }, } - dir, err := ioutil.TempDir("", "imaging") + dir, err := os.MkdirTemp("", "imaging") if err != nil { t.Fatalf("failed to create temporary directory: %v", err) }