   Chroma key source code
  Can someone share a simple chroma key code C/C++ ?i have a jpeg image with a green/blue background i want to take out the subject in the center... very simple ...Thanks   
  hlsl code, can't remember if smoothstep is (min,max,value) or (value,min,max)float manhattanDistance(float3 rgb1, float3 rgb2){ float3 dist3 = abs(rgb1-rgb2); return dot(dist3,float3(1,1,1));}float4 chromaKey(float3 pixelRgb, float3 chromakeyColor, float threshold){ float dist = smoothstep(0, threshold, manhattanDistance(chromakeyColor)); float alpha = 1.0 - saturate(dist); return float4(pixelRgb, alpha);};  hi,Thanks, unfortunatly i know nothing about HLSL, can you please send me a working program of that code so i can understand working metodology?what i need is only a very simple chromakey program of a jpeg image with a simple subject in the center. ( background green / blue ).Thanks ;for each pixel  if foreground pixel is close to chroma key    use background pixel  else    use foreground pixelWhich part of the problem are you stuck on at the moment?   ;  which are the lane to get an image input ?which libraries i have to use to manage bmp/jpg ?   ;Quote:Original post by kangaxxwhich are the lane to get an image input ?which libraries i have to use to manage bmp/jpg ?Then your original question is wrong. You asked for Chroma key code, but here you're asking how to read the data in the file.Start from the beginning and try just loading the file from disk and reading the pixels. The DevIL library should be a good starting point for you, it has the functions to read jpegs and get/set the pixel data. Worry about chroma key afterwards.   