문제

I have a file of integer values that range from 0 to 255. A value of zero means black pixel while a value of 255 means a white pixel. Values in between are "gray-like colors". I am searching for a way to invert that file so that 255 gets transformed into 0 and 0 gets transformed in 255 (per example), thus allowing me to successfully obtain the negative of the image.

Is there a way to achieve this? I am sure the answer is a simply mathematical formula using modulo but I can't get to it.

For additional please refer to: NetPBM

도움이 되었습니까?

해결책

If range of values is 0 - 255

Inverse is 255 - value

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top