Georgios Karamanis |||

All the blend modes of blend_with()

Cédric and I had a little chat when he was making his #DuBoisChallenge map (tweet) and wanted a hand-painted effect for the fill color. My recommendation was to try with the blend_with() function of the ggfx package and use a texture image as a background” of the fill. He ended up using the ggpatern package which gave a much better effect!

Cédric’s map with ggpattern

Cédric’s map with ggpattern

I really liked the idea of adding a texture to a map and I wanted to test it with ggfx, so I played a little with the map of Greece and a paper texture image:

MqJepqx9.png-medium.png

While testing the different blend types, I thought it would be a good idea to gather all the images as a reference, so here they are!

The blend types were copied from the ggfx documentation as of June 2021. Some plots give, by design, empty plots, I’m not sure if it depends on the specific use case or they always give the same output. The final result depends on the colors of the source and destination layers, so I have two examples, one with a gray map (left) and one with a purple one (right). I haven’t included plots for the modulus__plus and modulus__minus blend types because those option didn’t work at all for me, I got an error message.

The code for making the plots is on GitHub (link)


Duff-Porter alpha blend modes

source”: Completely disregards the destination, leaving only the source

destination”: Completely disregards the source, leaving only the destination

clear”: Disregards both destination and source

xor”: Composes source on top of destination, setting shared areas to transparent

over”: Composes source on top of destination

in”: Shows source, but only where the destination is opaque

out”: Shows source but only where the destination is transparent

atop”: Composes source on top of destination, keeping the transparency of destination

copy”: Like source, but will only affect the area occupied by the source image

[View fullsize

paper-source.png

paper-source.png](_paper-source.png)

[View fullsize

paper-source-purple.png

paper-source-purple.png](_paper-source-purple.png)

[View fullsize

paper-destination-purple.png

paper-destination-purple.png](_paper-destination-purple.png)

[View fullsize

paper-destination.png

paper-destination.png](_paper-destination.png)

[View fullsize

paper-clear-purple.png

paper-clear-purple.png](_paper-clear-purple.png)

[View fullsize

paper-clear.png

paper-clear.png](_paper-clear.png)

[View fullsize

paper-xor-purple.png

paper-xor-purple.png](_paper-xor-purple.png)

[View fullsize

paper-xor.png

paper-xor.png](_paper-xor.png)

[View fullsize

paper-over.png

paper-over.png](_paper-over.png)

[View fullsize

paper-over-purple.png

paper-over-purple.png](_paper-over-purple.png)

[View fullsize

paper-in.png

paper-in.png](_paper-in.png)

[View fullsize

paper-in-purple.png

paper-in-purple.png](_paper-in-purple.png)

[View fullsize

paper-out-purple.png

paper-out-purple.png](_paper-out-purple.png)

[View fullsize

paper-out.png

paper-out.png](_paper-out.png)

[View fullsize

paper-atop.png

paper-atop.png](_paper-atop.png)

[View fullsize

paper-atop-purple.png

paper-atop-purple.png](_paper-atop-purple.png)

[View fullsize

paper-copy.png

paper-copy.png](_paper-copy.png)

[View fullsize

paper-copy-purple.png

paper-copy-purple.png](_paper-copy-purple.png)

#block-yui_3_17_2_1_1624083449775_15616 .sqs-gallery-block-grid .sqs-gallery-design-grid { margin-right: -5px; } #block-yui_3_17_2_1_1624083449775_15616 .sqs-gallery-block-grid .sqs-gallery-design-grid-slide .margin-wrapper { margin-right: 5px; margin-bottom: 5px; }


Mathematical blend modes

multiply”: Multiplies the channel values of source and destination together (after scaling them to 0-1) to obtain new channel values

screen”: As multiply except that the channels are scaled to 1-0 before multiplication, and the result is reversed again before being used

bumpmap”: Like multiple, except source is converted to greyscale first

divide”: Divide the channel values in source by the channel values in destination

plus”: Add the channel values together including the alpha channel

minus”: Subtracts the destination channels from the source channels

modulus_plus”: As plus, but overflow will wrap around instead of being capped

modulus_minus”: As minus but overflow (underflow) will wrap around instead of being capped

difference”: Takes the absolute difference in channel values between source and destination

exclusion”: source + destination - 2sourcedestination. A sort of averaged difference

lighten”: Will pick the lightest pixel at each pixel

darken”: Will pick the darkest pixel at each pixel

lighten_intensity”: Will pick the most intense colour at each pixel

darken_intensity”: Will pick the least intense colour at each pixel

[View fullsize

paper-multiply.png

paper-multiply.png](_paper-multiply.png)

