Skip to content

add_image_borderAddImageBorderAddImageBorderadd_image_borderadd_image_border🔗

Short description🔗

add_image_borderAddImageBorderAddImageBorderadd_image_borderadd_image_border — Add a border to an image.

Signature🔗

add_image_border( image Image, out image ImageBorder, attribute.name Size, attribute.name Value )void AddImageBorder( const HObject& Image, HObject* ImageBorder, const HTuple& Size, const HTuple& Value )static void HOperatorSet.AddImageBorder( HObject image, out HObject imageBorder, HTuple size, HTuple value )def add_image_border( image: HObject, size: MaybeSequence[int], value: MaybeSequence[Union[int, str]] ) -> HObject

Herror add_image_border( const Hobject Image, Hobject* ImageBorder, const Hlong Size, const Hlong Value )

Herror T_add_image_border( const Hobject Image, Hobject* ImageBorder, const Htuple Size, const Htuple Value )

HImage HImage::AddImageBorder( const HTuple& Size, const HTuple& Value ) const

HImage HImage::AddImageBorder( Hlong Size, Hlong Value ) const

HImage HImage.AddImageBorder( HTuple size, HTuple value )

HImage HImage.AddImageBorder( int size, int value )

Description🔗

Adds a border to the input image Imageimageimage and returns the resulting image in ImageBorderimageBorderimage_border.

The size of the border in pixels must be passed in Sizesizesize. It can be set as follows:

  • Single number: Border size in all four directions left/right/top/bottom.

  • Two numbers: Border size on left/right and top/bottom side: [l/r, t/b].

  • Four numbers: Border size on left, right, top, bottom side: [l,r,t,b].

The gray value of the added border must be passed in Valuevaluevalue. It can be set as follows:

  • Single number: Value will be applied to all channels of Imageimageimage.

  • Multiple numbers: Values will be applied to the channels of the image separately. Thus, the first value will be applied to the first channel, the second value will be applied to the second channel and so on.

    Restriction: Number of values must be equal to the number of channels.

Note that add_image_borderAddImageBorder will ignore the input domain and will always return an image with a full domain in ImageBorderimageBorderimage_border.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

Parameters🔗

Imageimageimage (input_object) multichannel-image-array → object (byte / direction / int1 / int2 / uint2 / int4 / int8 / real)HObject (byte / direction / int1 / int2 / uint2 / int4 / int8 / real)HImage (byte / direction / int1 / int2 / uint2 / int4 / int8 / real)HObject (byte / direction / int1 / int2 / uint2 / int4 / int8 / real)Hobject (byte / direction / int1 / int2 / uint2 / int4 / int8 / real)

Input image.

ImageBorderimageBorderimage_border (output_object) multichannel-image-array → object (byte / direction / int1 / int2 / uint2 / int4 / int8 / real)HObject (byte / direction / int1 / int2 / uint2 / int4 / int8 / real)HImage (byte / direction / int1 / int2 / uint2 / int4 / int8 / real)HObject (byte / direction / int1 / int2 / uint2 / int4 / int8 / real)Hobject * (byte / direction / int1 / int2 / uint2 / int4 / int8 / real)

Output image.

Sizesizesize (input_control) attribute.name(-array) → (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Size of the border in pixels.

Default: 1010

Valuevaluevalue (input_control) attribute.name(-array) → (integer / string)HTuple (Hlong / HString)HTuple (int / long / string)MaybeSequence[Union[int, str]]Htuple (Hlong / char*)

Gray value of the border.

Default: 100100

Example🔗

(HDevelop)

* Add a border of 20 pixels with a constant gray value of 255
* on all four sides of Image
read_image (Image, 'printer_chip/printer_chip_01')
add_image_border (Image, ImageBorder, 20, 255)

* Add a 10-pixel border with a constant gray value of 255 to
* the left and right side and a 20-pixel border with the same
* gray value to the top and bottom of Image.
read_image (Image, 'printer_chip/printer_chip_01')
add_image_border (Image, ImageBorder, [10, 20], 255)

Combinations with other operators🔗

Combinations

Alternatives

tile_images_offsetTileImagesOffset

Module🔗

Foundation