Batch convert 360° panoramic shots to 2:1 ratio with padding for 360° / VR tours
Posted: 2018-07-06T06:13:28-07:00
Quickly, easily, and automatically batch convert / batch process (in Windows) an entire folder of Cardboard Camera / 360°degree panoramic (pano) pictures into a 2:1 aspect ratio with black background padding / edges so the perspective looks good in VR and doesn't give upload errors like "Photospheres must have a 2:1 aspect ratio" on Google VR Tour Creator.
More details about the batch file and how it's useful can be found on a page I made here:
https://sites.google.com/view/batchconv ... forvr/home
Posting this here because it's a script I was looking for but could not find, so had to cobble together the right set of ImageMagick commands and some nested FOR loops to make it work, and wanted to give back the results for others like me.
1) Download and install ImageMagick if you haven't already (but you're here, so chances are you have).
2) Copy the following code into a blank text file and save it as something like "2to1.bat" in the same folder with the pictures you'd like to convert
3) Create a folder in that folder called "Converted" for the batch script to put the new images in (so as to not overwrite your originals).
4) Open DOS Command Prompt via WindowsKey+R or search for CMD in the Windows menu.
5) Change directories (CD) until you're in the source images folder.
6) Run 2to1.bat (or whatever you named it).
7) Watch the magic happen!
More details about the batch file and how it's useful can be found on a page I made here:
https://sites.google.com/view/batchconv ... forvr/home
Posting this here because it's a script I was looking for but could not find, so had to cobble together the right set of ImageMagick commands and some nested FOR loops to make it work, and wanted to give back the results for others like me.
1) Download and install ImageMagick if you haven't already (but you're here, so chances are you have).
2) Copy the following code into a blank text file and save it as something like "2to1.bat" in the same folder with the pictures you'd like to convert
Code: Select all
setlocal enabledelayedexpansion
@echo off
for %%i in (*.JPG) do (
for /f %%a in ('identify -format %%w "%%~i"') do (
set /A width=%%~a /2
echo "%%~i" !width!
convert -monitor "%%~i" -gravity center -background black -extent 0x!width! "converted\%%~i"
)
)
4) Open DOS Command Prompt via WindowsKey+R or search for CMD in the Windows menu.
5) Change directories (CD) until you're in the source images folder.
6) Run 2to1.bat (or whatever you named it).
7) Watch the magic happen!