Вопрос

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