Image (.png) resizing in Godot

Godot Version



I have a 64x64 sprite png. Is it possible to scale it down to 16x16 png in Godot? I read that this is possible in the sprite properties, but I can’t find that anywhere.

Note: I do not want to change the Tileset or Tilemap scale/tilesize as this would effect other sprites. I want to resize one sprite.

I figured it out. Just wanted to how I got it to work.

You have to individually create an Area2D node in your Tilemap, then add a child node of Sprite 2D. From there, in the Inspector on the right side you can click on empty → Load → then select a png from from your resource/file system. After that you can resize the image by using Transform → Scale, again this is in the Inspector dock.

You can’t actually set a specific size for a Sprite, you can only control its scale. But here is some code that will let you scale it.

You can use this by setting the Sprites scale factor by this functions return value either in the sprites own script or from another.

Sprite.size = scale_sprite_to_size(Sprite, Vector2(16, 16))

func scale_sprite_to_size(sprite: Sprite2D, new_size: Vector2) -> Vector2:
	if sprite.texture != null:
		return new_size / sprite.texture.get_size()
	return Vector2(1, 1)