ImageChops ("Channel Operations") Module ######################################## .. note:: All source images in this document are derived from https://www.pexels.com (CC0 License). .. |srcimg01| image:: _static/exams/data/srcimg01.jpg :width: 20% .. |srcimg02| image:: _static/exams/data/srcimg02.jpg :width: 20% .. |srcimg03| image:: _static/exams/data/srcimg03.jpg :width: 20% .. |srcimg04| image:: _static/exams/data/srcimg04.jpg :width: 20% .. |srcimg05| image:: _static/exams/data/srcimg05.jpg :width: 20% .. |srcimg06| image:: _static/exams/data/srcimg06.jpg :width: 20% .. |srcimg07| image:: _static/exams/data/srcimg07.jpg :width: 20% .. |srcimg11| image:: _static/exams/data/srcimg11.png :width: 20% .. |srcimg12| image:: _static/exams/data/srcimg12.jpg :width: 20% .. |srcimg13| image:: _static/exams/data/srcimg13.jpg :width: 20% .. |srcimg14| image:: _static/exams/data/srcimg14.jpg :width: 20% .. |srcimg18| image:: _static/exams/data/srcimg18.jpg :width: 20% .. |srcimg19| image:: _static/exams/data/srcimg19.jpg :width: 20% Functions ********* add === :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.add, http://effbot.org/imagingbook/imagechops.htm#tag-ImageChops.add .. list-table:: * - srcimg18.jpg |srcimg18| - srcimg19.jpg |srcimg19| .. |ImageChops.add.res01| image:: _static/exams/result/ImageChops_add_01_s1.jpg .. |ImageChops.add.res02| image:: _static/exams/result/ImageChops_add_01_s2.jpg .. list-table:: * - .. literalinclude:: _static/exams/ImageChops_add_01.py - scale=1.0 |ImageChops.add.res01| - scale=2.0 |ImageChops.add.res02| add_modulo ========== :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.add_modulo .. list-table:: * - srcimg18.jpg |srcimg18| - srcimg19.jpg |srcimg19| .. |ImageChops.add_modulo.res01| image:: _static/exams/result/ImageChops_add_modulo_01.jpg .. list-table:: :widths: 20 10 * - .. literalinclude:: _static/exams/ImageChops_add_modulo_01.py - |ImageChops.add_modulo.res01| blend ===== :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.blend, http://effbot.org/imagingbook/imagechops.htm#tag-ImageChops.blend This function is an alias for `PIL.Image.Image.blend() `_. .. list-table:: * - srcimg18.jpg |srcimg18| - srcimg19.jpg |srcimg19| .. |ImageChops.blend.res01| image:: _static/exams/result/ImageChops_blend_01_a025.jpg .. |ImageChops.blend.res02| image:: _static/exams/result/ImageChops_blend_01_a050.jpg .. |ImageChops.blend.res03| image:: _static/exams/result/ImageChops_blend_01_a075.jpg .. |ImageChops.blend.res04| image:: _static/exams/result/ImageChops_blend_02.gif .. list-table:: * - .. literalinclude:: _static/exams/ImageChops_blend_01.py - alpha=0.25 |ImageChops.blend.res01| - alpha=0.5 |ImageChops.blend.res02| - alpha=0.75 |ImageChops.blend.res03| .. list-table:: * - .. literalinclude:: _static/exams/ImageChops_blend_02.py - |ImageChops.blend.res04| composite ========= :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.composite, http://effbot.org/imagingbook/imagechops.htm#tag-ImageChops.composite This function is an alias for `PIL.Image.Image.composite() `_. .. list-table:: * - srcimg18.jpg |srcimg18| - srcimg19.jpg |srcimg19| .. |ImageChops.composite.res01| image:: _static/exams/result/ImageChops_composite_01.jpg .. list-table:: :widths: 20 10 * - .. literalinclude:: _static/exams/ImageChops_composite_01.py - |ImageChops.composite.res01| constant ========= :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.constant, http://effbot.org/imagingbook/imagechops.htm#tag-ImageChops.constant :code:`PIL.ImageChops.constant(image, value)` is identical to :code:`PIL.Image.new("L", image.size, value)`. darker ====== :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.darker, http://effbot.org/imagingbook/imagechops.htm#tag-ImageChops.darker .. list-table:: * - srcimg18.jpg |srcimg18| - srcimg19.jpg |srcimg19| .. |ImageChops.darker.res01| image:: _static/exams/result/ImageChops_darker_01.jpg .. list-table:: :widths: 20 10 * - .. literalinclude:: _static/exams/ImageChops_darker_01.py - |ImageChops.darker.res01| difference ========== :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.difference, http://effbot.org/imagingbook/imagechops.htm#tag-ImageChops.difference .. list-table:: * - srcimg18.jpg |srcimg18| - srcimg19.jpg |srcimg19| .. |ImageChops.difference.res01| image:: _static/exams/result/ImageChops_difference_01.jpg .. list-table:: :widths: 20 10 * - .. literalinclude:: _static/exams/ImageChops_difference_01.py - |ImageChops.difference.res01| duplicate ========= :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.duplicate, http://effbot.org/imagingbook/imagechops.htm#tag-ImageChops.duplicate :code:`PIL.ImageChops.duplicate(image)` is identical to :code:`image.copy()`. invert ====== :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.invert, http://effbot.org/imagingbook/imagechops.htm#tag-ImageChops.invert .. list-table:: * - srcimg18.jpg |srcimg18| .. |ImageChops.invert.res01| image:: _static/exams/result/ImageChops_invert_01.jpg .. list-table:: :widths: 20 10 * - .. literalinclude:: _static/exams/ImageChops_invert_01.py - |ImageChops.invert.res01| lighter ======= :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.lighter, http://effbot.org/imagingbook/imagechops.htm#tag-ImageChops.lighter .. list-table:: * - srcimg18.jpg |srcimg18| - srcimg19.jpg |srcimg19| .. |ImageChops.lighter.res01| image:: _static/exams/result/ImageChops_lighter_01.jpg .. list-table:: :widths: 20 10 * - .. literalinclude:: _static/exams/ImageChops_lighter_01.py - |ImageChops.lighter.res01| logical_and =========== :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.logical_and .. list-table:: * - srcimg18.jpg |srcimg18| - srcimg19.jpg |srcimg19| .. |ImageChops.logical_and.res01| image:: _static/exams/result/ImageChops_logical_and_01.jpg .. list-table:: :widths: 20 10 * - .. literalinclude:: _static/exams/ImageChops_logical_and_01.py - |ImageChops.logical_and.res01| logical_or ========== :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.logical_or .. list-table:: * - srcimg18.jpg |srcimg18| - srcimg19.jpg |srcimg19| .. |ImageChops.logical_or.res01| image:: _static/exams/result/ImageChops_logical_or_01.jpg .. list-table:: :widths: 20 10 * - .. literalinclude:: _static/exams/ImageChops_logical_or_01.py - |ImageChops.logical_or.res01| multiply ======== :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.multiply, http://effbot.org/imagingbook/imagechops.htm#tag-ImageChops.multiply .. list-table:: * - srcimg18.jpg |srcimg18| - srcimg19.jpg |srcimg19| .. |ImageChops.multiply.res01| image:: _static/exams/result/ImageChops_multiply_01.jpg .. list-table:: :widths: 20 10 * - .. literalinclude:: _static/exams/ImageChops_multiply_01.py - |ImageChops.multiply.res01| offset ========== :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.offset, http://effbot.org/imagingbook/imagechops.htm#tag-ImageChops.offset .. list-table:: * - srcimg11.png |srcimg11| .. |ImageChops.offset.res01| image:: _static/exams/result/ImageChops_offset_01.jpg .. list-table:: :widths: 20 10 * - .. literalinclude:: _static/exams/ImageChops_offset_01.py - |ImageChops.offset.res01| screen ====== :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.screen, http://effbot.org/imagingbook/imagechops.htm#tag-ImageChops.screen .. list-table:: * - srcimg18.jpg |srcimg18| - srcimg19.jpg |srcimg19| .. |ImageChops.screen.res01| image:: _static/exams/result/ImageChops_screen_01.jpg .. list-table:: :widths: 20 10 * - .. literalinclude:: _static/exams/ImageChops_screen_01.py - |ImageChops.screen.res01| subtract ======== :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.subtract, http://effbot.org/imagingbook/imagechops.htm#tag-ImageChops.subtract .. list-table:: * - srcimg18.jpg |srcimg18| - srcimg19.jpg |srcimg19| .. |ImageChops.subtract.res01| image:: _static/exams/result/ImageChops_subtract_01_s1.jpg .. |ImageChops.subtract.res02| image:: _static/exams/result/ImageChops_subtract_01_s2.jpg .. list-table:: * - .. literalinclude:: _static/exams/ImageChops_subtract_01.py - scale=1.0 |ImageChops.subtract.res01| - scale=0.5 |ImageChops.subtract.res02| subtract_modulo =============== :doc: https://pillow.readthedocs.io/en/latest/reference/ImageChops.html#PIL.ImageChops.subtract_modulo, http://effbot.org/imagingbook/imagechops.htm#tag-ImageChops.subtract_modulo .. list-table:: * - srcimg18.jpg |srcimg18| - srcimg19.jpg |srcimg19| .. |ImageChops.subtract_modulo.res01| image:: _static/exams/result/ImageChops_subtract_modulo_01.jpg .. list-table:: :widths: 20 10 * - .. literalinclude:: _static/exams/ImageChops_subtract_modulo_01.py - |ImageChops.subtract_modulo.res01|