I have been searching for hours how to convert XImage (From XLib) to a PNG format. There were some sources, but none of them did work. I want to restrain to libpng or OpenCV if that is possible. How can I achieve this?
Sources:
http://www.codemadness.nl/downloads/xscreenshot.c // Doesn't work, outputs "corrupted" png file
Saving xlib XImage to PNG // I don't want to use Cairo