nfnt / resize

Pure golang image resizing
ISC License
3.02k stars 321 forks source link

Panic on resize 2 #58

Closed dblokhin closed 6 years ago

dblokhin commented 7 years ago

Hi. This simple code generate a panic error:

package main

import (
    "github.com/nfnt/resize"
    "os"
    "image/jpeg"
)

func main() {
    f, err := os.Open("test.jpg")
    if err != nil {
        panic(err)
    }

    image, err := jpeg.Decode(f)
    if err != nil {
        panic(err)
    }

    resize.Resize(600, 0, image, resize.Lanczos3)
}

Message:

go run src/test.go 
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/nfnt/resize.imageYCbCrToYCC(0x18416140, 0x12)
        /dev/src/github.com/nfnt/resize/ycc.go:220 +0x5af
github.com/nfnt/resize.Resize(0x1f4, 0x0, 0x810bf00, 0x18416140, 0x5, 0x0, 0x184000f0)
        /dev/src/github.com/nfnt/resize/resize.go:173 +0x320a
main.main()
        /dev/src/test.go:20 +0xa0
exit status 2

The image is attached. It is a movie poster. The error appears with any InterpolationFunction. What can I do? test

dblokhin commented 7 years ago

Is there anybody here?

nfnt commented 6 years ago

Duplicate of #37, fixed with #57.