void displayer_png::display(const buffer & b, ostream & out) { Geometry size(b.get_width(), b.get_height()); Color background(0, 0, 0, 0); Image image(size, background); for (unsigned int h=0; h<b.get_height(); h++) { for (unsigned int w=0; w<b.get_width(); w++) { unsigned int c = (unsigned int)(MaxRGB * b(h,w)); Color color(c, c, c); image.pixelColor(w, h, color); } } Blob blob; image.magick("PNG"); image.write(&blob); out.write((const char *)blob.data(), (long unsigned int)blob.length()); }