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

Is possible to write a script that can AUTO CROP image to best fit aspect ratio ?

Participant ,
Jun 21, 2023 Jun 21, 2023

Copy link to clipboard

Copied

I have images that with differnt dimentions, mix with protrait and lanscape, is there any script can detect the image size then auto crop to best fit aspect raio : 1:1, 2:3, 3:4, 4:5, 5:7, 2:1, 3:1 / 3:2, 4:3, 5:4, 7:5, 1:2, 1:)

 

I tried ask chatGPT to help (LOL), it gave me some messy and cofused code.

 

Then I did a lot searches, no resources can provide some hints to start to code it.

 

Any ideas ? Thanks

TOPICS
Actions and scripting , Windows

Views

2.9K

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 ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

Thank you for sharing!

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
Participant ,
Jun 27, 2023 Jun 27, 2023

Copy link to clipboard

Copied

You are welcome, all credtits to @c.pfaffenbichler , he is a real kind expert !!

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 ,
Jun 27, 2023 Jun 27, 2023

Copy link to clipboard

Copied

quote

You are welcome, all credtits to @c.pfaffenbichler , he is a real kind expert !!


By @Calvin21914323wi10

 

That he is!

 

However, I do also thank you for sharing the final code so that others looking for a similar solution have a possible solution.

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
People's Champ ,
Jun 27, 2023 Jun 27, 2023

Copy link to clipboard

Copied

quote

I added 2 lines only

By @Calvin21914323wi10

 

Your photo is always cropped from the top left corner. Do you think this is correct?

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
Participant ,
Jun 28, 2023 Jun 28, 2023

Copy link to clipboard

Copied

var bounds = [0,0,targetW, targetH]

 

The first 2 parameter you can adjust to fit your need, I haven't digging more detail. You can try and share you results.

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 ,
Jul 14, 2023 Jul 14, 2023

Copy link to clipboard

Copied

LATEST

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