Skip to main content
Known Participant
May 23, 2023
Question

detect empty canvas space in fill it with content-aware tool

  • May 23, 2023
  • 2 replies
  • 2320 views

Is there any way in photoshop to automate content-aware fill-in the empty space (caused by canvas resize) of images in batch?

This topic has been closed for replies.

2 replies

Inspiring
May 23, 2023

yes there is.

 

  1. flatten the document before you change the canvas (you now have only the background layer.)
  2. copy the background layer to a new layer
  3. extend the canvas as you want it
  4. select layer contents
  5. inverse the selection
  6. do content-aware fill
  7. deselect
  8. stop recording the action

 

you're done.

 

 

Chuck Uebele
Community Expert
Community Expert
May 23, 2023

You might want to add extending the selection by a couple pixels into the image area just so that there is no change of a line forming between the content aware fill area and the original image. Maybe this isn't an issue.

Inspiring
May 23, 2023

This is a good idea in the case where you want to preserve the layers or the smart object.

If you flatten, you guarantee that there is no content in the extended zones.

 

You could also do this 

 

  1. select all layers
  2. group layers
  3. select entire canvas*
  4. apply mask to group
  5. extend canvas
  6. make a new layer with merge visible
  7. make a selection of the group layer mask 
  8. inverse the selection
  9. expand selection 2px
  10. do content-aware fill
  11. inverse the selection
  12. delete layer content
  13. deselect
  14. stop recording

 

*without selecting the entire canvas, the mask is not actually set and will remain white after expanding. By selecting an area, after extending the canvas, the expanded area will be black.

Stephen Marsh
Community Expert
Community Expert
May 23, 2023

I have some ideas, there isn't a default native method that comes to mind as I type.

 

Have all images had their canvas resized? Or is there a mixture of images?

 

Was the canvas extended with transparent pixels, or opaque pixels such as white?

raeenAuthor
Known Participant
May 23, 2023

All images are resized to one size that is 800px*1000px(smart object). When all are resized to this size, some images expose transparent pixels. I want all those transparent pixels to be automatically content aware filled. Is that possible?

Stephen Marsh
Community Expert
Community Expert
May 23, 2023

The reply from @jefbr should get you there, but if you wish to preserve the smart object layer then a slightly different approach may be required.

 

An action or script could do this.