by cday (Posted Mon Feb 06, 2017 4:13 pm)
Continued...
I've developed an outline NConvert solution which I think could be developed reasonably practically to do what you need, and in case you're not very familiar with using the command line, I've created a stand-alone utility which is attached in a ZIP archive.
The utility consists of a copy of a Windows batch file script Rotate_utility.bat, an Output folder and a copy of NConvert.exe (not the current version). To use the script, place the PNG file (or files) to be rotated in the folder containing the script, and then run the utility (by double-clicking, for example). You should then find in the Output folder a copy of the original PNG and successive rotations (four in the script supplied).
The basic code used to perform each rotation (in the example 2º) is:
As a rotation adds canvas, the background colour to be used normally needs to be specified which adds this term (for white, the red. green and blue values for which are all 255):
To following code is also included to set the compression used in the output PNG (9, the maximum value):
The full code for the first four rotations is therefore:
To test the utility, download the attached ZIP and extract the contents to any convenient location; note that as the script uses relative addressing the contents must remain in the same position relative to each other.
I think the attached script if it runs for you could fairly easily, if slightly tediously, be extended to all the rotations you need using copy and paste and simple editing, be sure to maintain the .bat extension though...
Read Main Topic
Continued...
I've developed an outline NConvert solution which I think could be developed reasonably practically to do what you need, and in case you're not very familiar with using the command line, I've created a stand-alone utility which is attached in a ZIP archive.
The utility consists of a copy of a Windows batch file script Rotate_utility.bat, an Output folder and a copy of NConvert.exe (not the current version). To use the script, place the PNG file (or files) to be rotated in the folder containing the script, and then run the utility (by double-clicking, for example). You should then find in the Output folder a copy of the original PNG and successive rotations (four in the script supplied).
The basic code used to perform each rotation (in the example 2º) is:
- Code: Select all
nconvert -rotate 02 -o Output\%%.png *.png
As a rotation adds canvas, the background colour to be used normally needs to be specified which adds this term (for white, the red. green and blue values for which are all 255):
- Code: Select all
-bgcolor 255 255 255
To following code is also included to set the compression used in the output PNG (9, the maximum value):
- Code: Select all
-out png -clevel 9
The full code for the first four rotations is therefore:
- Code: Select all
nconvert -rotate 00 -bgcolor 255 255 255 -out png -clevel 9 -o Output\%%.png *.png
nconvert -rotate 02 -bgcolor 255 255 255 -out png -clevel 9 -o Output\%%.png *.png
nconvert -rotate 04 -bgcolor 255 255 255 -out png -clevel 9 -o Output\%%.png *.png
nconvert -rotate 06 -bgcolor 255 255 255 -out png -clevel 9 -o Output\%%.png *.png
nconvert -rotate 08 -bgcolor 255 255 255 -out png -clevel 9 -o Output\%%.png *.png
To test the utility, download the attached ZIP and extract the contents to any convenient location; note that as the script uses relative addressing the contents must remain in the same position relative to each other.
merry widow wrote:I have one PNG graphic that I want to generate 44 additional versions of.
The conversion is a CW ROTATION increasing every 2° up until I reach 90°. What I'd really prefer is to save the batch in a text-editable file that I can run, as opposed to using the GUI. Much easier for me to copy/paste eh? (2° 4° 6° 8° 10 °12° 14° etc.)
I think the attached script if it runs for you could fairly easily, if slightly tediously, be extended to all the rotations you need using copy and paste and simple editing, be sure to maintain the .bat extension though...
Read Main Topic