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

Resize image

New Here ,
Mar 18, 2011 Mar 18, 2011

Hi Guys,

Please help me how to resize image in photoshop

square images only

when i have above 3000 pixels image must resize 3000

when i have pixels between 2999 px to 2501 px i want to resize 2500 px

when i have pixels between 2499 px to 2001 px i want to resize 2000 px

when i have pixels between 1999 px to 1501 px i want to resize 1500 px

when i have pixels between 1499 px to 1001 px i want to resize 1000 px

when i have pixels between 999 px to 801 px i want to resize 800 px

don't change image when have 3000,2500,2000,1500,1000,800 pixels

TOPICS
Actions and scripting
1.1K
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 1 Correct answer

Guide , Mar 18, 2011 Mar 18, 2011

I had all but the briefest of looks at this and I don't think you can use switch/case like that…? I think 'case' evaluates a variable not an expression… Some one will tell me if Im wrong as normal… You could other wise just chain if/else if… OK had 10 minutes a possible route could be some thing like this using 'case' where you do some math first so case gets a value passed to it… Do check my math thou… I don't see any issue with calling a resize on images that match your value… nothing will hap

...
Translate
Adobe
Community Expert ,
Mar 18, 2011 Mar 18, 2011

Looks like you have the logic for what you want to do. The only thing you did not covered is when square and size is less then 800 pixels.

If width  == hight  then

   case  width gt 3000 resize to 3000

   case  width  gt 2500 & lt 3000  resize to 2500

   case  width  gt 2000 & lt 2500  resize to 2000

   ...

   case width lt 800 forget about it

else not square forget about it

end else

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
Guide ,
Mar 18, 2011 Mar 18, 2011

I had all but the briefest of looks at this and I don't think you can use switch/case like that…? I think 'case' evaluates a variable not an expression… Some one will tell me if Im wrong as normal… You could other wise just chain if/else if… OK had 10 minutes a possible route could be some thing like this using 'case' where you do some math first so case gets a value passed to it… Do check my math thou… I don't see any issue with calling a resize on images that match your value… nothing will happen will it? Oh yeah I was working in pixels as always…

#target photoshop var doc = app.activeDocument; var docW = doc.width; var docH = doc.height; if (docW == docH && docW > 800) {           switch(Math.floor(docW/500)) {                     case 5 : doc.resizeImage(2500,undefined,undefined,ResampleMethod.BICUBICSMOOTHER); break;           case 4 : doc.resizeImage(2000,undefined,undefined,ResampleMethod.BICUBICSMOOTHER); break;           case 3 : doc.resizeImage(1500,undefined,undefined,ResampleMethod.BICUBICSMOOTHER); break;           case 2 : doc.resizeImage(1000,undefined,undefined,ResampleMethod.BICUBICSMOOTHER); break;           case 1 : doc.resizeImage(800,undefined,undefined,ResampleMethod.BICUBICSMOOTHER); break;           default : doc.resizeImage(3000,undefined,undefined,ResampleMethod.BICUBICSMOOTHER);                }      }

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
New Here ,
Mar 20, 2011 Mar 20, 2011
LATEST

Thanks Muppet Mark,

Thanks for clear this

pls give me another script also

canvas size for 3/4 asper ratio width is 3 ratio height is 4 ratio

after run this  i have to resize height pixels

when i have above 3000 pixels image must resize 3000

when i have pixels between 2999 px to 2501 px i want to resize 2500 px

when i have pixels between 2499 px to 2001 px i want to resize 2000 px
when i have pixels between 1999 px to 1501 px i want to resize 1500 px

when i have pixels between 1499 px to 1101 px i want to resize 1000 px

don't change image when have 3000,2500,2000,1500,1100 pixels

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