Image Converter

This command will convert a detected image file to the specified format. It can also be used to resize and run image transformations.

When to use it

When you want to ensure that uploaded images are optimized for size/quality and in a format that is internet friendly. E.g. create thumbnails and normalize image size from huge jpegs taken by cameras.

Meta File

To pass in meta information about images, a seperate json file is passed in with the image to convert. Please ensure meta file is copied into watched folder first.

Naming Convention

{file name with extension}.ImageConversion.json

e.g. image.jpg -> image.jpg.ImageConversion.json

File Format

This is a key value list of parameters to pass to ImageMagick.

  
{
  "Caption" : "Caption of image",
  "Comment" : "Comment of image"
}
  
  

Configuration

imageConversionSetting

  • string name - the unique name of the configuration element.
  • string outPutPath - the path where processed file will be saved to.
  • string workingPath - the path where files will be saved to, while being processed.
  • string errorProcessingPath - the path where files that could not be processed will be moved to.
  • string fileNameFormat - the file name format that is applied on outputted files.

  • int? width - the image width, in pixels.
  • int? height - the image height, in pixels.
  • ResizeMode resizeMode - what strategy to use when resizing the image.
  • Gravity gravity - what strategy to use when resizing the image.
  • string backgroundColor - he background color in hexadecimal for padding images that do not completely fill the canvas. An empty string will result in images with a transparent background if this is supported by the output format.
  • int? quality - the image quality, as a percentage (0-100), of images returned in this photo style when using an image format that supports lossy compression (such as JPG or PNG).
  • ResizeImageType resizeImageType - the image format to convert to.

ResizeImageType

  • JPG - Jpeg
  • PNG - Png
  • GIF - Gif
  • Orginal - use orginal format

Gravity

  • North - Top of the content should be aligned with the top of the frame, and the content should be horizontally centered in the frame.
  • NorthEast - Top right corner of the content should be aligned with the top right corner of the frame.
  • East - Content is vertically centered in the frame, with the right edge of the content aligned with the right edge of the frame.
  • SouthEast - Bottom right corner of the content should be aligned with the bottom right corner of the frame.
  • South - Content is horizontally centered in the frame, with the bottom of the content aligned with the bottom edge of the frame.
  • SouthWest - Bottom-left corner of the content is aligned with the bottom-left corner of the frame.
  • West - Content is vertically centered in the frame, with the left edge of the content aligned with the left edge of the frame.
  • NorthWest - Top left corner of the content is aligned with the top left corner of the frame.
  • Center - The content is centered vertically and horizontally in the frame.

ResizeMode

  • AreaToFit - Area to fit. Aspect is maintained. Aspect is maintained; we show as much as we can, and chop off the overspill and pad the rest with a specified background colour.
  • CutToFit - Aka "pan'n'scan' or cut to fit. Aspect is maintained; we show as much as we can, and chop off the overspill.
  • Zoom - Aka "letterboxing" or pad out image. Aspect ratio is maintained. We shrink the content so it fits in the frame with no cropping, and pad the rest with a specified background colour.
  • FitWidth - The output will be scaled to match the target width exactly. Aspect is maintained. The height of the output is determined by the dimensions of the input.
  • FitMinimumWidth - The output will be scaled to minimum width if width is smaller than minimum width. Aspect is maintained. The height of the output is determined by the dimensions of the input.
  • FitMaximumWidth - The output will be scaled to maximum width if width is bigger than maximum width. Aspect is maintained. The height of the output is determined by the dimensions of the input.
  • FitHeight - The output will be scaled to match the target height exactly. Aspect ratio is maintained; the width of the output is determined by the dimensions of the input.
  • FitMinimumHeight - The output will be scaled to minimum height if height is smaller than minimum height. Aspect ratio is maintained; the width of the output is determined by the dimensions of the input.
  • FitMaximumHeight - The output will be scaled to maximum height if height is bigger than maximum height. Aspect ratio is maintained; the width of the output is determined by the dimensions of the input.
  • Stretch - The input is distorted to fit the target frame exactly.
  • None - The output matches the dimensions of the input; no resizing is performed.

Example Configuration


<configuration>
  <commander>
    <projects>
      <project name="Blog">
        <imageConversionSettings>
          <!-- Blog - Image Output -->
          <imageConversionSetting name="SettingsForBlogImage" outPutPath="C:\Data\talifun-commander\Examples\Assets\Blog\Output\Image\Resized\" errorProcessingPath="C:\Data\talifun-commander\Examples\Assets\Blog\Processing\Image\ProblemProcessingQueue\" workingPath="C:\Data\talifun-commander\Examples\Assets\Blog\Processing\Image\Temp\" resizeMode="FitMaximumWidth" quality="100" width="500"/>
          <imageConversionSetting name="SettingsForBlogImageThumbnail" outPutPath="C:\Data\talifun-commander\Examples\Assets\Blog\Output\Image\ImageThumbnail\" errorProcessingPath="C:\Data\talifun-commander\Examples\Assets\Blog\Processing\Image\ProblemProcessingQueue\" workingPath="C:\Data\talifun-commander\Examples\Assets\Blog\Processing\Image\Temp\" resizeMode="CutToFit" quality="100" width="100" height="90" gravity="Center"/>
        </imageConversionSettings>
      </project>
    </projects>
  </commander>
</configuration>