zamadatix Posted August 28, 2022 Posted August 28, 2022 Hey all, I'm trialing Affinity and I seem to have gotten hung up on a simple image resizing action. Reading through the forums I saw to make sure you have "force pixel alignment" enabled which seems to have been the default but I'm still not having any luck. What I'm doing: Opening a large image (86400x43200, tif) Resizing the document to 4320x2160 (unlocked just in case locked forces subpixel resizing) with resampling enabled using lanczos Selecting a 3840x2160 portion of the image (Antialias is unchecked on the selection and feather is set to 0 px) and copying it Note: this is done by creating a selection then manually editing the "Transform" dialog to X: 165, Y: 0, W: 3840, H: 2160 Creating from clipboard from the copied selection Note: the created document is for some reason bigger than the copied selection Exporting as PNG At step 4 I can't seem to get away from a transparently feathered edge around the border of the document and I have no idea why. I've attached both the downscaled source and the image created from the crop in the clipboard. The source image is too large to attach (>2 GB) Quote
GarryP Posted August 29, 2022 Posted August 29, 2022 Welcome to the forums @zamadatix The first thing you can check is to see whether the numbers in the Transform Panel are really integers. Even though you have “Force Pixel Alignment” switched on there can be times when this isn’t true. Go to Preferences / User Interface and set all the Decimal Places values to their maximum values (you can reduce them later if necessary). Close the dialog and have a look at the Transform Panel values when the image layer is selected. Also, can you confirm that you are using Affinity Photo and not one of the other Affinity applications? Quote
- S - Posted August 29, 2022 Posted August 29, 2022 13 hours ago, zamadatix said: 3. Selecting a 3840x2160 portion of the image (Antialias is unchecked on the selection and feather is set to 0 px) and copying it Note: this is done by creating a selection then manually editing the "Transform" dialog to X: 165, Y: 0, W: 3840, H: 2160 This step is where the problem lies. When transforming or resizing a selection in Affinity Photo, it will soften the edges (even though you have antialias and feather turned off). It's not just when creating a new document from clipboard, creating a mask from the selection will have the same problem (see below). It's a PITA. Screenshot A: Screenshot B: Although obviously not ideal, you would need use the Rectangle tool instead of the Marquee tool to create selections in this way and retain the sharp edge. [CMD/CTRL + left click] on the rectangle layer icon in the layers panel will create a selection from the rectangle shape (the fill opacity of the rectangle will need to be put back from 0% to 100% opacity before creating the selection). In your case though, depending on what you're doing, it will likely be better to create a document at the correct final dimensions (3840×2160) and place the original image straight into that document, where you can then move it around and resize it. Alfred and Old Bruce 2 Quote
zamadatix Posted August 29, 2022 Author Posted August 29, 2022 1 hour ago, - S - said: This step is where the problem lies. When transforming or resizing a selection in Affinity Photo, it will soften the edges (even though you have antialias and feather turned off). It's not just when creating a new document from clipboard, creating a mask from the selection will have the same problem (see below). It's a PITA. Screenshot A: Screenshot B: Although obviously not ideal, you would need use the Rectangle tool instead of the Marquee tool to create selections in this way and retain the sharp edge. [CMD/CTRL + left click] on the rectangle layer icon in the layers panel will create a selection from the rectangle shape (the fill opacity of the rectangle will need to be put back from 0% to 100% opacity before creating the selection). In your case though, depending on what you're doing, it will likely be better to create a document at the correct final dimensions (3840×2160) and place the original image straight into that document, where you can then move it around and resize it. Well, that is certainly unique! Thanks this works, albeit awkwardly as you say. Quote
NotMyFault Posted August 29, 2022 Posted August 29, 2022 3 hours ago, - S - said: When transforming or resizing a selection in Affinity Photo, it will soften the edges (even though you have antialias and feather turned off). This is a consequence of the underlaying algorithms used to handle layers: it will always/continuously resample the document layers to the canvas. If you resize a layer, this almost always creates a blurry edge, as the edge pixels (visible canvas) will be resample from multiple document pixels. Only integer multiple / fractions could deliver sharp edges - with additional constraints. To keep sharp edges, better export with new size and import back again, or use document-resize. Then you have at least full control which resample method is used. If you simply resize a layer inside a document, it is always bilinear or nearest neighbor (depending von performance settings). The handling of layers and resampling is one of the most mis-understood features. Old Bruce 1 Quote Mac mini M1 A2348 | MBP M3 Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080 LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K iPad Air Gen 5 (2022) A2589 Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps. I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.
David in Яuislip Posted August 29, 2022 Posted August 29, 2022 The rectangle method works but I find that a pain and prefer using the marquee. It's certainly possible although you'll need a sense of humour So: Create the marquee Resize with the transform panel Add a pixel layer Fill with white Rasterise to mask Copy flattened Ditch the mask New from clipboard The attached macro takes away some of the pain after the resize step CopyResizedSelectionPITA.afmacro Quote Microsoft Windows 11 Home, Intel i7-1360P 2.20 GHz, 32 GB RAM, 1TB SSD, Intel Iris Xe Affinity Photo - 24/05/20, Affinity Publisher - 06/12/20, KTM Superduke - 27/09/10
zamadatix Posted August 30, 2022 Author Posted August 30, 2022 On 8/29/2022 at 11:47 AM, NotMyFault said: This is a consequence of the underlaying algorithms used to handle layers: it will always/continuously resample the document layers to the canvas. If you resize a layer, this almost always creates a blurry edge, as the edge pixels (visible canvas) will be resample from multiple document pixels. Only integer multiple / fractions could deliver sharp edges - with additional constraints. To keep sharp edges, better export with new size and import back again, or use document-resize. Then you have at least full control which resample method is used. If you simply resize a layer inside a document, it is always bilinear or nearest neighbor (depending von performance settings). The handling of layers and resampling is one of the most mis-understood features. I can assure this isn't the case as my steps did mention using document resize. Also for good measure I did make the crop from the png exported attached rescale for good measure and the issue was still present. I think - S - was spot on about the marquee tool being the source of the blurred edge, especially since the cropped paste is ~10 pixels wider than the crop dimensions itself not just a pixel off. Quote
Recommended Posts
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.