Jump to content
You must now use your email address to sign in [click for more info] ×

Borders with macro / Cropping to content


Recommended Posts

We are often working with many various photos in a specific way.

Often performed operation, after the whole process of photo editing is adding border.

Let's say, that border have to be 40px at each direction for 800px image.

I have created a macro with using FX Outline option - maybe there are better ways to do it?

  1. Change Document properties - uncheck the Transparent background in the Document menu.
  2. Enable the Outline FX effect.
  3. Set radius to some pixel value... and this it's strange, because it must be 39px to get proper width of 880px for bordered image from 800px image. 40px is resulting in 882px image. Why is that?
  4. Set FX Outline colour to white.
  5. Clip Canvas.

Is there an option to change a default colour of the document background, or it must be white? White is good for us for now, but it's good to know ;)

Next question is a little different, but also is close to our specific workflow with these photos.
Is there a way to clip a photo as described below?

  1. We have a product photo with the white(or other), solid background.
  2. We choose some option to crop the image to content with ignoring pixels of the the background.
  3. Result is: Cropped solid background to the pixels of the product - It detects solid colour around the different pixels of the product accumulated at the middle of the document.

For example, we have such option in Gimp: Image > Crop to Content.
 

Windows 7 | Intel Xeon E5450 | GeForce GT 730 | 8 GB RAM

Link to comment
Share on other sites

59 minutes ago, Adalbertus said:

Is there an option to change a default colour of the document background, or it must be white? White is good for us for now, but it's good to know ;)

 

Add a Fill Layer: Layer > New Fill layer and change it to whatever colour you like Aldabertus :D

iMac 27" 2019 Somona 14.3.1, iMac 27" Affinity Designer, Photo & Publisher V1 & V2, Adobe, Inkscape, Vectorstyler, Blender, C4D, Sketchup + more... XP-Pen Artist-22E, - iPad Pro 12.9  
B| (Please refrain from licking the screen while using this forum)

Affinity Help - Affinity Desktop Tutorials - Feedback - FAQ - most asked questions

Link to comment
Share on other sites

  • Staff
1 hour ago, Adalbertus said:


Is there a way to clip a photo as described below?

  1. We have a product photo with the white(or other), solid background.
  2. We choose some option to crop the image to content with ignoring pixels of the the background.
  3. Result is: Cropped solid background to the pixels of the product - It detects solid colour around the different pixels of the product accumulated at the middle of the document.

For example, we have such option in Gimp: Image > Crop to Content.
 

Hi Adalbertus,

Unfortunately there is no way to crop like this in Affinity I'm afraid.

Thanks

C

Please tag me using @ in your reply so I can be sure to respond ASAP.

Link to comment
Share on other sites

You could kind of do it in reverse and unclip to content.

Basically this creates a rectangle, moves it to the back, increases the dimensions of it by 80px horizontally and width wise from the centre and unclips it to show the border, this can then be coloured or a pattern added for a funktastic effect lol! In the macro you can adjust the width to suit.

Variable Border.afmacro

Screen-Shot-2019-03-25-at-11-49-52.png

iMac 27" 2019 Somona 14.3.1, iMac 27" Affinity Designer, Photo & Publisher V1 & V2, Adobe, Inkscape, Vectorstyler, Blender, C4D, Sketchup + more... XP-Pen Artist-22E, - iPad Pro 12.9  
B| (Please refrain from licking the screen while using this forum)

Affinity Help - Affinity Desktop Tutorials - Feedback - FAQ - most asked questions

Link to comment
Share on other sites

I'm not sure what you are after, but I just tried this:

  1. I created a blank canvas with a white fill layer.
  2. Added some content to this canvas with limits away from the edges.
  3. Flatten the document. 
  4. Flood-fill the outer white area and delete it.
  5. Clip to Canvas.

This removes the edges leaving the added content. 

John

Windows 10, Affinity Photo 1.10.5 Designer 1.10.5 and Publisher 1.10.5 (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Link to comment
Share on other sites

2 hours ago, firstdefence said:

Add a Fill Layer: Layer > New Fill layer and change it to whatever colour you like Aldabertus :D

Ok, word of explanation ;)
Yes, I know that I can use that, and Pixel layer as well.
It just had to be a quick test macro - mostly to check all ways to do that task ;)
Disabling the transparent background instead of playing with layers, had just one goal - to be a fast option in the search the way for the proper canvas resizing.
My main question was:

