'How can one do a pixel by pixel comparison of an image created by cairo and an image loaded from a file

I have some code in nim that creates a picture using Cairo (https://github.com/nim-lang/cairo). I would like to compare that picture to another using diffimg (https://github.com/SolitudeSF/diffimg, https://github.com/SolitudeSF/imageman).

But there does not seem to be a standard in memory image type. Is there any way to do this that does not involve saving the image to a file first?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source