Jump to content
aaronprime

Resample algorithm bug

Recommended Posts

All of the resample implementations you're using for resize suffer from a common bug of either not taking half pixel offsets into account or not using a clamp operation at the edges. This results in the document being shifted by a pixel in each direction after the resample.

 

This can be verified on a transparent image with a black border at the left and top edges. After a resample you'll see that your algorithm introduces transparency along those edges and shifts the content.

Share this post


Link to post
Share on other sites

Hi aaronprime,

Welcome to the Affinity Forums. I've just tried this myself using a 100x100pixel document with a 1 pixel (raster) black line running across the top and left. I'm then resizing to 125x125 using the resampler and i'm not seeing transparency being created.

Would you be able to attach a sample file, along with a screenshot showing your resize options.


Thanks!

Share this post


Link to post
Share on other sites

Thanks for checking. It looks like the issue may only be with the UI scaling of the image view and not the image itself. I noticed that at different document zoom levels the shifting corrects itself. I have attached a 512px image. You can see in the second screenshot after resizing to 2048px a line of transparency is introduced to the left of the image. But I can then adjust the document zoom level to make that disappear. Use Alt+Middle Mouse to scale the view and you'll see it flashing and shifting.

 

Given this appears to only be an issue in the UI, it isn't as serious as I first thought, though it makes editing a bit squirrely. I also tested in other popular apps with the same file and did not reproduce the issue so it does seem to be correctable.

Test-512px.afphoto

Affinity_Photo_-_Test-512px.jpg

Affinity_Photo_-_Test-2048px.jpg

Share this post


Link to post
Share on other sites

Hi aaronprime,

We are aware of this issue. It's due to the way we render things on screen. It doesn't affect the file itself (nor affects any exported files). As you discovered it may appear and disappear (or change sides) depending on the zoom level, but it's just a visual glitch.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×