Capture a part of my screen

Godot Version

Any

Question 1:

¿How can I take a snapshot of a part of my screen (the red square)? Like this:

godot01

Question 2:

¿How can I save a graphic with another one paste over it as a new one? Like this:

godot02

Question 1
Yes, you can take a screenshoot on a specific Rect but you need to know before hand the section to cut:
This basic line get_viewport().get_texture().get_image() to take normal screenshots can be extended with:

# position is the origin Vector2 point from where it will expand the size Vector2

var screen_region := Rect2i(position, size) 
var screenshot = get_viewport().get_texture().get_image().get_region(screen_region)

but you need to calculate the piece of screen you want to take in advance (the screen region)

Question 2
Yes, it’s possible using the blend_rect and blend_rect_mask methods from Image class to do this, I found a tutorial for this but I can’t find it at the moment

1 Like

Ok then, coding por make more specific questions, thanks