Handling images in EPiServer programmatically
The image editor in edit mode uses EPiServer.ImageLibrary to transform images with the great functionality of let another process then the web application to handle it. Senses the handlings of images are heavy both for the CPU and the memory this is a great feature to be able to configure the web site to do this in another process (or another machine). But it is not yet any documentation for it…
I talked to the EPiServer development team that said the API is stable and they agree to publish it – so I hope it will come out in the SDK son, but when we wait for this documentation I can try to describe how it is working.
EPiServer.ImageLibrary.ImageServiceClient – The image service client to access the service with
The constructor of the end point that takes a string defining the endpoints name, the name used by EPiServer are "ImageServiceClientEndPoint" and can be used if you want the same service to handle the web sites images in the same process as the image editor use.
public byte RenderImage(
A transformed image
imageBuffer – the original image
operations – operations for transforming the image
mimeType – the mime type of the image. Defined mime type are image/png, image/bmp, image/gif, image/tiff, image/jpg, image/jpeg, image/pjpeg
zoomFactor - the zoom factor 1 means 100%
jpegQuality – the Jpeg quality (if mime types is image/jpg, image/jpeg or image/pjpeg) in %
The image operations implemented are given by the enum EPiServer.ImageLibrary.ImageEditorCommand and has the following options:
None - No action
Grayscale - Convert image to grey scale
Crop - Crop image
FlipX - Flip the image on the X axis
FlipY - Flip the image on the Y axis
Resize - Resize the image
Rotate - Rotate the image
This web page rotates an image 180 degrees given its virtual path.
Example to flip support Jens up side down (on a EPiServer sample site)