Output image | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

Output image

I need to output an image using C++. Do you know a library that can do it? I would start from it to learn how to develop a game

15th Jun 2018, 3:36 PM
OrHy3
OrHy3 - avatar
2 Respuestas
+ 3
You can easily get away without using an external imaging library by outputting a very simple format such as PGM or PBM. Refer to the wikipedia page on Netbpm for more details, but you're essentially outputting all the values as either ASCII or binary numbers, then any image viewer or editor that supports PGM (many of which do) can open and display them. Even if you don't have an editor, something like ImageMagick can easily convert it to a PNG or any other more accessible format. I've used this technique in the past to quickly visualize 2D data, as you're intending to. https://www.quora.com/In-C-and-C++-how-can-I-open-an-image-file-like-JPEG-and-read-it-as-a-matrix-of-pixels https://stackoverflow.com/questions/19813443/quick-way-to-output-a-picture-in-c
15th Jun 2018, 3:47 PM
Alexander Sokolov
Alexander Sokolov - avatar
+ 1
Thanks too much
15th Jun 2018, 4:01 PM
OrHy3
OrHy3 - avatar