On 05/10/2015 11:45 PM, lloyd_borrett wrote:
G'day,

I have many directories of images, totaling more than 5000 images in total.
Each image might be in a jpg, gif or png file format.
I want to change all images to have a 1:1 aspect ratio, on a white background.
I want no image to exceed 1000 x 1000 pixels at 72 dpi.
Images already within the 1000x1000 limit should be extended to have a 1:1
aspect ratio, as required.
At no point is any image scaled upwards in size.
All images should be saved in a suitably compressed way for displaying on web
sites.
The new images should be written into a sub-directory, with the original images
being left in place and unchanged.
Would like to do this as a single batch process, if needs be per directory.

Here are some examples as to what should happen:

1200x1200: Image re-sized to 1000x1000. Save compressed.

1600x1200: Image re-sized to 1000x750. Then extended to 1000x1000, centred on a
white background. Save compressed.

1200x1600: Image re-sized to 750x1000. Then extended to 1000x1000, centred on a
white background. Save compressed.

750x750: Save compressed.

800x600: Image extended to 800x800, centred on a white background. Save
compressed.

600x800: Image extended to 800x800, centred on a white background. Save
compressed.

Is it possible to achieve the above using Gimp?

If so, how?

If not, can you please recommend a image processing tool that can do this?

Best regards, Lloyd Borrett.


Though we have not done some of the specific tasks or had some of the specific limitations/operations you describe, we have done operations fairly similar to this that require a lot of complex if-then-else logic. To accomplish this, we used Perl and Imagemagick -- this was a few years ago, but I think there is/was a Perl image processing module to aid in such situations.

I don't recall all the details and I can't help with code samples. However, the good news is that the input was in the tens of thousands of images and the output was 4x the input (there were four output streams, not just one as you need, because our output had in four size ranges, not just your one range). While the code took a bit of work to develop, the actual running (and re-running because there were always new or modified inputs that had to be detected/compared as new and thus new output created), was surprisingly fast. Obviously the bigger the machine (I think we were running on a machine 16 cores and 16 GB of RAM), the faster the results.

One or two tiny suggestions. You describe that the output needs to be centered on a white background (if the output is less than 1000 in a particular dimension). The "white background" should be a command line parameter type of setting so that you don't have to dig into the code to change background color that for a particular run. You may also want to consider the potential use of transparent background (if supported by file type of the image type being used for the output) and do the "color of background" on the display side (if possible) rather than in the image -- that would give you greater flexibility; then you might just need a one-line CSS change for your entire website rather than regenerating umpteen images.

Jay
_______________________________________________
gimp-user-list mailing list
List address:    gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list

Reply via email to