Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

What are Blend Modes in PDF files?

51 sec read

PDF_LogoThe PDF File Format includes some very sophisticated features. One of the most interesting ones is the Blend Mode (introduced in PDF version 1.4).

What is a Blend Mode?

Blend Mode controls how new content is painted and allows the new pixels to be affected by what has already been drawn.

In Normal mode, any new drawing will erase existing items that it draws over. So if I draw a RED box on a page, anything underneath will disappear. But wouldn’t it be useful if the new RED box could ‘interact’ (or blend) with whatever is on the page? This is what Blend Modes allow! Here is an example from the PDF File Specification.

blend modes in PDF

How is it set?

Blend Mode is set using the BM command in the GraphicsState and the default value is Normal.

Other possible values are Compatible (actually the same as Normal), Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, Hardlight, SoftLight, Difference, Exclusion.

How does it work?

When a pixel is drawn on the page, a formula is applied as defined in Section 11.3.5 of the PDF File Specification which produces a final blended result based on the current value and the new value.

How it works can be dependent on the exact colorspace used.

Final Comments

Blend Modes allow to create some very interesting effects in compositing (both in and beyond PDF). If you are doing any form of drawing, they are worth knowing about and experimenting with.



Our software libraries allow you to

Convert PDF files to HTML
Use PDF Forms in a web browser
Convert PDF Documents to an image
Work with PDF Documents in Java
Read and write HEIC and other Image formats in Java
Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

How to insert an image into a PDF

Recently, we released JPedal 2023.07 which contains the ability to insert images into PDF files. All you need is a copy of JPedal, a...
Jacob Collins
18 sec read

One Reply to “What are Blend Modes in PDF files?”

Comments are closed.