Reputation: 43
I have got this code to save image from buffer:
FILE * fout;
fopen_s(&fout, "output.jpg", "wb");
fwrite(pictureFrame->picture().data(), pictureFrame->picture().size(), 1, fout);
In this way I save cover art using taglib. The "pictureFrame->picture().data()" is char* buffer;
I've just tried to display cover art in gtk+ window. But I've recieved error - argument of type char* is incompatible with parameter of type "const guchar*".
I know, I have to convert char* buffer to unsigned char buffer, but I don't know how. Can anybody help me?
pixbuf_loader = gdk_pixbuf_loader_new ();
gdk_pixbuf_loader_write (pixbuf_loader, pictureFrame->picture().data(), pictureFrame->picture().size(), NULL);
Link to gdk_pixbuf_loader documentation
Upvotes: 1
Views: 412
Reputation: 27577
When you're down in the dirt, you just have to get dirty! Something like (yuk!):
fwrite(reinterpret_cast<unsigned char*>(pictureFrame->picture().data()), pictureFrame->picture().size(), 1, fout);
Upvotes: 1