• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Explorer ,
May 23, 2023 May 23, 2023

Copy link to clipboard

Copied

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

TOPICS
Actions and scripting

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
May 23, 2023 May 23, 2023

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 23, 2023 May 23, 2023

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 23, 2023 May 23, 2023

Copy link to clipboard

Copied

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.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 23, 2023 May 23, 2023

Copy link to clipboard

Copied

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.

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 23, 2023 May 23, 2023

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 23, 2023 May 23, 2023

Copy link to clipboard

Copied

Always useful to have a px or two overlap!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 23, 2023 May 23, 2023

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 23, 2023 May 23, 2023

Copy link to clipboard

Copied

can this be automated via action or script on images that have different sizes of transparent canvas pixels?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 23, 2023 May 23, 2023

Copy link to clipboard

Copied

Yes!

 

One way is CTRL/CMD click on the layer panel thumbnail to load the transparency as a selection in the action recording.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 23, 2023 May 23, 2023

Copy link to clipboard

Copied

LATEST

Yes, when you record the steps I described above in an action, you have something the solution*.

 

*something that I think answers your needs and incorporates the feedback of others.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines