Download: latest (1.8.0)

pymagery — python imagery


1.7.0 documentation / saturation plugin

The saturation plugin adjusts the saturation (according to HSV) by a specified additive or multiplicative value. HSV has saturation on [0,1] but for the purposes of this plugin it is scaled to [0,100].

The plugin prototype is:

def saturation(width, add=None, mult=None)

One of the parameters should be supplied. The @add parameter should be a value on [-100,100]. The @mult parameter should be a value on [0, infinity).

If 100 were added then the colors would be maxed out. If -100 were added (or 0.0 were multiplied) then all colors would be gone and the image would be completely grayscale. If 0 were added (or 1.0 were multiplied) then the image will be unchanged.

Additive Result Image
-100
-75
-50
-25
0
25
50
75
100

The code to generate the above images could be:

from pymagery import image i = image('ISU_mute_swans.ppm') i.COPY().SATURATION(add=-100).save('ISU_mute_swans-saturation--100.ppm') i.COPY().SATURATION(add=-75).save('ISU_mute_swans-saturation--75.ppm') i.COPY().SATURATION(add=-50).save('ISU_mute_swans-saturation--50.ppm') i.COPY().SATURATION(add=-25).save('ISU_mute_swans-saturation--25.ppm') i.COPY().SATURATION(add=0).save('ISU_mute_swans-saturation-0.ppm') i.COPY().SATURATION(add=25).save('ISU_mute_swans-saturation-25.ppm') i.COPY().SATURATION(add=50).save('ISU_mute_swans-saturation-50.ppm') i.COPY().SATURATION(add=75).save('ISU_mute_swans-saturation-75.ppm') i.COPY().SATURATION(add=100).save('ISU_mute_swans-saturation-100.ppm')

Change Log