Provided are an image processing device, an image processing method, an image processing program, and an endoscope system which are capable of accurately obtaining a distance to a surface of a biological tissue stably while avoiding the influence of spectral sensitivity characteristics of the biological tissue, on the basis of image information obtained by exposure with one-time illumination. A workstation 4 according to the present invention processes image data including light reception value data obtained by imaging an inside of a living body with one-time exposure, and includes a distance data obtainment unit 23 that obtains, at a bright region in the image data, distance data to a surface of the living body based on exposure time and the light reception value data on light in a first wavelength range, and obtains, at a dark region in the image data, distance data to the surface of the living body based on exposure time and the light reception value data on light in a second wavelength range which is a longer wavelength range than the first wavelength range.