I found SFML to suit my needs.
I really like the method names. They are straight forward, IMHO. Not cryptic or abbreviated.
For the requirements:
works on Windows 10
works with Visual Studio 2022.
The download site mentions Visual Studio 2017 as the latest versions, but when I opened an issue on Github, the answer was that the VS2017 version is compatible with VS2019 and VS2022.
simple to include.
The Tutorial for Visual Studio tells you what you need to do. Basically add some paths so that SFML can be found - stuff you know how to do when doing C++ development in Visual Studio.
get pixel / set pixel
The code I used is as simple as
sf::Image buffer;
buffer.create(size, size, sf::Color(0, 0, 0));
// some loop here
buffer.setPixel(x, y, sf::Color::Green);
buffer.saveToFile("test.png");
support for PNG files (JPG and BMP welcome), reading and writing
Writing is definitely possible, see code before.
gratis
zlib/png licensed
Displaying an image as a window was not so straight forward. It can't draw images on the window. It needs a sprite for that. And the Sprite needs a texture. I see that this may have benefit in game development and might speed up stuff if textures are reused. So the code is a little more complicated, but still ok:
sf::RenderWindow window(sf::VideoMode(1000, 1000), "Visualization");
sf::Image buffer;
buffer.create(size, size, sf::Color(0, 0, 0));
// Some loop here
buffer.setPixel(x, y, sf::Color::Green);
sf::Texture texture;
texture.create(size,size);
texture.update(buffer);
sf::Sprite sprite;
sprite.setTexture(texture);
sprite.setPosition(sf::Vector2f(0.f, 0.f));
sprite.scale(1000.f / size, 1000.f / size);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(sprite);
window.display();
}