Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to automate adding black pillars to create 16:9 aspect ratio images?
#1
Question 
I'm a first time poster so please excuse me if this is already answered, I tried to find the answer here and elsewhere but no success yet.

Basically my problem is that I'd like to use my photos as Google Chromecast wallpapers, but many of them (100+) are in aspect ratios (and in many different resolutions) that are not quite 16:9, and in these cases Chromecast just pan & scans the photo. There's no other way to display the whole images than reprocessing them to 16:9, but I don't want to do this manually.

Is there a way to somehow automate this on GIMP?

The process, when done manually, is as follows:
  - Use calculator to multiply height of image by 1.7777.... (result = New Width)
  - Go to Layer > Canvas size, input New Width (width and height fields unbound)
  - Click "Center"
  - Fill with background color selected
  - Click "Resize"
  - Export as JPG with "_Wide" added to filename before the dot

Exporting & saving the resulting image doesn't have to be a part of the automation, but would surely be handy.

I know there's a scripting subsection here too, if a script is the way forward here sorry for posting in the wrong place -- I just don't know really anything about the scripts. I have written some Visual Basic macros though for Excel   Smile

I'd be very grateful if someone could give me pointers! Any kind of method that would take away the manual calculation and canvas resizing would be terrific.

I have currently v. 2.10.10 on Windows 10.
Reply
#2
I would look at the problem from a different point of view. If its for a TV, the final image size is fixed (1920*1080 or 3840*2160). So,
  • Scale it so that its height is 1080 or 2160 (same as TV image prepared in first step), the width being scaled accordingly.
  • Increase its size with a background

This is fairly easy to do in ImageMagick and can be done with a .BAT, the incantation being:

Code:
convert source.jpg -resize x400 -gravity center -background black -extent 800x400 -quality 85 result.jpg

From:

   

To:

   
Reply
#3
Thank you very much! I had actually looked at this program but could not figure out how to use the commands.
I think I understand the command example you included, but how do I actually use it? You said it can be done with a .bat ...?
Is it possible to run a batch, like all images in a given directory?
Reply
#4
(04-23-2020, 02:12 AM)Sosnovka Skydiver Wrote: Thank you very much! I had actually looked at this program but could not figure out how to use the commands.
I think I understand the command example you included, but how do I actually use it? You said it can be done with a .bat ...?
Is it possible to run a batch, like all images in a given directory?

Yes, you can use this  command in a batch. However I no longer use Windows(*) so I cannot be more specific (I wouldn't be able to test). Rich00 will likely drop in for this.

(*) I'm on Linux, but IM runs on Linux, OSX and Windows.
Reply
#5
The best place to ask about ImageMagick is https://www.imagemagick.org/discourse-server/ in the User section, where they are very helpful.

My suggestion for Gimp is a batch plugin BIMP see: https://alessandrofrancesconi.it/projects/bimp/

Easy to convert a whole folder of images, example

   

This pads either with pillars or letterboxes depending on the original aspect ratio.
Reply
#6
(04-23-2020, 10:02 AM)rich2005 Wrote: The best place to ask about ImageMagick is https://www.imagemagick.org/discourse-server/ in the User section, where they are very helpful.

My suggestion for Gimp is a batch plugin BIMP see: https://alessandrofrancesconi.it/projects/bimp/

Easy to convert a whole folder of images, example



This pads either with pillars or letterboxes depending on the original aspect ratio.

Thank you rich2005, fantastic, this is exactly what I was looking for!

Installed it and it works great! Cool
Reply


Forum Jump: