Unofficial Content

This method is part of  Image Tools project

Motivation

Allows you to change the image format (eg: bmp to jpg) and set the image quality. Achieving the reduction of the image size  until 95% making more quickly the browser loading.

Syntax

ChangeFormat (  ImageSourcePath, ImageTargetPath,CompressionLevel, NewFormat)

where:
ImageSourcePath
    Is the original image path (full or relative).
ImageTargetPath

      Is the image returned path.
CompressionLevel
      If the image format selected admit compression, this parameter set the compression level,The range of useful values for the quality  is from 0 to 100. The lower the number specified, the higher the compression and therefore the lower the quality of the image. Zero would give you the lowest quality image and 100 the highest.
NewFormat
      Indicate the new image format. The ImageFormat is a GeneXus Domain with the values BMP, JPG, TIFF and PNG but you can use other mime type name like "image/bmp"


Example

ImageTools.ChangeFormat("XIXGX-5.jpg","XIXGX-5.bmp",10,ImageFormat.BMP)

 

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant