Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Resizing image  (Read 533 times)

0 Members and 1 Guest are viewing this topic.

Legendier

  • Newbie
  • *
  • Posts: 2
    • View Profile
Resizing image
« on: March 18, 2023, 10:33:28 pm »
So I have a little program that takes an .png image makes a few modifications and saves it to a file. and it works fine and all but I would like if it could set all the images to a certain size but there doesn't seem to be a function for resizing images. is there an easy way to resize an image, like sf::Sprite::setScale? or do I have to make my own function for it.

Legendier

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Resizing image
« Reply #1 on: March 19, 2023, 04:05:22 am »
I figured it out.

I edited an sf::sprite of the image and using sf::RenderTexture got the image from the sprite.

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Resizing image
« Reply #2 on: March 19, 2023, 04:10:36 am »
I was just going to reply to do the same thing :)

Remember that if you want smooth scaling, you could set the texture to be smooth before drawing it scaled to the render texture.

You can, of course, write scaling functions yourself. Basic ones are quite simple to do ;)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*