diff --git a/src/Classes/ShaderImageEffect.gd b/src/Classes/ShaderImageEffect.gd index 2608d7ae2..04604fb0f 100644 --- a/src/Classes/ShaderImageEffect.gd +++ b/src/Classes/ShaderImageEffect.gd @@ -7,6 +7,16 @@ signal done func generate_image(img: Image, shader: Shader, params: Dictionary, size: Vector2i) -> void: # duplicate shader before modifying code to avoid affecting original resource + var resized_width := false + var resized_height := false + if size.x == 1: + size.x = 2 + img.crop(2, img.get_height()) + resized_width = true + if size.y == 1: + size.y = 2 + img.crop(img.get_width(), 2) + resized_height = true shader = shader.duplicate() shader.code = shader.code.replace("unshaded", "unshaded, blend_premul_alpha") var vp := RenderingServer.viewport_create() @@ -46,4 +56,8 @@ func generate_image(img: Image, shader: Shader, params: Dictionary, size: Vector RenderingServer.free_rid(texture) viewport_texture.convert(Image.FORMAT_RGBA8) img.copy_from(viewport_texture) + if resized_width: + img.crop(img.get_width() - 1, img.get_height()) + if resized_height: + img.crop(img.get_width(), img.get_height() - 1) done.emit()