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.

Understanding the PDF file Format – decodeArray

42 sec read

When you create an image in a PDF file it is possible to specify that it is inverted. You do this by using the decodeArray. This consists of 2 values for each colour element – a minimum and a maximum. So for a gray colorspace you might see

decodeArray [0.0 1.0]

while CMYK would have

decodeArray [0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0]

It can also be defined as an 8 bit value ( decodeArray [0 254])

This allows control over the allowable values and out of range values will be set to the minimum or maximum. If you reverse these the image can be inverted (ie decodeArray [1.0 0.0]) which is a neat little trick. You can also do some simple image processing with it.

Where it can get slightly tricky is that you can also apply a decoder Array to a Mask on an image – I’ll leave you to figure this one out…

This post is part of our “Understanding the PDF File Format” series. In each article, we aim to take a specific PDF feature and explain it in simple terms. If you wish to learn more about PDF, we have 13 years worth of PDF knowledge and tips, so click here to visit our series index!

 

Did you know...

IDRsolutions offers a whole range of online file converters to convert PDF and Microsoft Excel, Word and Office Documents to HTML5, SVG or image formats?

It is free to use for single file conversions and also includes Developer links if you want to use our commercial software for bulk conversions. Find out more on this page

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 read HEIC image files in Java with…

In this article, I will explain how to read HEIC files into Java as a BufferedImage. ImageIO does not read HEIC file types so...
Mark Stephens
1 min read

How to convert WMF files to SVG in java…

This article will show you how to convert WMF files into SVG files using our JDeli Java Image library. What is WMF? WMF is...
Amy Pearson
1 min read

How to write WebP images in Java

In this article, I will walk you through how to write out images as WebP images in Java. ImageIO does not support WebP images...
Mark Stephens
1 min read

Leave a Reply

Your email address will not be published. Required fields are marked *

IDRsolutions Ltd 2020. All rights reserved.