[View fullsize

paper-multiply-purple.png

paper-multiply-purple.png](_paper-multiply-purple.png)

[View fullsize

paper-screen.png

paper-screen.png](_paper-screen.png)

[View fullsize

paper-screen-purple.png

paper-screen-purple.png](_paper-screen-purple.png)

[View fullsize

paper-bumpmap.png

paper-bumpmap.png](_paper-bumpmap.png)

[View fullsize

paper-bumpmap-purple.png

paper-bumpmap-purple.png](_paper-bumpmap-purple.png)

[View fullsize

paper-divide.png

paper-divide.png](_paper-divide.png)

[View fullsize

paper-divide-purple.png

paper-divide-purple.png](_paper-divide-purple.png)

[View fullsize

paper-plus.png

paper-plus.png](_paper-plus.png)

[View fullsize

paper-plus-purple.png

paper-plus-purple.png](_paper-plus-purple.png)

[View fullsize

paper-minus.png

paper-minus.png](_paper-minus.png)

[View fullsize

paper-minus-purple.png

paper-minus-purple.png](_paper-minus-purple.png)

#block-yui_3_17_2_1_1624083449775_104817 .sqs-gallery-block-grid .sqs-gallery-design-grid { margin-right: -5px; } #block-yui_3_17_2_1_1624083449775_104817 .sqs-gallery-block-grid .sqs-gallery-design-grid-slide .margin-wrapper { margin-right: 5px; margin-bottom: 5px; }


Lighting blend modes

overlay”: Simultaneously multiplies and screens at the same time based on the colour values of the destination. Will colorize midtones in the destination with the source

hard_light”: The inverse of overlay (i.e. the source acts as the destination and vice versa)

soft_light”: Like overlay but will extent the range of colorization past the midtones

pegtop_light”: Like soft-light, but without any discontinuity in the blend

linear_light”: Combines dodging and burning so that the destination will be dodged (lightened) when the source is light and burned (darkened) when the source is dark

vivid_light”: A refinement of linear-light that better avoids shading intense colours

pin_light”: Preserves midtones of the destination and only shades lighter and darker parts, resulting in harsh, contrasty lightning.

linear_dodge”: Lighten the destination if the source is light

linear_burn”: Darked the destination if the source is dark

color_dodge”: Like linear-dodge, but preserves blacks in the destination image

color_burn”: Like linear-burn but preserve whites in the destination image

[View fullsize

paper-overlay.png

paper-overlay.png](_paper-overlay.png)

[View fullsize

paper-overlay-purple.png

paper-overlay-purple.png](_paper-overlay-purple.png)

[View fullsize

paper-hard_light.png

paper-hard_light.png](_paper-hard_light.png)

[View fullsize

paper-hard_light-purple.png

paper-hard_light-purple.png](_paper-hard_light-purple.png)

[View fullsize

paper-soft_light.png

paper-soft_light.png](_paper-soft_light.png)

[View fullsize

paper-soft_light-purple.png

paper-soft_light-purple.png](_paper-soft_light-purple.png)

[View fullsize

paper-pegtop_light.png

paper-pegtop_light.png](_paper-pegtop_light.png)

[View fullsize

paper-pegtop_light-purple.png

paper-pegtop_light-purple.png](_paper-pegtop_light-purple.png)

[View fullsize

paper-linear_light.png

paper-linear_light.png](_paper-linear_light.png)

[View fullsize

paper-linear_light-purple.png

paper-linear_light-purple.png](_paper-linear_light-purple.png)

[View fullsize

paper-vivid_light.png

paper-vivid_light.png](_paper-vivid_light.png)

[View fullsize

paper-vivid_light-purple.png

paper-vivid_light-purple.png](_paper-vivid_light-purple.png)

[View fullsize

paper-pin_light.png

paper-pin_light.png](_paper-pin_light.png)

[View fullsize

paper-pin_light-purple.png

paper-pin_light-purple.png](_paper-pin_light-purple.png)

[View fullsize

paper-linear_dodge.png

paper-linear_dodge.png](_paper-linear_dodge.png)

[View fullsize

paper-linear_dodge-purple.png

paper-linear_dodge-purple.png](_paper-linear_dodge-purple.png)

[View fullsize

paper-color_dodge.png

paper-color_dodge.png](_paper-color_dodge.png)

[View fullsize

paper-color_dodge-purple.png

paper-color_dodge-purple.png](_paper-color_dodge-purple.png)

[View fullsize

paper-color_burn.png

paper-color_burn.png](_paper-color_burn.png)

[View fullsize

paper-color_burn-purple.png

paper-color_burn-purple.png](_paper-color_burn-purple.png)

