CodeCarvings Piczard V1.2 Help
Image Processing Job
See Also Send Feedback
Piczard Fundamentals - Core > Image Processing Options > Image Processing Job

Glossary Item Box

Before version 1.1.x of Piczard, the ImageProcessingJob class was necessary in order to apply multiple image filters.
This is still valid (you can use an ImageProcessingJob to apply multiple image filters), however the suggested choice is to simply use the ImageProcessingFilterCollection.

For more information please see: How To Apply More Than One filter.

Even if in most case it's not necessary to directly use the ImageProcessingJob class, this is very fundamental element in Piczard. 

The class is involved every time an image is processed by Piczard.

When it is explicitly instantiated it allows to customize various image processing options such as Output Resolution or Background Color.
The Filters property of the class is a collection that allows to handle multiple ImageProcessingFilters.

 

CONTENTS

  1. Controlling the resolution (DPI) of images generated by Piczard
  2. Controlling the background color of images generated by Piczard

 

 

1. Controlling the resolution (DPI) of images generated by Piczard

The OutputResolution property allows to modify the resolution of the images generated by Piczard.
The value is expressed in DPI, default is 96 (the default Windows resolution)

The following example code allows to generate a fixed size image 50mm x 30.5mm at 300 DPI:

Output image: Fixed size (50mm x 30.5mm) - 300DPI Copy Code
ImageProcessingJob job = new ImageProcessingJob();
job.Filters.Add(
new FixedResizeConstraint(GfxUnit.Mm, 50F, 30.5F));
job.OutputResolution = 300F;
job.SaveProcessedImageToFileSystem(
"Source.jpg", "Output.jpg");

 

 

2. Controlling the background color of images generated by Piczard

Unfortunately not every image format supports transparency
What happens if an image (containing transparent areas) is processed and then saved in a format that does not support transparency (e.g. JPG) ?

The answer is that Piczard automatically applies an ImageBackColor to the processed image.

Figure 1: Background color applied when an image format does not support transparency.

 

In order to control the Image Background Color feature you have to use the ImageProcessingJob class.

Please see also: BackgroundColor class.

The properties that allows to control the Image Background Color are the following:

  1. ImageProcessingJob.ImageBackColor.Value
    This property allows to set the background color to apply.
    Default value: Color.White.


    Figure 2: Two images generated by processing the same source image but using different background colors.

  2. ImageProcessingJob.ImageBackColor.AutoUseTransparentColor Default value: true.


    Figure 3: Two images generated by processing the same source image but using different values of the AutoUseTransparentColor property.

  3. ImageProcessingJob.PreApplyImageBackColor
    • If this property is set to true, then the image background color is applied before every ImageProcessingFilter.
    • If this property is set to false, then the image background color is not applied before every ImageProcessingFilter.
      Please note that this does not mean that the background color is applied after every ImageProcessingFilter.
      For example an ImageProcessingFilter may need to ensure that the background color has been applied.
    Default value: false.

    Figure 4: Four images generated by processing the same source image with an ImageAdjustmentsFilter to adjust the Brightness.

 

See Also

©2013 Sergio Turolla. All Rights Reserved.