Skip to content

Conversation

@yunline
Copy link
Contributor

@yunline yunline commented Jun 13, 2023

Fixes #2239
image

import pygame
import sys

pygame.font.init()

pygame.display.init()
dsf=pygame.display.set_mode((1280,720))
sf=pygame.image.load("lena.png")

radius = 10

from PIL import Image,ImageFilter
img = Image.frombytes(
    "RGBA", sf.get_size(), pygame.image.tobytes(sf, "RGBA", False)
)
img = img.filter(ImageFilter.GaussianBlur(radius=radius))
sf_blur1 = pygame.image.frombuffer(
    img.tobytes(), img.size, "RGBA"
)

sf_blur2 = pygame.transform.gaussian_blur(sf,radius)

dsf.fill((0,150,0))
dsf.blit(sf_blur2,(0,0,1,1))
dsf.blit(sf_blur1,(640,0,1,1))
pygame.display.update()

while 1:
    for event in pygame.event.get():
        if event.type==pygame.QUIT:
            sys.exit()

@yunline yunline added transform pygame.transform bugfix PR that fixes bug labels Jun 13, 2023
@yunline yunline requested a review from a team as a code owner June 13, 2023 03:39
@Starbuck5
Copy link
Member

This changes the behavior of an existing function. I guess it's okay in this case because it's a very new function? Just introduced in 2.2.0? That was still 2.5 months ago...

Nevertheless, this should definitely get a notice in the docs, documenting the change between versions.

Copy link
Member

@Starbuck5 Starbuck5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, looks good.

Copy link
Member

@ankith26 ankith26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! 🥳

@MyreMylar MyreMylar added this to the 2.3.1 milestone Jun 25, 2023
Copy link
Member

@MyreMylar MyreMylar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this fix works for me and gaussian blur now seems to be consistent with other implementations.

@MyreMylar MyreMylar merged commit b6fe238 into pygame-community:main Jun 25, 2023
@yunline yunline deleted the blur-radius-fix branch June 28, 2023 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR that fixes bug transform pygame.transform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gaussian Blur inconsistency with PIL

4 participants