#block-yui_3_17_2_1_1624084336819_6515 .sqs-gallery-block-grid .sqs-gallery-design-grid { margin-right: -5px; } #block-yui_3_17_2_1_1624084336819_6515 .sqs-gallery-block-grid .sqs-gallery-design-grid-slide .margin-wrapper { margin-right: 5px; margin-bottom: 5px; }


Channel copying blends

copy_opacity”: Will set the opacity of destination to the grayscale version of source. To copy the opacity of source into destination use blend_type = in” with flip_order = TRUE.

copy_red”: Copies the red channel in source into the red channel in destination

copy_green”: Copies the green channel in source into the green channel in destination

copy_blue”: Copies the blue channel in source into the blue channel in destination

hue”: Replaces the hue of the destination with the hue of the source

saturate”: Replaces the saturation of the destination with the saturation of the source

luminize”: Replaces the luminance of the destination with the luminance of the source

colorize”: Combines hue and saturate

[View fullsize

paper-copy_opacity-purple.png

paper-copy_opacity-purple.png](_paper-copy_opacity-purple.png)

[View fullsize

paper-copy_opacity.png

paper-copy_opacity.png](_paper-copy_opacity.png)

[View fullsize

paper-copy_red.png

paper-copy_red.png](_paper-copy_red.png)

[View fullsize

paper-copy_red-purple.png

paper-copy_red-purple.png](_paper-copy_red-purple.png)

[View fullsize

paper-copy_green.png

paper-copy_green.png](_paper-copy_green.png)

[View fullsize

paper-copy_green-purple.png

paper-copy_green-purple.png](_paper-copy_green-purple.png)

[View fullsize

paper-copy_blue-purple.png

paper-copy_blue-purple.png](_paper-copy_blue-purple.png)

[View fullsize

paper-copy_blue.png

paper-copy_blue.png](_paper-copy_blue.png)

[View fullsize

paper-hue.png

paper-hue.png](_paper-hue.png)

[View fullsize

paper-hue-purple.png

paper-hue-purple.png](_paper-hue-purple.png)

[View fullsize

paper-saturate.png

paper-saturate.png](_paper-saturate.png)

[View fullsize

paper-saturate-purple.png

paper-saturate-purple.png](_paper-saturate-purple.png)

[View fullsize

paper-luminize.png

paper-luminize.png](_paper-luminize.png)

[View fullsize

paper-luminize-purple.png

paper-luminize-purple.png](_paper-luminize-purple.png)

[View fullsize

paper-colorize.png

paper-colorize.png](_paper-colorize.png)

[View fullsize

paper-colorize-purple.png

paper-colorize-purple.png](_paper-colorize-purple.png)

#block-yui_3_17_2_1_1624083449775_232306 .sqs-gallery-block-grid .sqs-gallery-design-grid { margin-right: -5px; } #block-yui_3_17_2_1_1624083449775_232306 .sqs-gallery-block-grid .sqs-gallery-design-grid-slide .margin-wrapper { margin-right: 5px; margin-bottom: 5px; }


Special blends

unique”: Only keep pixels in the source that differ from the destination.

[View fullsize

paper-unique.png

paper-unique.png](_paper-unique.png)

[View fullsize

paper-unique-purple.png

paper-unique-purple.png](_paper-unique-purple.png)

#block-yui_3_17_2_1_1624083449775_278507 .sqs-gallery-block-grid .sqs-gallery-design-grid { margin-right: -5px; } #block-yui_3_17_2_1_1624083449775_278507 .sqs-gallery-block-grid .sqs-gallery-design-grid-slide .margin-wrapper { margin-right: 5px; margin-bottom: 5px; }

Up next Commercial Fishing plot breakdown TidyTuesday 2021/25
Latest posts TidyTuesday 2024/49 30DayMapChallenge 2024 TidyTuesday 2024/48 TidyTuesday 2024/47 TidyTuesday 2024/46 TidyTuesday 2024/45 TidyTuesday 2024/44 TidyTuesday 2024/43 TidyTuesday 2024/42 TidyTuesday 2024/41 TidyTuesday 2024/40 TidyTuesday 2024/39 TidyTuesday 2024/38 TidyTuesday 2024/37 TidyTuesday 2024/36 TidyTuesday 2024/35 TidyTuesday 2024/34 TidyTuesday 2024/33 TidyTuesday 2024/32 TidyTuesday 2024/31 TidyTuesday 2024/30 TidyTuesday 2024/29 TidyTuesday 2024/28 TidyTuesday 2024/27 TidyTuesday 2024/26 TidyTuesday 2024/25 TidyTuesday 2024/24 TidyTuesday 2024/23 TidyTuesday 2024/22 TidyTuesday 2024/21 TidyTuesday 2024/20