Search code examples
imageautomationscalephotoshop

Saving one image to very many resolutions


for a very special case of use i need to resize a large image to very many resolutions, beginning with 1080px height down to 300px height.

So what I need is 1080px, 1079px, 1078px, 1077px, ... in height with proportionally scaling down the image each time (ideally renaming image-1080, image-1079, image-1078, ...).

Of course I could repeat scaling and exporting the image for about 700 times by myself, but thats obviously not what I want to do. However I could not figure out how to automate this task in Adobe Photoshop (or any other program).

Does anybody know a solution how to solve this problem? As the image is scaled down, there should not be a huge quality loss for any of these resolutions.


Solution

  • Using ImageMagick's convert utility:

    for i in {1080..300}; do convert -resize x$i image.png image-$i.png; done
    

    Explanation:

    for is a bash script loop, the loop variable will be $i

    {1080..300} is a range of numbers, 1080, 1079, ... 301, 300

    convert is the IM utility that modifies a file and saves with a new name

    -resize xNNN resizes the image to a new height, changing the width proportionally

    so the loop will run this series of commands:

    convert -resize x1080 image.png image-1080.png
    convert -resize x1079 image.png image-1079.png
    ...
    convert -resize x301 image.png image-301.png
    convert -resize x300 image.png image-300.png