Hi there, I'm trying to map the function DominantColors to several images in the same folder. I think I got that part sorted out.
(*Set the folder path*)
folderPath =
"/myfolder";
(*Get a list of file names for all the images in the folder*)
fileNames = FileNames["*.png"];
(*Iterate over the list of file names*)
For[i = 1, i <= Length[fileNames],
i++,(*Import the image and find the dominant color*)
img = Import[fileNames[[i]]];
dominantColor = DominantColors[img, 5, "NearestHTMLColor"];
(*Print the file name and the dominant color*)
results = Print[fileNames[[i]] <> ": " <> ToString[dominantColor]]]
Dendrobium macropodum .png: {Black, Khaki, DarkKhaki, LemonChiffon, Sienna}
Dendrobium pachyphyllum .png: {Black, Gainsboro, Thistle, DimGray, DarkKhaki}
Dendrobium sociale .png: {Black, DarkGray, Sienna, DarkMagenta, Plum}
How do I turn the results into csv form, with headings of the file name and each of the dominant colors in separate column?