Topic was automatically imported from the old Question2Answer platform.
Asked By
Haseb
…because I have 40x40 textures and texture for a mouse cursor must be smaller than 32x32 for some reason. Can I do that, or Is there any workaround? I’m using Godot 3.02. Thank you for your help.
You can indeed downsize a texture with the following steps.
Get the texture’s image with get_data() method.
Now with the image, you will resize it with resize(int width, int height).
Create a new ImageTexture, then call create_from_image('your image').
Ok to get that texture as your new mouse cursor use this line of code.
_
ProjectSettings.set_setting("display/mouse_cursor/custom_image", 'texture you made')
Altogether the code should look like this.
var image = 'Your original texture'.get_data()
image.resize(32, 32)
var texture = ImageTexture.new().create_from_image(image)
ProjectSettings.set_setting("display/mouse_cursor/custom_image", texture)
Oh, I can get Image that way! Thank you, it worked!