Hey,
I've recently scanned in a bunch of old photos. The method in which I've scanned them has the front of the photo on the top and the back of the photo at the bottom. I've got about 2000 photos that are like this.
The scanner when scanning front and back will only produce the image as a mirror (the 'back' of the photo is upside-down). In addition, all the scans are different heights and lengths - some off by just a few pixels, but others are much different due to different photo size.
I'd like to take all images in the folder, and rotate the bottom half (height/2) by 180 degrees
Win 10x64 -7.0.3-1
Rotate only bottom half of the images (batch)
Rotate only bottom half of the images (batch)
Last edited by dcd722 on 2016-09-26T07:44:18-07:00, edited 3 times in total.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Rotate only bottom half of the images (batch)
Please, everyone, when asking questions always state the version of IM you are using and your platform (bash, Windows or whatever).
This is for v6, on Windows, a console command:
That does one image. To do all the images in a directory, I would use a shell loop. In Windows:
This is for v6, on Windows, a console command:
Code: Select all
convert 5BsxN2a.jpg -crop 1x2@ +repage ( -clone 1 -rotate 180 ) -delete 1 -append outdir\out.png
Code: Select all
for %F in (*.jpg) do convert %F -crop 1x2@ +repage ( -clone 1 -rotate 180 ) -delete 1 -append outdir\%~nF.png
snibgo's IM pages: im.snibgo.com
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: Rotate only bottom half of the images (batch)
Another approach, given enough memory on the machine, would be to read in the whole directory of JPGs, make a stack of clones, rotate those clones on a point centered at half the width and three-quarters of the height, then composite those clones over the originals. With IM6 "convert" or IM7 "magick" at a Windows 10 command prompt this does the job...snibgo wrote:To do all the images in a directory, I would use a shell loop. In Windows:Code: Select all
for %F in (*.jpg) do convert %F -crop 1x2@ +repage ( -clone 1 -rotate 180 ) -delete 1 -append outdir\%~nF.png
Code: Select all
magick *.jpg ^
-set filename:f "%[t]" -background none -virtual-pixel none ^
null: ^
( -clone 0--1 -distort SRT "%[fx:w*0.5],%[fx:h*0.75] 180" ) ^
-layers composite "_fixed_%[filename:f].jpg"