Quote

I have created a macro with using FX Outline option - maybe there are better ways to do it?

 The Outline was for me the simplest way to configure it in Macro tool.

And by the way.... I was just curious, did the white background colour, which is showed after disabling the Transparent background function, is hidden somewhere or did it depends on some other tool.

1 hour ago, John Rostron said:

I'm not sure what you are after, but I just tried this:

  1. I created a blank canvas with a white fill layer.
  2. Added some content to this canvas with limits away from the edges.
  3. Flatten the document. 
  4. Flood-fill the outer white area and delete it.
  5. Clip to Canvas.

This removes the edges leaving the added content. 

John

Yes, John, Your approach is good, when You have time to do such operations.
Our main goal is to do it fast as possible.
We don't know what canvas will be needed - it would require calculations based on the image size and more precision to achieve desired effect.

Simply, our goal is:
Load some photo (there may be regular graphics/photos with solid background, or there may be some png files with transparency.)
Edit it if needed.
Crop to content.
Add border along with the fill - both have to be in same colour.
Export.
Next image...

I have created other macro, more complex (but still basic) and allowing to further work with the project.
Still using the Outline FX.

If we have prepared, cropped to content image, we can play the macro:

  1. Enable the Outline FX effect - to be able to resize canvas according to pixel value of this tool by using clip canvas option.
  2. Set radius to some pixel value... and this still it's strange, because it must be 39px to get proper width of 880px for bordered image from 800px image. 40px is resulting in 882px image. Why is that?
  3. Set FX Outline colour to any colour.
  4. Add pixel layer.
  5. Clip Canvas.
  6. Fill the pixel layer with any colour.
  7. Move the pixel layer below the product image.
  8. Select first layer with the photo of the product.
  9. Disable the FX Outline.

Border_40px.afmacro

Windows 7 | Intel Xeon E5450 | GeForce GT 730 | 8 GB RAM

Link to comment
Share on other sites

1 hour ago, Callum said:

Hi Adalbertus,

Unfortunately there is no way to crop like this in Affinity I'm afraid.

Thanks

C

We have made a test with macro to achieve that.
We have used:

  1. Wand Tool with the Tolerance at 1%
  2. Delete selected background
  3. Deselect
  4. Clip canvas

Result is just the product image without background cropped to content.

cut.afmacro

Windows 7 | Intel Xeon E5450 | GeForce GT 730 | 8 GB RAM

Link to comment
Share on other sites

2 hours ago, firstdefence said:

You could kind of do it in reverse and unclip to content.

Basically this creates a rectangle, moves it to the back, increases the dimensions of it by 80px horizontally and width wise from the centre and unclips it to show the border, this can then be coloured or a pattern added for a funktastic effect lol! In the macro you can adjust the width to suit.

Variable Border.afmacro

Screen-Shot-2019-03-25-at-11-49-52.png

Thanks for your effort, but it seems, that You have created this macro on a Mac version, right?
Our test result of Your macro You can see on the attached screenshot - something went wrong, and OS incompatibility may be the reason.
But in spare time we'll try to repair this.

test.thumb.jpg.b2395c1bf73337930ae1e7db9c658aea.jpg

Windows 7 | Intel Xeon E5450 | GeForce GT 730 | 8 GB RAM

Link to comment
Share on other sites

Here is a download link of a set of macros for inside or outside borders with variable width and colour choice to use with a flattened image/ document

https://forum.affinity.serif.com/applications/core/interface/file/attachment.php?id=76754

Just test it out ...

See attachment for the actions I took to add the outside border.
 

Outside border.jpg

Affinity Photo  2.3.1

Laptop MSI Prestige PS42
Windows 11 Home 23H2 (Build 22631.3007) - Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz   2.00 GHz - RAM 16,0 GB

 

 
Link to comment
Share on other sites

24 minutes ago, HVDB Photography said:

Here is a download link of a set of macros for inside or outside borders with variable width and colour choice to use with a flattened image/ document

https://forum.affinity.serif.com/applications/core/interface/file/attachment.php?id=76754

Just test it out ...

See attachment for the actions I took to add the outside border.
 

Outside border.jpg

Works well. Thanks for a macro and for the clear description! It seems that Affinity macros are really neat! Just need to spend more time with them ;)

Windows 7 | Intel Xeon E5450 | GeForce GT 730 | 8 GB RAM

Link to comment
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.

Guest
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.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | 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.