Does a software exist to batch convert image at different rotation angle? [closed]
I have searched on the web for software that batch convert image at different rotation angle from a source file, but my searches went unsuccessful. Does what I am looking for exists? What would be awesome is an application that we browse for a source image in PNG and a target directory and when a button is pressed the program create every "source-" + angle + ".png"
like source-1.png to source-360.png.
Anyone know such a program?
EDIT
For more clarity, I want to put oriented marker inside google map in a asp.net web app. Since google map api doesn't allow to set the angle we want to show the image, I will set the src of tag with the link to the wanted angle. Something similar can be found there with the planes (direct link to plane at 0 degree, 180 degree, 290 degree).
So I have my basic png file 20px by 20px, but I rather prefer not to create 360 images wich would be a pain because I have 6 type of images for now and counting. So I was looking for a little soft that would help me achieve this.
EDIT: the parent didn't correctly expose the problem. It sounded like 3D stuff at the beginning.
For rotating images, you can use ImageMagick
It is a console program, but it can be used very easily to rotate images. This:
convert image.png -rotate 45 image-45.png
Will create a new image called image-45.png that is the result of rotating image.png 45 degrees.
You can make a bat or sh file to automatize this process (so you have a proper name and the 360 images generated on a loop). However the script is completely different depending on what platform you are on.
Please include what is your platform (Windows, Linux, Mac) so I can be more specific.
Actually, you could create a short routine in Photoshop that would do this. Photoshop allows you easily rotate by an arbitrary angle. You can save this as an action, and then (assuming photoshop hasn't changed too drastically in the last few releases) save that action as an executable that you can run on your images.
Something to consider is that rotating an image, saving it, rotating that modified image, and so on, you will probably encounter increasing picture degradation. Ideally, you should have all of your rotations based off your original image. That might make the photoshop solution a bit more difficult...not sure if there's an easy way to put parameters (angle, in your case) into the saved routines.
Finally, are you sure you need 360 images? I'd suspect that you could get away with maybe 36 images, and just give the user the closest one, and at that image size (you say your input image is 20x20), it would be just fine.
Paste the following code into LINQPad:
using(var sourceImage = Image.FromFile(@"C:\Path\To\Image")) {
for(int angle = 0; angle < 360; angle += 10) {
using(var newImage = new Bitmap(sourceImage.Width, sourceImage.Height))
using(var g = Graphics.FromImage(newImage)) {
g.TranslateTransform(sourceImage.Width / 2, sourceImage.Height / 2);
g.RotateTransform(angle);
g.DrawImage(sourceImage, -sourceImage.Width / 2, -sourceImage.Height / 2);
newImage.Save(@"C:\Whatever\Rotated Images\" + angle + ".png");
}
}
}
精彩评论