mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-25 08:12:36 +02:00
Handle empty image
This commit is contained in:
parent
58f8123c9e
commit
4b434f7416
@ -144,7 +144,15 @@ func LoadImages(path string, options *ImageOptions) ([]*Image, error) {
|
|||||||
|
|
||||||
// Convert image
|
// Convert image
|
||||||
dst := image.NewPaletted(g.Bounds(src.Bounds()), options.Palette)
|
dst := image.NewPaletted(g.Bounds(src.Bounds()), options.Palette)
|
||||||
|
if dst.Bounds().Dx() == 0 || dst.Bounds().Dy() == 0 {
|
||||||
|
dst = image.NewPaletted(image.Rectangle{
|
||||||
|
Min: image.Point{0, 0},
|
||||||
|
Max: image.Point{1, 1},
|
||||||
|
}, dst.Palette)
|
||||||
|
dst.Set(0, 0, color.White)
|
||||||
|
} else {
|
||||||
g.Draw(dst, src)
|
g.Draw(dst, src)
|
||||||
|
}
|
||||||
|
|
||||||
// Encode image
|
// Encode image
|
||||||
b := bytes.NewBuffer([]byte{})
|
b := bytes.NewBuffer([]byte{})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user