#include <SFML/Graphics.hpp>
int main()
{
sf::Font font;
font.loadFromFile("SpaceGrotesk-Medium.ttf");
sf::Text text;
text.setFont(font);
text.setString("Hello world");
text.setCharacterSize(90);
text.setFillColor(sf::Color::Red);
sf::Texture img;
img.loadFromFile("image.jpg");
sf::Sprite sprite(img);
sf::RenderTexture texture;
texture.create(765, 480);
texture.draw(sprite);
texture.draw(text);
texture.getTexture().copyToImage().saveToFile("new_file.jpg");
return 0;
}
Before:After: