Jump to content

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.


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.




Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Please note the Annual Company Closure section in the Terms of Use. These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.