mirror of
https://github.com/tenox7/wrp.git
synced 2024-11-21 04:31:25 +00:00
only resize larger images
This commit is contained in:
parent
3f445abd14
commit
866750700b
6
txt.go
6
txt.go
@ -196,9 +196,11 @@ func smallGif(src []byte) ([]byte, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("image decode problem: %v", err)
|
return nil, fmt.Errorf("image decode problem: %v", err)
|
||||||
}
|
}
|
||||||
sm := resize.Resize(200, 0, img, resize.NearestNeighbor)
|
if img.Bounds().Max.X-img.Bounds().Min.X > 200 {
|
||||||
|
img = resize.Resize(200, 0, img, resize.NearestNeighbor)
|
||||||
|
}
|
||||||
var gifBuf bytes.Buffer
|
var gifBuf bytes.Buffer
|
||||||
err = gif.Encode(&gifBuf, gifPalette(sm, 216), &gif.Options{})
|
err = gif.Encode(&gifBuf, gifPalette(img, 216), &gif.Options{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("gif encode problem: %v", err)
|
return nil, fmt.Errorf("gif encode problem: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user