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

Is there a way to increase the canvas size by a specific amount to pics of different dimensions?

Participant ,
Dec 30, 2019 Dec 30, 2019

Hi,

 

I have a load of pics of differing sizes that I want to increase in size by 20px all round. Is there an easy way to automate this (ie with an action) or do I need to use a script? It might be worth pointing out that I have very little knowledge of scripting so am hoping that an action will do the job!

 

Any help would be awesome. Thanks.

TOPICS
Actions and scripting
2.6K
Translate
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

correct answers 3 Correct answers

LEGEND , Dec 30, 2019 Dec 30, 2019
function rC(v) {return eval("aD." + v + ".as('px') + UnitValue('20 px')")}
(aD = activeDocument).resizeCanvas(rC('width'), rC('height'))
Translate
Community Expert , Dec 30, 2019 Dec 30, 2019

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html?m=1

 

Scripts are installed in the /Presets/Scripts folder

Mac OS Example:

/Applications/Adobe Photoshop CC 2018/Presets/Scripts

Win OS Example:

C:\Program Files\Adobe\Adobe Photoshop CC 2018\Presets\Scripts

Alternatively, select File > Scripts > Browse, and navigate to the script file.

Translate
Community Expert , Dec 30, 2019 Dec 30, 2019

You saved the file as RTF and not plain text.

 

You just need to record the action using the relative option;

 

http://www.peachpit.com/articles/article.aspx?p=1660206

Translate
Adobe
LEGEND ,
Dec 30, 2019 Dec 30, 2019
function rC(v) {return eval("aD." + v + ".as('px') + UnitValue('20 px')")}
(aD = activeDocument).resizeCanvas(rC('width'), rC('height'))
Translate
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 ,
Dec 30, 2019 Dec 30, 2019

Thanks kukurykus! You always have such a concise, “non-standard” coding style, similar to r-bin!

Translate
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
LEGEND ,
Dec 30, 2019 Dec 30, 2019

r-bin uses hard but understable codes. Mine are just wrote in specific for me style 😉

Translate
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
Participant ,
Dec 30, 2019 Dec 30, 2019

Thanks Kukurykus.

Where do I add that text?

:o/

Translate
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 ,
Dec 30, 2019 Dec 30, 2019

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html?m=1

 

Scripts are installed in the /Presets/Scripts folder

Mac OS Example:

/Applications/Adobe Photoshop CC 2018/Presets/Scripts

Win OS Example:

C:\Program Files\Adobe\Adobe Photoshop CC 2018\Presets\Scripts

Alternatively, select File > Scripts > Browse, and navigate to the script file.

Translate
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
Participant ,
Dec 30, 2019 Dec 30, 2019

Legend! I'll give it a go, thanks.

Translate
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
Participant ,
Dec 30, 2019 Dec 30, 2019

screenshot.jpg

Struggling to get that to work...

:o(

Translate
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 ,
Dec 30, 2019 Dec 30, 2019

You saved the file as RTF and not plain text.

 

You just need to record the action using the relative option;

 

http://www.peachpit.com/articles/article.aspx?p=1660206

Translate
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
LEGEND ,
Dec 30, 2019 Dec 30, 2019

Stephen_A_Marsh said everything, so I added his answers to correct ones 😉

Translate
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 ,
Dec 30, 2019 Dec 30, 2019

I’m not in front of a computer, however from memory you should be able to use a relative value to expand the canvas in an action without requiring a script. 

 

EDIT: Now that I am in front of Photoshop, here is a visual:

 

relative.png

 

Keep in mind that adding a uniform relative 20px is the total size, so that would be 10px on each edge. 

Translate
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 ,
Dec 30, 2019 Dec 30, 2019

That's right. An action, expanding by pixels in Canvas Size, is straightforward. A script is not necessary.

Translate
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
Participant ,
Dec 30, 2019 Dec 30, 2019

Thanks Kukurykus and Stephen_A_Marsh; the script (once I'd managed to make it!!) worked a treat, and I can't believe how many years I've used PhotoShop but never seen the "Relative" tick box in Canvas Size!! Apparently you can teach an old new tricks! LOL

Translate
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 ,
Dec 30, 2019 Dec 30, 2019
LATEST

Just remember every time you play or run a script or play an action like that editing a document the document canvas size will be increased. Actions that add mats and frames to images often use several such steps. And canvas added to a background layer will had some color.

Capture.jpg

JJMack
Translate
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 ,
Dec 30, 2019 Dec 30, 2019

I believe the simplest option is to create an Action to increase the Canvas size, and then you can Batch this will multiple files.

Translate
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
Participant ,
Dec 30, 2019 Dec 30, 2019

Thanks Joseph. Yet again, the Adobe Community fixes my problems super fast!!

Translate
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
LEGEND ,
Dec 30, 2019 Dec 30, 2019

Script can be automated by Batch too. Simply record it as an regular item.

Translate
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