Summary
- Assembly
- Wyam
.Images .dll - Namespace
- Wyam
.Images - Interfaces
- Base Types
-
- Object
Syntax
public class Image : IModule
Remarks
This module manipulates images by applying operations such as resizing, darken/lighten, etc. This image module
does not modify your original images in any way. It will create a copy of your images and produce images in the
same image format as the original. It relies on other modules such as ReadFiles
to read the actual images as
input and WriteFiles
to write images to disk.
Pipelines.Add("Images",
ReadFiles("*")
.Where(x => new[] { ".jpg", ".jpeg", ".gif", ".png"}.Contains(x.Path.Extension)),
Image()
.SetJpegQuality(100).Resize(400,209).SetSuffix("-thumb"),
WriteFiles("*")
);
It will produce image with similar file name as the original image with addition of suffix indicating operations
that have performed, e.g. "hello-world.jpg" can result in "hello-world-w100.jpg". The module allows you to perform more
than one set of processing instructions by using the fluent property And
.
Pipelines.Add("Images",
ReadFiles("*")
.Where(x => new[] { ".jpg", ".jpeg", ".gif", ".png"}.Contains(x.Path.Extension)),
Image()
.SetJpegQuality(100).Resize(400, 209).SetSuffix("-thumb")
.And()
.SetJpegQuality(70).Resize(400*2, 209*2).SetSuffix("-medium"),
WriteFiles("*")
);
The above configuration produces two set of new images, one with a "-thumb" suffix and the other with a "-medium" suffix.
Constructors
Name | Summary |
---|---|
Image |
Process images in the content of the input document. |
Methods
Name | Value | Summary |
---|---|---|
And |
Image |
Mark the beginning of another set of processing instructions to be applied to the images.
|
BlackWhite |
Image |
Applies black and white toning to the image.
|
Brightness |
Image |
Brightens the image.
|
Contrast |
Image |
Adjusts the contrast of the image.
|
Execute |
IEnumerable |
This should not be called directly, instead call
IExecutionContext.Execute() if you need to execute a module from within another module.
|
Hue |
Image |
Sets the hue of the image using
0 to 360 degree values.
|
Opacity |
Image |
Multiplies the alpha component of the image.
|
Operation |
Image |
Allows you to specify your own ImageSharp operation.
|
OutputAs |
Image |
Allows you to specify an alternate output format for the image.
For example, you might use this if you want to full specify the encoder and it's properties.
This will override the default behavior of outputting the image as the same format.
|
OutputAsBmp |
Image |
Outputs the image as BMP. This will override the default
behavior of outputting the image as the same format.
|
OutputAsGif |
Image |
Outputs the image as GIF. This will override the default
behavior of outputting the image as the same format.
|
OutputAsJpeg |
Image |
Outputs the image as JPEG. This will override the default
behavior of outputting the image as the same format.
|
OutputAsPng |
Image |
Outputs the image as PNG. This will override the default
behavior of outputting the image as the same format.
|
Resize |
Image |
Resizes the image to a certain width and height. No resizing will be performed if
both width and height are set to
null .
|
Saturate |
Image |
Saturates the image.
|
SetPrefix |
Image |
Set the prefix of the generated image, e.g.
SetPrefix("medium-") will transform original
filename "hello-world.jpg" to "medium-hello-world.jpg".
|
SetSuffix |
Image |
Set the suffix of the generated image, e.g.
SetSuffix("-medium") will transform original
filename "hello-world.jpg" to "hello-world-medium.jpg".
|
Vignette |
Image |
Apply vignette processing to the image with specific color, e.g.
Vignette(Rgba32.AliceBlue) .
|