# Import images, use the GradientOrientationFilter and export them?

GROUPS:
 I would like to import images from a folder, pass them through the GradientOrientationFilter and save the output image in another folder.I have tried many ways but was unsuccesful at doing it. I am able to manually drag a single image apply the filter and manually save the output but i am unable to do it for the images in a folder and export them automatically to a different folder. I used the example in the documentation to manually do it GradientOrientationFilter[img,4]// ImageAdjust Can someone please help me on how to write a loop to perform the above operation.Thanks
 Mikayel Egibyan 2 Votes There are many ways you can do that. Here is one: pathToFiles = "/yourPath/.."; SetDirectory[pathToFiles]; newPath = FileNameJoin[{pathToFiles, "newPath"}]; If[!DirectoryQ[newPath], CreateDirectory[newPath]; ]; files = FileNames["*.jpg", pathToFiles]; Export[FileNameJoin[{newPath, FileNameTake[#, -1]}], ImageAdjust[GradientOrientationFilter[Import[#], 4]]] & /@ files