diff --git a/internal/graphicscommand/image.go b/internal/graphicscommand/image.go index cc969c7a9..e2ab59a35 100644 --- a/internal/graphicscommand/image.go +++ b/internal/graphicscommand/image.go @@ -15,6 +15,7 @@ package graphicscommand import ( + "fmt" "image" "io" "sort" @@ -204,9 +205,8 @@ func (i *Image) dumpName(path string) string { // // This is for testing usage. func (i *Image) dumpTo(w io.Writer, graphicsDriver graphicsdriver.Graphics, blackbg bool, rect image.Rectangle) error { - // Screen image cannot be dumped. if i.screen { - return nil + return fmt.Errorf("graphicscommand: a screen image cannot be dumped") } pix := make([]byte, 4*i.width*i.height) diff --git a/internal/graphicscommand/image_js.go b/internal/graphicscommand/image_js.go index 15d8a74b5..210e12357 100644 --- a/internal/graphicscommand/image_js.go +++ b/internal/graphicscommand/image_js.go @@ -63,6 +63,11 @@ func DumpImages(images []*Image, graphicsDriver graphicsdriver.Graphics, dir str zw := zip.NewWriter(buf) for _, img := range images { + // Screen image cannot be dumped. + if img.screen { + continue + } + f, err := zw.Create(img.dumpName("*.png")) if err != nil { return err