ID:1571134
 
(See the best response by Nadrew.)
Problem description:
I've got a four-colour image that I'm trying to go over pixel-by-pixel and convert each pixel, based on colour, into a turf assignment. I already have the turfs defined, with icons - I just need to somehow loop over the pixels(not sure if there's a way to do this in DM.. or if DM could handle it. Might just use PIL for this part), and create the .dmm. Unfortunately, I'm having no luck.. I honestly don't even know where to begin with this.

Extra:
Could one could implement an 8-colour heightmap/topology using overlaying turfs in the same manner?
Best response
mob/verb/GetColors()
var/icon/I = icon('myicon.dmi',"myicon_state")
var
icon_width = I.Width()
icon_height = I.Height()
for(var/pixel_x=1,pixel_x++,pixel_x<=icon_width)
for(var/pixel_y=1,pixel_y++,pixel_y<=icon_height)
var/pixel_color = I.GetPixel(pixel_x,pixel_y)
src << "The pixel at [pixel_x],[pixel_y] is [pixel_color]"


That should get ya on the right path.
Sweet! Thank you!