imaging icon indicating copy to clipboard operation
imaging copied to clipboard

Paste function panics

Open daryl-williams opened this issue 1 year ago • 0 comments

I am learning how to use the imaging package but have run into the following runtime error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x20 pc=0x1026fe7f0]

The following code snippet:

source_image, err := imaging.Open(input_file)
if err != nil {
    log.Fatalf("Error: failed to open image \"%v\", error = %v\n", input_file, err)
}
new_image := imaging.New(1801, 1194, color.NRGBA{0, 0, 0, 0})
new_image = imaging.Paste(new_image, src_image, image.Pt(0, 0))

Unfortunately I have no idea how figure this out, any help would be much appreciated.

Regards,

Daryl

daryl-williams avatar Jun 27 '23 19:06 daryl-williams