PNG Image Black Box in PDF

Issue #7 resolved
Rob Thornton
created an issue

I am using the Plotinum library to create a PNG image in an image.Image object. The code below exports to PNG just fine (line commented out) but when embedding the image into a PDF it comes up as a black box. I have contacted the author of Plotinum but it does not appear to be an issue with his library. This has only been tested in Adobe Reader.

    w, h := vg.Inches(6.0).Inches() * dpi, vg.Inches(6.0).Inches() * dpi
img := image.NewRGBA(image.Rect(0,0,int(w+0.5), int(h+0.5)))
    // code writes image data to the above image.Image
c := vgimg.PngCanvas{Canvas: vgimg.NewImage(img)}
d := pdf.New()
canv := d.NewPage(pdf.USLetterWidth, pdf.USLetterHeight)
r := pdf.Rectangle{
    pdf.Point{pdf.Inch, pdf.Inch},
    pdf.Point{pdf.Inch*6.0, pdf.Inch*6.0}}
canv.DrawImage(img, r)
//png.Encode(f.Writer, img) // this works

The only difference between teh working version and the non-working version appears to be Canvas.DrawImage() vs. png.Encode(). As stated, the commented line png.Encode() from the standard library produces the expected output. Admittedly, I'm new to gopdf and PDF document generation from a programming point of view so this may easily be due to my own ineptitude.