Basically, I have 500+ images which I need to modify in exactly the same way. I have images like this .
And I need to copy the left side of the image, more precisely the rectangle which dimensions are 645x999 pixels, paste it, flip it diagonally and move it on the right side. I could do this manually with any image editor but I want to know if I can make a program (preferably in c++), or enter a command that can do this for me. I wish to obtain this , any advice would be of great help.
Thank you.
The following netpbm commands show how to do this for a single file
cat cwxAr.png | pngtopnm | pamcut -width 670 -height 999 | pnmtopng > il.png
cat il.png | pngtopnm | pnmflip -tb | pnmflip -lr | pnmtopng > ir.png
cat il.png | pngtopnm > il.pnm
cat ir.png | pngtopnm > ir.pnm
pnmcat -lr il.pnm ir.pnm | pnmtopng > i.png
note - to obtain the output image that is given in the example the width is 670 pixels, not 645.
This should generate intermediate images il.png
and a final picture i.png
To do this for a series of files the following script would work, where the variable flist is set to the list of files to be processed
#!/bin/bash -f
flist=( cwxAr-0 cwxAr-1 cwxAr-2 )
outpref=( cwxAr-out )
nout=0
for f in ${flist[*]} ; do
fout=`printf "%s-%4.4d.png" ${outpref} ${nout}`
echo "Reading "${f}", writing ",${fout}
cat ${f}.png | pngtopnm | pamcut -width 670 -height 999 | pnmtopng > il.png
cat il.png | pngtopnm | pnmflip -tb | pnmflip -lr | pnmtopng > ir.png
cat ir.png | pngtopnm > ir.pnm
cat il.png | pngtopnm > il.pnm
pnmcat -lr il.pnm ir.pnm | pnmtopng > ${fout}
nout=$(( nout +1 ))
done