ID:155201
 
I wasn't sure what to search for to find an answer for this. I'm setting an icon of an object, during run time, to an icon that is 100x100 but it's stretching the icon to 32x32. How can I get it to keep the size 100x100?
You might want to use the Scale() proc if that works here.
Format: Scale(width, height).
In response to Raimo
I have been using the scale function. I use scale to make an icon 100x100(There is a BYOND bug causing it to go 128x128) then I draw on it and set an icon to it. Here is a code snippet with notes:

//world maxx and maxy are 100
mob/proc/Generate_Mini_Map()
Get_Files()//Ignore this line
var/icon/emtpy_icon = new
emtpy_icon.Scale(world.maxx, world.maxy)
for(var/z = 1 to world.maxz)
var/icon/i = new('blank.dmi')//Has a blank icon_state in the file which is 1x1 in size
i.Scale(world.maxx, world.maxy)
world<<i.Width()//Says 100 but when I save the icon it saves it as 128
for(var/x = 1 to world.maxx)
for(var/y = 1 to world.maxy)
var/turf/t = locate(x, y, z)
i.DrawBox(MiniMapColors["[t.icon]"][t.icon_state], x, y)//Draws a pixel with the most common color of the turf in location t at x,y on the new icon
for(var/obj/o in t)
i.DrawBox(MiniMapColors["[o.icon]"][o.icon_state], x, y)//Draws a pixel with the most common color of the obj in location t at x,y on the new icon
world<<"Minimap([z]): \icon[i]"//For Testing purposes
src.icon = i//For Testing purposes, Sets the player's icon to the new 100x100 icon but the icon has been stretched to 32x32 which is whatI don't want
emtpy_icon.Insert(i, "zlevel[z]")
var/obj/minimap = new
minimap.loc = locate(1,1,1)
minimap.icon = i//For Testing purposes, Sets the objs's icon to the new 100x100 icon but the icon has been stretched to 32x32 which is whatI don't want
client.screen += minimap//Makes the objects added to the screen look like a blown up blurry version of a 32x32 icon rather than a 100x100 icon
minimap.screen_loc = "map2:1,1"
//for(var/y in icon_states(emtpy_icon))
// world<<"Empty Icon: [y]"
//SaveMiniMap(_z)
src << ftp(emtpy_icon,"MiniMapsTest.dmi")//Allows you to save the newly created icon. The saved icon is 128x128 when it should be 100x100


The icon saves just fine except that the picture of the 100x100 map is drawn on an icon that is 128x128. The numbers continue to screw up if I scale the icon to a different size. They seem to only screw up to multiples of 32 or at least in the tests I've run.
It sounds like you have world.map_format set to TILED_ICON_MAP.
When the map is set to that format, the game automatically breaks icons into chunks of world.icon_size. (It also makes a small thumbnail to fit the icon_size as well.)
It's worth giving this a read.
In response to Complex Robot
Thanks, that was the problem. I didn't realize that was screwing everything up.