Convert portrait and landscape aspect images at the same time
Posted: 2018-06-12T12:19:29-07:00
I have an image upload form where users submit vertical and horizontal format images.
My problem.
I need the resized images to be these sizes:
(they will usually be these exact sizes actually since they submit files that resize perfectly)
thumb:
80w x 120h
or
120w x 80h
middle:
133w x 200h
200w x 133h
resized:
466w x 700h
or
700w x 466h
I'm using a bootstrap/dropzone.js combo form where they drag and drop the images being uploaded.
My issue is how would I be able to make horizontal aspect images 120, 200 or 700w
and vertical aspect images 80 133 and 466w
and do it all in one command line step (actually, one for each size/folder location etc)
This is my last variation, although everything I've tried including this doesn't achieve the final desired sizes, just horizontal images that are 80 wide instead of 120 w etc.
convert -resize 80x120^ c:\inetpub\wwwroot\kp-new\model_images\[THISFILENAME] -quality 75 c:\inetpub\wwwroot\kp-new\model_images\thumb\[THISFILENAME]
convert -resize 133x200^ c:\inetpub\wwwroot\kp-new\model_images\[THISFILENAME] -quality 75 c:\inetpub\wwwroot\kp-new\model_images\middle\[THISFILENAME]
convert -resize 466x700^ c:\inetpub\wwwroot\kp-new\model_images\[THISFILENAME] -quality 75 c:\inetpub\wwwroot\kp-new\model_images\resize\[THISFILENAME]
Is what I'm trying to do even possible?
Can I read into an image and determine if its a vertical or horizontal?
I am doing this on a windows server.
My problem.
I need the resized images to be these sizes:
(they will usually be these exact sizes actually since they submit files that resize perfectly)
thumb:
80w x 120h
or
120w x 80h
middle:
133w x 200h
200w x 133h
resized:
466w x 700h
or
700w x 466h
I'm using a bootstrap/dropzone.js combo form where they drag and drop the images being uploaded.
My issue is how would I be able to make horizontal aspect images 120, 200 or 700w
and vertical aspect images 80 133 and 466w
and do it all in one command line step (actually, one for each size/folder location etc)
This is my last variation, although everything I've tried including this doesn't achieve the final desired sizes, just horizontal images that are 80 wide instead of 120 w etc.
convert -resize 80x120^ c:\inetpub\wwwroot\kp-new\model_images\[THISFILENAME] -quality 75 c:\inetpub\wwwroot\kp-new\model_images\thumb\[THISFILENAME]
convert -resize 133x200^ c:\inetpub\wwwroot\kp-new\model_images\[THISFILENAME] -quality 75 c:\inetpub\wwwroot\kp-new\model_images\middle\[THISFILENAME]
convert -resize 466x700^ c:\inetpub\wwwroot\kp-new\model_images\[THISFILENAME] -quality 75 c:\inetpub\wwwroot\kp-new\model_images\resize\[THISFILENAME]
Is what I'm trying to do even possible?
Can I read into an image and determine if its a vertical or horizontal?
I am doing this on a windows server.