mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-24 15:52:38 +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
|
||||
dst := image.NewPaletted(g.Bounds(src.Bounds()), options.Palette)
|
||||
g.Draw(dst, src)
|
||||
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)
|
||||
}
|
||||
|
||||
// Encode image
|
||||
b := bytes.NewBuffer([]byte{})
|
||||
|
Loading…
x
Reference in New Issue
Block a user