[Question]
  [
Write a program that takes in a string or text file whose first line has the form
```
width height
```
and each subsequent line has the form
```
x y intensity red green blue
```
where:
* `width` and `height` may be any positive integers.
* `x` and `y` may be any integers.
* `intensity` may be any non-negative integer.
* `red`, `green`, and `blue` may be any integers from 0 to 255 inclusive.
Your program must output a [truecolor](https://en.wikipedia.org/wiki/Color_depth#True_color_.2824-bit.29) image in any common lossless image file format whose dimensions are `width` by `height`. Each `x y intensity red green blue` line represents a colorful star or orb that must be drawn on the image. There may be any number of stars to draw, including 0. You may assume the string or file has a trailing newline.
The algorithm for drawing the image is as follows, though you may implement it in any way you like as long as the result is identical:
> 
> For every pixel (*X*,*Y*) in the image (where *X* is 0 at the leftmost
>  edge and *width-1* at the rightmost edge, and *Y* is 0 at the top edge
>  and *height-1* at the bottom edge), the color channel *C* ϵ {*red*,
>  *green*, *blue*} (a value pinned between 0 to 255) is given by the equation:
> 
> 
> ![color channel equation](https://i.stack.imgur.com/Ydexy.png)
> 
> 
> Where the *dist* function is either [Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance):
> 
> 
> ![Euclidean distance equation](https://i.stack.imgur.com/okZw4.png)
> 
> 
> Or [Manhattan distance](https://en.wikipedia.org/wiki/Taxicab_geometry):
> 
> 
> ![Manhattan distance equation](https://i.stack.imgur.com/v29z0.png)
> 
> 
> Choose whichever distance function you prefer, based on golfability or aesthetics.
> 
> 
> Each of the lines in the input besides the first is an element of the *Stars* set. So, for example, Sx represents the `x` value on one of the input lines, and SC represents either `red`, `green`, or `blue`, depending on which color channel is currently being calculated.
> 
> 
> 
# Examples
### Example A
If the input is
```
400 150
-10 30 100 255 128 0
```
the output should be
![Example A, Euclidean](https://i.stack.imgur.com/LMlI4.png)
if you're using Euclidean distance, and
![Example A, Manhattan](https://i.stack.imgur.com/3pXJ2.png)
if you're using Manhattan distance.
### Example B
If the input is
```
200 200
100 100 10 255 255 255
20 20 40 255 0 0
180 20 40 255 255 0
180 180 40 0 255 0
20 180 40 0 0 255
```
the respective outputs for Euclidean and Manhattan distance should be
![Example B, Euclidean](https://i.stack.imgur.com/db0TF.png) and ![Example B, Manhattan](https://i.stack.imgur.com/GyxH1.png).
### Example C
If the input is
```
400 400
123 231 10 206 119 85
358 316 27 170 47 99
95 317 3 202 42 78
251 269 17 142 150 153
43 120 3 145 75 61
109 376 6 230 231 52
331 78 21 31 81 126
150 330 21 8 142 23
69 155 11 142 251 199
218 335 7 183 248 241
204 237 13 112 253 34
342 89 18 140 11 123
```
the output should be
![Example C, Euclidean](https://i.stack.imgur.com/h2YOC.png)
if you're using Euclidean distance, and
![Example C, Manhattan](https://i.stack.imgur.com/O8I74.png)
if you're using Manhattan distance.
### Example D
If the input is
```
400 400
123 231 5 206 119 85
358 316 5 170 47 99
95 317 5 202 42 78
251 269 5 142 150 153
43 120 5 145 75 61
109 376 5 230 231 52
331 78 5 31 81 126
150 330 5 8 142 23
69 155 5 142 251 199
218 335 5 183 248 241
204 237 5 112 253 34
342 89 5 140 11 123
```
the output should be
![Example D, Euclidean](https://i.stack.imgur.com/dlnsI.png)
if you're using Euclidean distance, and
![Example D, Manhattan](https://i.stack.imgur.com/MuJwa.png)
if you're using Manhattan distance.
### Example E
If the input is
```
100 1
```
then the output should be a 100 pixel wide by 1 pixel tall image that is completely black.
# Notes
* Take the input string or the name of a text file that contains it from stdin or the command line, or you may write a function that takes in a string.
* "Outputting" the image means either:
	+ Saving it to a file with the name of your choice.
	+ Printing the raw image file data to stdout.
	+ Displaying the image, such as with [PIL](http://www.pythonware.com/products/pil/#pil117)'s [`image.show()`](http://effbot.org/imagingbook/image.htm#tag-Image.Image.show).
* I won't be checking that your images are pixel perfect (Stack Exchange lossily compresses images anyway) but I will be very suspicious if I can visually tell any difference.
* You may use graphics/image libraries.
# Winning
The shortest submission in bytes wins. In case of ties, the earliest submission wins.
*Fun Bonus:* Give the input for a truly spectacular output image.
  
[Answer]
# JavaScript ~~394~~ 344
```
function X(a){for(l=a.match(/\d+/g),h=document,v=h.body.appendChild(h.createElement("canvas")),v.width=W=l[0],v.height=H=l[1],w=v.getContext("2d"),e=w.createImageData(W,H),d=e.data,N=W*H;N--;)for(i=2,c=N*4,d[c+3]=255;i<l.length;)for(x=N%W-l[i++],y=~~(N/W)-l[i++],k=l[i++],q=0;q<3;)d[c+q++]+=k*l[i++]/-~Math.sqrt(x*x+y*y);w.putImageData(e,0,0);}
```
**Edit:** shortened the code a lot by applying [wolfhammer](https://codegolf.stackexchange.com/users/8055/wolfhammer)'s awesome suggestions.
### Test
*Note: Wait a few seconds for the snippet below to render (takes ~4 seconds on my machine).*
```
function X(a){for(l=a.match(/\d+/g),h=document,v=h.body.appendChild(h.createElement("canvas")),v.width=W=l[0],v.height=H=l[1],w=v.getContext("2d"),e=w.createImageData(W,H),d=e.data,N=W*H;N--;)for(i=2,c=N*4,d[c+3]=255;i<l.length;)for(x=N%W-l[i++],y=~~(N/W)-l[i++],k=l[i++],q=0;q<3;)d[c+q++]+=k*l[i++]/-~Math.sqrt(x*x+y*y);w.putImageData(e,0,0);}
var start = Date.now();
X("400 150\n" +
  "-10 30 100 255 128 0");
X("200 200\n" +
  "100 100 10 255 255 255\n" +
  "20 20 40 255 0 0\n" +
  "180 20 40 255 255 0\n" +
  "180 180 40 0 255 0\n" +
  "20 180 40 0 0 255");
X("400 400\n" +
  "123 231 10 206 119 85\n" +
  "358 316 27 170 47 99\n" +
  "95 317 3 202 42 78\n" +
  "251 269 17 142 150 153\n" +
  "43 120 3 145 75 61\n" +
  "109 376 6 230 231 52\n" +
  "331 78 21 31 81 126\n" +
  "150 330 21 8 142 23\n" +
  "69 155 11 142 251 199\n" +
  "218 335 7 183 248 241\n" +
  "204 237 13 112 253 34\n" +
  "342 89 18 140 11 123");
X("400 400\n" +
  "123 231 5 206 119 85\n" +
  "358 316 5 170 47 99\n" +
  "95 317 5 202 42 78\n" +
  "251 269 5 142 150 153\n" +
  "43 120 5 145 75 61\n" +
  "109 376 5 230 231 52\n" +
  "331 78 5 31 81 126\n" +
  "150 330 5 8 142 23\n" +
  "69 155 5 142 251 199\n" +
  "218 335 5 183 248 241\n" +
  "204 237 5 112 253 34\n" +
  "342 89 5 140 11 123");
var end = Date.now();
console.log('Done in ' + (end - start)/1000 + 's.');
```
```
canvas {
  display: block;
  padding: 10px;
}
```
You can also run it in [JSFiddle](http://jsfiddle.net/4q28d6bx/1/).
### Bonus: Blue Eclipse
```
function X(a){for(l=a.match(/\d+/g),h=document,v=h.body.appendChild(h.createElement("canvas")),v.width=W=l[0],v.height=H=l[1],w=v.getContext("2d"),e=w.createImageData(W,H),d=e.data,N=W*H;N--;)for(i=2,c=N*4,d[c+3]=255;i<l.length;)for(x=N%W-l[i++],y=~~(N/W)-l[i++],k=l[i++],q=0;q<3;)d[c+q++]+=k*l[i++]/-~Math.sqrt(x*x+y*y);w.putImageData(e,0,0);}
var j = 0;
var renderFrame = function () {
  if(window.h && window.v){h.body.removeChild(v);} // clear prev frame
  X("225 150\n" +
    (70 + j) + " " + (120 - j) + " 170 135 56 0\n" + 
    j * 5 + " " + j * 3 + " 64 0 50 205");       
  if(++j < 50) { setTimeout(renderFrame, 1); } else { console.log('done!'); }
};
setTimeout(renderFrame, 10);
```
You can also run it in [JSFiddle](http://jsfiddle.net/zz6j5x6d/).
### Description
This is a straightforward JavaScript + HTML5 canvas implementation: a function that takes a string argument (without trailing spaces/newlines) and displays the output in the DOM. It uses Euclidean distance.
Here is the readable code:
```
X = function (str) {
  var lines = str.split("\n");  
  var canvas = document.createElement('canvas');
  var z = lines[0].split(u=' ');
  var width = z[0], height = z[1];
  
  canvas.width = width;
  canvas.height = height;
  document.body.appendChild(canvas);
 
  var ctx = canvas.getContext("2d");
  var imageData = ctx.createImageData(width, height);
  
  for(var y = 0; y < height; y++){
    for(var x=0; x < width; x++){
      var coord = (y * width + x) * 4;
      
      for(i=1; i < lines.length;i++){
        var t = lines[i].split(u);
        var 
          dx = x - t[0], 
          dy = y - t[1];
        var distance = Math.sqrt(dx * dx + dy * dy);
        for(var channel = 0; channel < 3; channel++) {
          var channelIndex = coord + channel;
          imageData.data[channelIndex] += t[2] * t[3 + channel] / (distance + 1);
        }
      }
      
      var alphaIndex = coord + 3;
      imageData.data[alphaIndex] = 255;
    }
  }
  ctx.putImageData(imageData, 0, 0);
};
```
[Answer]
# Java - 627 bytes
Java is indeed one of the best golfing languages :)
```
import java.awt.image.*;class M{void f(String n)throws Exception{String[]p=n.split("\n");int[]b=s(p[0]);BufferedImage o=new BufferedImage(b[0],b[1],2);for(int i=0;i<b[0];i++)for(int j=0;j<b[1];j++){int[]c=new int[3];for(int l=1;l<p.length;l++){int[]r=s(p[l]);for(int k=0;k<3;k++){c[k]+=r[2]*r[3+k]/(Math.sqrt(Math.pow(i-r[0],2)+Math.pow(j-r[1],2))+1);if(c[k]>255)c[k]=255;}}o.setRGB(i,j,new java.awt.Color(c[0],c[1],c[2]).getRGB());}javax.imageio.ImageIO.write(o,"png",new java.io.File("o.png"));}int[]s(String s){String[]a=s.split(" ");int[]r=new int[a.length];for(int i=0;i<a.length;i++)r[i]=Integer.valueOf(a[i]);return r;}}
```
Using the input below, you can create a somewhat realistic model of our solar system (the size of some planets is wrong, but the distance between them should be accurate).
I tried to give rings to saturn, but it didn't work... [Source](https://en.wikipedia.org/wiki/Solar_System_model)
```
1950 50
-15 25 25 255 255 0
39 25 1 255 0 0
55 25 3 255 140 0
68 25 4 0 191 255
92 25 2 255 0 0
269 25 10 245 222 179
475 25 7 245 245 220
942 25 6 0 250 150
1464 25 6 0 0 255
1920 25 1 255 245 238
```
![Solar system with pluto](https://i.stack.imgur.com/DWAyj.png)
[Full HD picture](https://i.stack.imgur.com/RjdkK.png), which doesn't look thaaat great... Would be happy if someone could improve it!
[Answer]
# Pyth - 46 bytes
This was fun! I finally got to use Pyth's image I/O features. Does euclidean distance because of golfiness, though manhattan is just a short change.
```
Krz7.wcmmsm/*@[[email protected]](/cdn-cgi/l/email-protection),<b2_.DdhKrR7.zU3*FKhK
```
This just loops through all the pixels with the formula's though it condenses the pixel loop into one loop and uses `divmod` since Pyth only supports 3 nested maps and the calculations take two (one for RGB and one for the stars).
Saves image as `o.png`. Pretty slow, does the first 2 tests in <2 min, but the other 2 take on the order of half an hour.
There is a bug in `.w` that no one noticed because no one uses it ;) but I put in a pull request so use my fork to test if isn't merged soon. Merged!
## Examples Outputs
### Example A
![Example A](https://i.stack.imgur.com/unlWG.png)
### Example B
![Example B](https://i.stack.imgur.com/XFFzp.png)
## Example C
![Example C](https://i.stack.imgur.com/hACIu.png)
### Example D
![Example D](https://i.stack.imgur.com/GPOnv.png)
[Answer]
# Bash, ~~147~~ 145 bytes
ImageMagick is used to manipulate images. Euclidean distance is used.
```
read w h
o=o.png
convert -size $w\x$h canvas:black $o
while read x y i r g b
do
convert $o -fx "u+$i*rgb($r,$g,$b)/(hypot(i-$x,j-$y)+1)" $o
done
```
[Answer]
## Python 3, 189 bytes
I'm nobody's idea of an expert golfer, but here goes.
* Input comes from `stdin` and goes to `stdout` in [PPM format](https://en.wikipedia.org/wiki/Netpbm_format#PPM_example).
* Run it like so: `python3 codegolf_stars_golfed.py < starfield.txt > starfield.pnm`
First, Manhattan distance:
```
import sys
(w,h),*S=[list(map(int,l.split()))for l in sys.stdin]
print('P3',w,h,255,*(min(int(sum((I*C[z%3]/(abs(X-z//3%h)+abs(Y-z//3//h)+1))for
X,Y,I,*C in S)),255)for z in range(h*w*3)))
```
And secondly, Euclidean distance:
```
import sys
(w,h),*S=[list(map(int,l.split()))for l in sys.stdin]
print('P3',w,h,255,*(min(int(sum((I*C[z%3]/(abs(X-z//3%h+(Y-z//3//h)*1j)+1))for
X,Y,I,*C in S)),255)for z in range(h*w*3)))
```
I could save four bytes by using integer division instead of `int()`, and in fact that seems to be what the original images do--you can just barely make out some striations in the dark fringes of the star glow that aren't present in strictly correct code. As it stands, though, this code follows the description, not the images.
The ungolfed version, and my original golfing before the many optimisations that others pointed out or that I stumbled upon myself, are in [this gist](https://gist.github.com/perey/c00d2c703d6692feed0d).
**EDIT:** I saved 7 bytes by moving `for x` and `for y` into a single `print` (or `o`) function, but this produces a PNM file with a very long line, which may or may not cause some problems.
**EDIT 2:** Maltysen saved me another 20 bytes. Thanks!
**EDIT again:** Now that there's only one `print`, the `o` alias is a liability, not a saving. 4 more bytes off.
**EDIT some more:** Sp3000 saved me 2 more bytes. Meanwhile, aliasing `map` to `m` wasn't saving anything, so in the interests of readability(!) I've expanded it again. It's now a nice round 28 bytes.
**EDIT the last(?):** Now with Euclidean distance support--and by abusing complex numbers, I did it in exactly the same number of bytes!
**EDIT, the Hollywood reboot:** Sp3000's next suggestion knocked off 5 bytes.
**EDIT, the stupidly named sequel:** 6 bytes trimmed off, thanks to a suggestion Maltysen made that I didn't grasp until Sp3000 repeated it... then *another* 8 bytes from `%` abuse. And talking it out in chat knocked off a phenomenal ~~21~~ 26 bytes. I'm humbled.
[Answer]
# C++, 272 bytes
```
#include<png.hpp>
#define G(a)i>>C;for(x=0;x<w*h;++x){auto&p=img[x%h][x/h];c=p.a+I*C/(abs(x/h-X)+abs(x%h-Y)+1);p.a=c>255?255:c;}
auto&i=std::cin;main(){int w,h,x,X,Y,I,c,C;i>>w>>h;png::image<png::rgb_pixel>img(w,h);while(i>>X>>Y>>I){G(red)G(green)G(blue)}img.write("a");}
```
Needs a lenient C++11 compiler (GCC 4.9.2 is only slightly displeased), and the [png++](http://www.nongnu.org/pngpp/doc/0.2.7/) library, which itself requires `libpng`. Manhattan distance used. Takes input on `stdin`, outputs to a file named "a" in the current directory in PNG format.
Example D:
![enter image description here](https://i.stack.imgur.com/5M5vN.png)
---
![enter image description here](https://i.stack.imgur.com/aptB0.png)
---
![enter image description here](https://i.stack.imgur.com/trQ0j.png)
[Answer]
# Python 2, ~~240~~ ~~232~~ 228 bytes
```
from PIL.Image import*
def f(S):
 L=map(int,S.split());t=a,b=L[:2];I=new("RGB",t)
 for k in range(a*b):I.load()[k/a,k%a]=tuple(sum(x[2]*x[c]/(abs(x[0]-k/a)-~abs(x[1]-k%a))for x in zip(*[iter(L[2:])]*6))for c in(3,4,5))
 I.show()
```
Uses Manhattan distance. This would probably be even shorter in Python 3, but I messed up my Python packages recently and I'm having trouble reinstalling Pillow. PPM would probably be even shorter, but I like PIL.
For fun, I tried to apply the algorithm as is in the [L\*a\*b\* color space](https://en.wikipedia.org/wiki/Lab_color_space) instead, thinking it would give better colour blending (especially in example B). Unfortunately, Calvin's algorithm lets channels go over their max values, which makes the images look a little less awesome than I hoped...
![enter image description here](https://i.stack.imgur.com/ZPLNM.png)
[Answer]
# Mathematica, 146 bytes
```
Image@Table[Total[#3{##4}/255&@@@{##2}/(1+#~ManhattanDistance~{x,y}&/@({#1,#2}&@@@{##2}))],{y,0,Last@#-1},{x,0,#&@@#-1}]&@@#~ImportString~"Table"&
```
A pure function taking a string. To run it in a reasonable amount of time, replace the `1` in `1+#~ManhattanDistance...` with a `1.`; this forces numeric computation instead of symbolic.
Ungolfed:
```
Image[
    Table[
        Total[
        (#3 * {##4} / 255 & @@@ {##2})
            / (1 + ManhattanDistance[#, {x, y}]& /@ ({#1, #2}& @@@ {##2}) )
        ], {y, 0, Last[#]-1}, {x, 0, First[#]-1}
    ] (* Header is #, data is {##2} *)
]& @@ ImportString[#, "Table"]&
```
[Answer]
# Python 2, ~~287~~ 251 bytes
A golfed version of the original code I used to generate the images. Could probably be golfed a bit more (by a better golfer than me). It's a function that takes in the full input string. Image processing done with [PIL](http://www.pythonware.com/products/pil/)'s [Image Module](http://effbot.org/imagingbook/image.htm). Uses Manhattan distance.
```
from PIL import Image
def S(I,r=range):
 I=map(int,I.split());w,h=I[:2];M=Image.new('RGB',(w,h));P=M.load()
 for z in r(w*h):
  P[z%w,z/w]=tuple(int(sum(I[i+2]*I[i+j+3]/(1.+abs(I[i]-z%w)+abs(I[i+1]-z/w))for i in r(2,len(I),6)))for j in r(3))
 M.show()
```
Using Euclidean distance is 5 bytes longer (256 bytes):
```
from PIL import Image
def O(I,r=range):
 I=map(int,I.split());w,h=I[:2];M=Image.new('RGB',(w,h));P=M.load()
 for z in r(w*h):
  P[z%w,z/w]=tuple(int(sum(I[i+2]*I[i+j+3]/(1+((I[i]-z%w)**2+(I[i+1]-z/w)**2)**.5)for i in r(2,len(I),6)))for j in r(3))
 M.show()
```
Here's a complete test suite that runs examples A through E from the question, for both distance metrics:
```
from PIL import Image
def S(I,r=range):
 I=map(int,I.split());w,h=I[:2];M=Image.new('RGB',(w,h));P=M.load()
 for z in r(w*h):
  P[z%w,z/w]=tuple(int(sum(I[i+2]*I[i+j+3]/(1.+abs(I[i]-z%w)+abs(I[i+1]-z/w))for i in r(2,len(I),6)))for j in r(3))
 M.show()
def O(I,r=range):
 I=map(int,I.split());w,h=I[:2];M=Image.new('RGB',(w,h));P=M.load()
 for z in r(w*h):
  P[z%w,z/w]=tuple(int(sum(I[i+2]*I[i+j+3]/(1+((I[i]-z%w)**2+(I[i+1]-z/w)**2)**.5)for i in r(2,len(I),6)))for j in r(3))
 M.show()
A = """400 150
-10 30 100 255 128 0"""
B = """200 200
100 100 10 255 255 255
20 20 40 255 0 0
180 20 40 255 255 0
180 180 40 0 255 0
20 180 40 0 0 255"""
C = """400 400
123 231 10 206 119 85
358 316 27 170 47 99
95 317 3 202 42 78
251 269 17 142 150 153
43 120 3 145 75 61
109 376 6 230 231 52
331 78 21 31 81 126
150 330 21 8 142 23
69 155 11 142 251 199
218 335 7 183 248 241
204 237 13 112 253 34
342 89 18 140 11 123"""
D = """400 400
123 231 5 206 119 85
358 316 5 170 47 99
95 317 5 202 42 78
251 269 5 142 150 153
43 120 5 145 75 61
109 376 5 230 231 52
331 78 5 31 81 126
150 330 5 8 142 23
69 155 5 142 251 199
218 335 5 183 248 241
204 237 5 112 253 34
342 89 5 140 11 123"""
E = """100 1"""
for i in (A, B, C, D, E):
    S(i) #S for Star
    O(i) #O for Orb
```
They all look indistinguishable. The larger ones may take a few seconds to run.
[Answer]
# C, 247 bytes
Not going to win, but I like to golf in C. No external image library used, outputs to stdout in PPM format. Takes input on stdin. Uses Manhattan distance for golfiness.
```
j,w,h,k,*b,t[6];main(){scanf("%d %d",&w,&h);b=calloc(w*h,24);for(;~scanf("%d",t+j++%6);)for(k=0;j%6?0:k<3*w*h;k++)b[k]=fmin(b[k]+t[2]*t[3+k%3]/(abs(k/3%w-*t)+abs(k/3/w-t[1])+1),255);printf("P6\n%d %d\n255\n",w,h);for(k=0;k<3*w*h;putchar(b[k++]));}
```
Here's the Euclidean distance variant (257 bytes):
```
j,w,h,k,*b,t[6];main(){scanf("%d %d",&w,&h);b=calloc(w*h,24);for(;~scanf("%d",t+j++%6);)for(k=0;j%6?0:k<3*w*h;k++)b[k]=fmin(b[k]+t[2]*t[3+k%3]/(sqrt(pow(k/3%w-*t,2)+pow(k/3/w-t[1],2))+1),255);printf("P6\n%d %d\n255\n",w,h);for(k=0;k<3*w*h;putchar(b[k++]));}
```
[Answer]
# CJam, 86 bytes
```
q~]"P3 "\_2>:T;2<_S*" 255 "@:,~\m*{(+0a3*T6/{_2<3$.-:z~+)d\2>(f*\f/.+}/:i255fe<\;S*S}/
```
While this may look kind of lengthy for a golfing language, I believe that of the solutions posted so far, it's the shortest that does not use image output functionality. This produces a PPM file in ASCII form. The image below was converted from PPM to PNG using GIMP.
I do not recommend to run the code in the online CJam interpreter. At least not for the full size images. My browser locked up, most likely because of the memory usage. It completes the 400x400 images in the second range with the offline version.
![Example C](https://i.stack.imgur.com/WDawD.png)
Explanation:
```
q~      Read and parse input.
]       Wrap it in an array.
"P3 "   Output start of PPM header.
\       Swap input to top.
_2>     Slice off first two values, leaving the star descriptors.
:T;     Store star descriptors in variable T.
2<      Get first two values in input, which is the image size.
_S*     Leave a copy of the size in the output for the PPM header.
" 255 " Rest of PPM header, range of color values.
@       Pop sizes to top.
:,      Expand sizes to ranges.
~       Unwrap size ranges into separate stack elements.
\       Swap ranges, since we need x-range second for Cartesian product.
m*      Generate all coordinate pairs with Cartesian product.
{       Loop over pixel coordinate pairs.
  (+      Swap values in coordinate pair to get x-coordinate first again.
  0a3*    Generate [0 0 0] array. Will be used to sum up colors from stars.
  T       Get list of stars.
  6/      Split into sub-lists with 6 values for each star.
  {       Loop over the stars.
    _2<     Get the first two values (position) of the star.
    3$      Pull current pixel coordinates to top of stack.
    .-      Subtract pixel coordinates from star position.
    :z      Absolute value of difference.
    ~+      Unpack differences and add them to get Manhattan distance.
    )d      Add 1 and convert to double to get denominator of formula.
    \       Swap star values to top.
    2>      Slice off first two values, leaving intensity and color.
    (       Pop off intensity.
    f*      Multiply it with color values.
    \       Swap denominator to top.
    f/      Perform division of color components by denominator.
    .+      Add it to sum of colors.
  }/      End loop over stars.
  :i      Convert double values for colors to integer.
  255fe<  Cap color components at 255.
  \;      Swap pixel coordinate to top and pop it.
  S*S     Join color components with space, and add another space.
}/      End loop over coordinate pairs.
```
[Answer]
# C# 718 bytes
I realize that c# is terrible for golfing, but here's my attempt at 718 bytes
```
namespace System{using Collections.Generic;using Drawing;using Linq;using O=Convert;class P{int j,i;List<S> s=new List<S>();Image G(string t){var l=t.Replace("\r","").Split('\n');var w=O.ToInt32(l[0].Split(' ')[0]);var h=O.ToInt32(l[0].Split(' ')[1]);for(i=1;i < l.Length;i++){var p=l[i].Split(' ');s.Add(new S{X=O.ToInt32(p[0]),Y=O.ToInt32(p[1]),I=O.ToSingle(p[2]),R=O.ToByte(p[3]),G=O.ToByte(p[4]),B=O.ToByte(p[5])});}var b=new Bitmap(w,h);for(j=0;j<h;j++)for(i=0;i<w;i++)b.SetPixel(i,j,C());return b;}Color C(){return Color.FromArgb(X(x=>x.R),X(x=>x.G),X(x=>x.B));}int X(Func<S,float>f){return(int)Math.Min(s.Sum(x=>x.I*f(x)/(Math.Sqrt((x.X-i)*(x.X-i)+(x.Y-j)*(x.Y-j))+1)),255);}class S{public float X,Y,R,G,B,I;}}}
```
If anyone has any suggestions to shorten it, feel free to let me know. 
[Answer]
# Python, 259 bytes
Finally done! First code golf I've tried, decided to use Python and went with the Manhattan distance. Shoutout to Maltysen for helping me with the iterators, reduced the total size to almost half!
```
from PIL.Image import new
N,*s=[list(map(int,i.split()))for i in iter(input,'')]
q,m=new("RGB",(N[0],N[1])),[]
[m.append(tuple(sum(k[2]*k[i]//(abs(k[1]-x)+abs(k[0]-y)+1)for k in s)for i in(3,4,5)))for x in range(N[1])for y in range(N[0])]
q.show(q.putdata(m))
```
[Answer]
# CJam, 70 bytes
```
"P3"l_~\:W*255\,[q~]6Te]6/f{\[Wmd\]f{.-Z/~\)\~mh)/f*}:.+{i255e<}/}~]S*
```
Euclidean distance, ASCII PPM output. [Try it online](http://cjam.aditsu.net/#code=%22P3%22l_~%5C%3AW*255%5C%2C%5Bq~%5D6Te%5D6%2Ff%7B%5C%5BWmd%5C%5Df%7B.-Z%2F~%5C)%5C~mh)%2Ff*%7D%3A.%2B%7Bi255e%3C%7D%2F%7D~%5DS*&input=100%20150%0A-10%2030%20100%20255%20128%200)
It should be possible to squeeze a few more bytes, but I don't want to spend too much time.
]