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

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

Participant ,
Jun 21, 2023 Jun 21, 2023

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
5.8K
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
Adobe
Community Expert ,
Jun 26, 2023 Jun 26, 2023

Thank you for sharing!

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

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

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

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

I added 2 lines only

By @Calvin21914323wi10

 

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

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

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