# \*OBJ/IMAGE Create Image Object

> Source: https://manual.pvxplus.com/utilities/obj-image

## Format

*oHandle* = **NEW("\*obj/image",** *imageFilename$***\[**, *imageType$***\]\[**, *dpi$***\]\[**, *width$***\]\[**, *height$***\])**

***Where:***

|  |  |
| --- | --- |
| *imageFilename$* | Path and filename of the image to create. |
| *imageType$* | Optional parameter for the object creation that may contain one of the following: ***png***, ***jpg***, or ***jpeg***. Defaults to using the file extension of the *imageFilename$* to determine image type. |
| *dpi$* | Dots per inch. Defaults to 120. |
| *width$* | Width (in pixels) of the created image. Defaults to 1020 (1020/120 = 8.5 in). |
| *height$* | Height (in pixels) of the created image. Defaults to 1320 (1320/120 = 11 in). |

## Description

This object is used to create an image on Windows or UNIX/Linux. It supports the creation of ***png***, ***jpg***, or ***jpeg*** images.

*(The Create Image object was added in PxPlus 2020.)*

To create an image, instantiate the object and then use the **ImageChannel** property to add things to the image. Then, drop the object and the image will be created.

Note:  
You can use the @X/Y(=num) function to use pixel positioning when adding things to the image.

The following ***property*** is supported:

|  |  |  |
| --- | --- | --- |
|  | **ImageChannel** | Channel of image to create. Use this to add things to the image. |

On UNIX/Linux, **ImageChannel** cannot be used as an input channel for the 'PICTURE' mnemonic, as this only supports \*BITMAP\*.

## Example

The following code provides an example of creating an image with the **\*obj/image** object:

```
imgObj=new("*obj/image","newimage.png","","150","1500","1500")
imgChn=imgObj'ImageChannel
print (imgChn)'font'("Arial",-14)
print (imgChn)'rectangle'(@x(=5),@y(=100),@x(=900),@y(=250))
print (imgChn)'text'(@x(=1),@y(=300),@x(=500),@y(=350),"Howdy")
print (imgChn)'picture'(@x(=1),@y(=500),@x(=500),@y(=1000),"image.png",2)
drop object imgObj
```

## See Also

**[@X( ) / @Y( ) Convert X/Y Coordinates](https://manual.pvxplus.com/functions/x)**
