light_source { < 0, 0 ,-30> color rgb 1 } camera {location <0,0,-2.5> look_at <0,0,0>} #include "functions.inc" #macro detectImageSize(imageFile) #local pigmentFunction = function { pigment {image_map {jpeg imageFile once}}} #local xStep = 0.001; #local yStep = 0.001; #local xCoord = xStep/2; #local yCoord = 0.5000001; #local lastPosition = xCoord; #local minDistance = 1; #while (xCoord<1) #local thisPigment = (pigmentFunction(xCoord, yCoord, 0.5)); #if (xCoord=xStep/2) #local lastPigment = thisPigment; #end #if (thisPigment.x!=lastPigment.x | thisPigment.y!=lastPigment.y | thisPigment.z!=lastPigment.z) #local lastPigment = thisPigment; #local thisDistance = xCoord - lastPosition; #if (thisDistance < minDistance) #local minDistance = thisDistance; #local xPixel = (xCoord+lastPosition)/2; #end #local lastPosition = xCoord; #end #local xCoord = xCoord + xStep; #end #local thisPigment = (pigmentFunction(xPixel, yCoord, 0.5)); #local lastPigment = thisPigment; #local xCoord = xPixel; #while (thisPigment.x=lastPigment.x & thisPigment.y=lastPigment.y & thisPigment.z=lastPigment.z) #local thisPigment = (pigmentFunction(xCoord, yCoord, 0.5)); #local xCoord = xCoord - xStep/10000; #end #local xExtent1 = xCoord; #local thisPigment = (pigmentFunction(xPixel, yCoord, 0.5)); #local lastPigment = thisPigment; #local xCoord = xPixel; #while (thisPigment.x=lastPigment.x & thisPigment.y=lastPigment.y & thisPigment.z=lastPigment.z) #local thisPigment = (pigmentFunction(xCoord, yCoord, 0.5)); #local xCoord = xCoord + xStep/10000; #end #local xPixels = div(0.5+1/(xCoord - xExtent1),1); #local xCoord = 0.5000001; #local yCoord = yStep/2; #local lastPosition = yCoord; #local minDistance = 1; #while (yCoord<1) #local thisPigment = (pigmentFunction(xCoord, yCoord, 0.5)); #if (yCoord=yStep/2) #local lastPigment = thisPigment; #end #if (thisPigment.x!=lastPigment.x | thisPigment.y!=lastPigment.y | thisPigment.z!=lastPigment.z) #local lastPigment = thisPigment; #local thisDistance = yCoord - lastPosition; #if (thisDistance < minDistance) #local minDistance = thisDistance; #local yPixel = (yCoord+lastPosition)/2; #end #local lastPosition = yCoord; #end #local yCoord = yCoord + yStep; #end #local yPixels = div(1,minDistance); #local thisPigment = (pigmentFunction(xCoord, yPixel, 0.5)); #local lastPigment = thisPigment; #local yCoord = yPixel; #while (thisPigment.x=lastPigment.x & thisPigment.y=lastPigment.y & thisPigment.z=lastPigment.z) #local thisPigment = (pigmentFunction(xCoord, yCoord, 0.5)); #local yCoord = yCoord - yStep/10000; #end #local yExtent1 = yCoord; #local thisPigment = (pigmentFunction(xCoord, yPixel, 0.5)); #local lastPigment = thisPigment; #local yCoord = yPixel; #while (thisPigment.x=lastPigment.x & thisPigment.y=lastPigment.y & thisPigment.z=lastPigment.z) #local thisPigment = (pigmentFunction(xCoord, yCoord, 0.5)); #local yCoord = yCoord + yStep/10000; #end #local yPixels = div(0.5+1/(yCoord - yExtent1),1); #end #declare imageFile = "Netball Front.jpg"; #declare imageSize = detectImageSize(imageFile); box {0, pigment{image_map {jpeg imageFile once} scale imageSize} scale 0.002} text {ttf "arial.ttf", vstr(2,imageSize," x ",1,0), 2,0 pigment {color rgb <1,0,0>} scale 0.3 translate <-1.5,-1,0>}