Official Content

The purpose of this data type is to store or reference any type of image files (jpg, bmp, png, etc).

Images can be stored in any of the databases supported by GeneXus without having to specify the file name or type (jpg, bmp, etc.).

An image can be loaded from both an image predefined in the KB (using the FromImage method) and a URL (local or remote using the FromURL method). If the value sent to FromURL is a remote URL, the image will be downloaded and saved in the DB upon making an Insert. If what is needed is just a reference to the Image stored in a local or remote location, the ImageURI property has to be assigned.

Therefore, any image can be displayed by dragging any variable or attribute defined with the Image data type to the form. In other words, GeneXus performs the image rendering without any intervention from the user.


ImageName Gets the image name (Character).
ImageType Gets the Image Type. The Image Type Domain is the extension of the image. For example: jpg, ico, png, etc.

Sets/Gets the Image URL


You can set a relative path, which will be resolved with the current host.

You can set an absolute path to an external image on the web.

You can set a local path by using file:// protocol

When you set the ImageURI property, the internal Blob with the image will be set to empty.

For example:

&image.ImageURI = "http://www.myimages/image.jpg"

In this case, image.jpg will be the image in the data.


GeneXus always returns the absolute URL to the image.

*These properties are inaccessible by Smart Devices events



Loads the current instance with the image given in the Image Object parameter

After calling this method the ImageURI property has the following value:


The <imageobjectname>.<extension> is calculated by GeneXus depending on the theme and language.


Loads the current instance with the image given in the ImageURL parameter.

This indicates that the internal Blob holding the image must be loaded from the URI indicated in the ImageURL parameter.

After calling this method, the ImageURI property has the absolute URL to the image.

For example:

msg(&image.ImageURI)  // will print

Note: The image will be downloaded from the URL specified and will be automatically stored in the database (applies only to attributes).

SetEmpty/IsEmpty Returns True if there aren´t an image or a reference to an a stored image.


1. Structuring

A company wants to save photos of its employees; to do so, you only have to write the following:

EmployeeId     Numeric(4.0)
EmployeeName   Character
EmployeeImage  Image

In the EmployeImage field, any type of photos can be saved (jpg, png, etc).

2. Inserting an image into the DB from an existing image in my KB

The FromImage method can only be used when extracting an image from a known KB. Suppose you have an image in your KB called CompanyNameImage.

So, you write the following code:

&Company.CompanyId = 1

3. Inserting an image into the DB from an existing URL

Suppose you have an image in your file system or in a web URL and you want to store it in your database. Your image is file:///c:/myfolder/logo.jpg (the URL must be accessible from your server if it is a local URL).

&Company.CompanyId = 1

4. Inserting a reference into the DB from an external image

You want to reference an external image:

&Company.CompanyId = 1
&Company.CompanyLogo.ImageURI = ''

5. How to convert from Blob to Image in your DB

Most likely, you have many Blob attributes in your DB to store images and you want to start using the new data type.

The only thing you have to do is change the type from Blob to Image in your attribute definition and GeneXus will perform a reorganization, taking into account the FileType, FileTypeAttribute and FileNameAttribute properties.

6. How to convert from Blob to Image and vice versa programmatically

You can directly assign a Blob to an Image and vice versa. Remember that the conversion from Blob to Image will work depending on the kind of mime type of your Blob and the FileType, FileTypeAttribute and FileNameAttribute properties. In some cases, it may happen that the image is not displayed in the user interface.

7. How to convert from Char|VarChar to Image in my DB

In some cases we could have a Character attribute in our DB with URL. What would happen if you wanted to start using the new image data type without losing your existing data?

GeneXus supports the reorganization from Char|VarChar to Image and vice versa.

Image in data base

The image is stored in the data base as 2 separate fields. One is a Blob, and the other is a string with same name and postfix "_GXI". The composition of this field is explained in SAC 31266.


Generators: .NET.NET FrameworkJava
Level: AttributeVariable

See also

Image manipulation API


Last update: November 2023 | © GeneXus. All rights reserved. GeneXus Powered by Globant