How to automate adding black pillars to create 16:9 aspect ratio images? - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +--- Thread: How to automate adding black pillars to create 16:9 aspect ratio images? (/Thread-How-to-automate-adding-black-pillars-to-create-16-9-aspect-ratio-images) |
How to automate adding black pillars to create 16:9 aspect ratio images? - Sosnovka Skydiver - 04-22-2020 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 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. RE: How to automate adding black pillars to create 16:9 aspect ratio images? - Ofnuts - 04-22-2020 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,
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: [attachment=4229]
To: [attachment=4230]
RE: How to automate adding black pillars to create 16:9 aspect ratio images? - Sosnovka Skydiver - 04-23-2020 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? RE: How to automate adding black pillars to create 16:9 aspect ratio images? - Ofnuts - 04-23-2020 (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. 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. RE: How to automate adding black pillars to create 16:9 aspect ratio images? - rich2005 - 04-23-2020 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 [attachment=4232] This pads either with pillars or letterboxes depending on the original aspect ratio. RE: How to automate adding black pillars to create 16:9 aspect ratio images? - Sosnovka Skydiver - 04-23-2020 (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. Thank you rich2005, fantastic, this is exactly what I was looking for! Installed it and it works great! |