The background of PNG should be white but not black

Image imageobject(element.GetXObject());

The background of 'test.png' is black, however the background is white
opened from PDFViewer or Adobe Reader.

Why? How should I do to produce this output image which has the same
background with PDFViewer.

It is hard to say for sure without looking at a file, but this is
usually an indicator that the PDF image is associated with a mask (or
a soft mask). You can use image.GetMask() or image.GetSoftMask() to
check for these. You can also export resulting transparency object
using Image.Export() methods.