< GeeXLab Reference Guide />

> Back to Reference Guide Index


gh_imagemagick library

Description

gh_imagemagick is the module that manages ImageMagick functions. ImageMagick allows to create, edit, compose, or convert bitmap images, read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, TIFF, DPX, EXR, WebP, Postscript, PDF, and SVG....


Number of functions: 39

  1. gh_imagemagick.file_convert ()
  2. gh_imagemagick.file_crop ()
  3. gh_imagemagick.file_exif_get_num_properties ()
  4. gh_imagemagick.file_exif_get_property ()
  5. gh_imagemagick.file_exif_to_log ()
  6. gh_imagemagick.file_ping ()
  7. gh_imagemagick.file_resize ()
  8. gh_imagemagick.texture_auto_level ()
  9. gh_imagemagick.texture_blur ()
  10. gh_imagemagick.texture_charcoal ()
  11. gh_imagemagick.texture_cleanup ()
  12. gh_imagemagick.texture_constitute ()
  13. gh_imagemagick.texture_create_from_buffer ()
  14. gh_imagemagick.texture_create_from_file ()
  15. gh_imagemagick.texture_create_from_zip_file ()
  16. gh_imagemagick.texture_crop ()
  17. gh_imagemagick.texture_decipher ()
  18. gh_imagemagick.texture_edge ()
  19. gh_imagemagick.texture_emboss ()
  20. gh_imagemagick.texture_encipher ()
  21. gh_imagemagick.texture_flip ()
  22. gh_imagemagick.texture_flop ()
  23. gh_imagemagick.texture_gaussian_blur ()
  24. gh_imagemagick.texture_motion_blur ()
  25. gh_imagemagick.texture_negate ()
  26. gh_imagemagick.texture_oil_paint ()
  27. gh_imagemagick.texture_posterize ()
  28. gh_imagemagick.texture_quantize ()
  29. gh_imagemagick.texture_read ()
  30. gh_imagemagick.texture_resize ()
  31. gh_imagemagick.texture_sepia ()
  32. gh_imagemagick.texture_sharpen ()
  33. gh_imagemagick.texture_sketch ()
  34. gh_imagemagick.texture_solarize ()
  35. gh_imagemagick.texture_swirl ()
  36. gh_imagemagick.texture_transpose ()
  37. gh_imagemagick.texture_update ()
  38. gh_imagemagick.texture_wave ()
  39. gh_imagemagick.texture_write ()



file_convert

Description

Converts an image file (new format).


Syntax

ret = gh_imagemagick.file_convert(
 src_filename,
 dst_filename
)

Languages


Parameters


Return Values


Code sample


ret = gh_imagemagick.file_convert(src_filename, dst_filename)
			


file_crop

Description

Crops an image file.


Syntax

ret = gh_imagemagick.file_crop(
 src_filename,
 dst_filename,
 x, y, width, height
)

Languages


Parameters


Return Values


Code sample


ret = gh_imagemagick.file_crop(src_filename, dst_filename, x, y, width, height)
			


file_exif_get_num_properties

Description

Gets the number of EXIF properties of an image.


Syntax

num_exif = gh_imagemagick.file_exif_get_num_properties(
 filename
)

Languages


Parameters


Return Values


Code sample


num_exif = gh_imagemagick.file_exif_get_num_properties(filename)
			


file_exif_get_property

Description

Gets a particular EXIF property of an image.


Syntax

prop_name, prop_value = gh_imagemagick.file_exif_get_property(
 filename,
 prop_index
)

Languages


Parameters


Return Values


Code sample


prop_name, prop_value = gh_imagemagick.file_exif_get_property(filename, prop_index)
			


file_exif_to_log

Description

Writes to the log all EXIF data of an image.


Syntax

gh_imagemagick.file_exif_to_log(
 filename
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.file_exif_to_log(filename)
			


file_ping

Description

Returns simple information (size and format) about an image file without loading it in memory.


Syntax

format, width, height = gh_imagemagick.file_ping(
 filename
)

Languages


Parameters


Return Values


Code sample


w, h, format = gh_imagemagick.file_ping(filename)
			


file_resize

Description

Resizes an image file.


Syntax

ret = gh_imagemagick.file_resize(
 src_filename,
 dst_filename,
 width, height
)

Languages


Parameters


Return Values


Code sample


ret = gh_imagemagick.file_resize(src_filename, dst_filename, 640, 480)
			


texture_auto_level

Description

Applies an auto level effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_auto_level(
 tex_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_auto_level(tex_id)
gh_imagemagick.texture_update(tex_id)
			


texture_blur

Description

Applies a blur effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_blur(
 tex_id,
 radius, sigma
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_blur(tex_id, radius, sigma)
gh_imagemagick.texture_update(tex_id)
			


texture_charcoal

Description

Applies a charcoal effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_charcoal(
 tex_id,
 radius, sigma
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_charcoal(tex_id, radius, sigma)
gh_imagemagick.texture_update(tex_id)
			


texture_cleanup

Description

Frees all ImageMagick resources allocated by the texture. Should be called in a TERMINATE script.


Syntax

gh_imagemagick.texture_cleanup(
 tex_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_cleanup(tex_id)
			


texture_constitute

Description

Updates the texture to be ImageMagick-compatible. The texture can be used with other imagemagick functions.


Syntax

ret = gh_imagemagick.texture_constitute(
 tex_id
)

Languages


Parameters


Return Values


Code sample


ret = gh_imagemagick.texture_constitute(tex_id)
			


texture_create_from_buffer

Description

Creates a texture object from a memory buffer.


Syntax

tex_id = gh_imagemagick.texture_create_from_buffer(
 buff_ptr,
 buff_size,
 pf,
 gen_mipmaps,
 free_cpu_memory,
 upload_to_gpu
)

Languages


Parameters


Return Values


Code sample


PF_U8_RGB = 1
PF_U8_BGR = 2
PF_U8_RGBA = 3
PF_U8_BGRA = 4
PF_F32_RGB = 5
PF_F32_RGBA = 6
PF_F32_R = 7
PF_U8_R = 11
PF_U8_RG = 12

local PF_U8_RGBA = 3
local upload_to_gpu = 1
local gen_mipmaps = 1
local free_cpu_memory = 1
filename = demo_dir .. "assets/image.jpg"

buffer, buffer_size = gh_utils.file_buffer_create(filename)
tex_id = gh_imagemagick.texture_create_from_buffer(buffer, buffer_size, PF_U8_RGBA, gen_mipmaps, free_cpu_memory, upload_to_gpu)
gh_utils.file_buffer_kill(buffer)
			


texture_create_from_file

Description

Creates a texture object from an image file.


Syntax

tex_id = gh_imagemagick.texture_create_from_file(
 filename,
 pf,
 gen_mipmaps,
 free_cpu_memory,
 upload_to_gpu
)

Languages


Parameters


Return Values


Code sample


PF_U8_RGB = 1
PF_U8_BGR = 2
PF_U8_RGBA = 3
PF_U8_BGRA = 4
PF_F32_RGB = 5
PF_F32_RGBA = 6
PF_F32_R = 7
PF_U8_R = 11
PF_U8_RG = 12

tex_id = gh_imagemagick.texture_create_from_file(filename, PF_U8_RGBA, gen_mipmaps, free_cpu_memory, upload_to_gpu)
			


texture_create_from_zip_file

Description

Creates a texture object from an image file stored in a zip archive.


Syntax

tex_id = gh_imagemagick.texture_create_from_zip_file(
 zip_filename,
 filename,
 pf,
 gen_mipmaps,
 free_cpu_memory,
 upload_to_gpu
)

Languages


Parameters


Return Values


Code sample


PF_U8_RGB = 1
PF_U8_BGR = 2
PF_U8_RGBA = 3
PF_U8_BGRA = 4
PF_F32_RGB = 5
PF_F32_RGBA = 6
PF_F32_R = 7
PF_U8_R = 11
PF_U8_RG = 12

local PF_U8_RGBA = 3
local upload_to_gpu = 1
local gen_mipmaps = 1
local free_cpu_memory = 1
local demo_dir = gh_utils.get_demo_dir()
zip_filename = demo_dir .. "demo.zip"
filename = "assets/image.jpg"

tex_id = gh_imagemagick.texture_create_from_zip_file(zip_filename, filename, PF_U8_RGBA, gen_mipmaps, free_cpu_memory, upload_to_gpu)
			


texture_crop

Description

Applies a crop effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_crop(
 tex_id,
 x, y, width, height
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_crop(tex_id, x, y, width, height)
gh_imagemagick.texture_update(tex_id)
			


texture_decipher

Description

Applies a decipher effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_decipher(
 tex_id,
 passphrase
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_decipher(tex_id, "geexlab")
gh_imagemagick.texture_update(tex_id)
			


texture_edge

Description

Applies an edge effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_edge(
 tex_id,
 radius
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_edge(tex_id, radius)
gh_imagemagick.texture_update(tex_id)
			


texture_emboss

Description

Applies an emboss effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_emboss(
 tex_id,
 radius, sigma
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_emboss(tex_id, radius, sigma)
gh_imagemagick.texture_update(tex_id)
			


texture_encipher

Description

Applies an encipher effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_encipher(
 tex_id,
 passphrase
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_encipher(tex_id, "geexlab")
gh_imagemagick.texture_update(tex_id)
			


texture_flip

Description

Applies a flip effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_flip(
 tex_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_flip(tex_id)
gh_imagemagick.texture_update(tex_id)
			


texture_flop

Description

Applies a flop effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_flop(
 tex_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_flop(tex_id)
gh_imagemagick.texture_update(tex_id)
			


texture_gaussian_blur

Description

Applies a motion blur effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_gaussian_blur(
 tex_id,
 radius, sigma
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_gaussian_blur(tex_id, radius, sigma)
gh_imagemagick.texture_update(tex_id)
			


texture_motion_blur

Description

Applies a motion blur effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_motion_blur(
 tex_id,
 radius, sigma, angle
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_motion_blur(tex_id, radius, sigma, angle)
gh_imagemagick.texture_update(tex_id)
			


texture_negate

Description

Applies a negate effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_negate(
 tex_id,
 only_negate_grayscale_pixels
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_negate(tex_id, 0)
gh_imagemagick.texture_update(tex_id)
			


texture_oil_paint

Description

Applies a oil paint effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_oil_paint(
 tex_id,
 radius, sigma
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_oil_paint(tex_id, radius, sigma)
gh_imagemagick.texture_update(tex_id)
			


texture_posterize

Description

Applies a posterize effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_posterize(
 tex_id,
 num_colors,
 dither_method_type
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


dither_method_type:
"none"
"riemersma"
"floydsteinberg"
num_colors = 4
dither_method_type = "none"

gh_imagemagick.texture_posterize(tex_id, num_colors, dither_method_type)
gh_imagemagick.texture_update(tex_id)
			


texture_quantize

Description

Applies a quantize effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_quantize(
 tex_id,
 num_colors,
 color_space_type,
 treedepth,
 dither_method_type
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


color_space_type:
'cmy'
'cmyk'
'gray'
'hsb'
'hsl'
'luv'
'rgb'
'srgb'
'xyz'
'ycbcr'
'yuv'
dither_method_type:
'none'
'riemersma'
'floydsteinberg'

num_colors = 4
color_space_type = "srgb"
treedepth = 1
dither_method_type = "none"

gh_imagemagick.texture_quantize(tex_id, num_colors, color_space_type, treedepth, dither_method_type)
gh_imagemagick.texture_update(tex_id)
			


texture_read

Description

Reads the content of an image file and stores it in an existing texture.


Syntax

gh_imagemagick.texture_read(
 tex_id,
 filename,
 pf
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


PF_U8_RGB = 1
PF_U8_BGR = 2
PF_U8_RGBA = 3
PF_U8_BGRA = 4
PF_F32_RGB = 5
PF_F32_RGBA = 6
PF_F32_R = 7
PF_U8_R = 11
PF_U8_RG = 12

gh_imagemagick.texture_read(tex_id, filename, PF_U8_RGBA)
			


texture_resize

Description

Applies a resize effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_resize(
 tex_id,
 width, height
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_resize(tex_id, width, height)
gh_imagemagick.texture_update(tex_id)
			


texture_sepia

Description

Applies a sepia effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_sepia(
 tex_id,
 threshold
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_sepia(tex_id, threshold)
gh_imagemagick.texture_update(tex_id)
			


texture_sharpen

Description

Applies a sharpen effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_sharpen(
 tex_id,
 radius, sigma
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_sharpen(tex_id, radius, sigma)
gh_imagemagick.texture_update(tex_id)
			


texture_sketch

Description

Applies a sketch effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_sketch(
 tex_id,
 radius, sigma, angle
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_sketch(tex_id, radius, sigma, angle)
gh_imagemagick.texture_update(tex_id)
			


texture_solarize

Description

Applies a solarize effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_solarize(
 tex_id,
 threshold
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_solarize(tex_id)
gh_imagemagick.texture_update(tex_id)
			


texture_swirl

Description

Applies a swirl effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_swirl(
 tex_id,
 degrees,
 interpolation_method
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


interpolation_method:
'spline'
'nearest'
'triangular_mesh'
'integer_floor'
'catrom'
'blend'
'bilinear'
'background'
'average16'
'average9'
'average4'

gh_imagemagick.texture_swirl(tex_id, degrees, "triangular_mesh")
gh_imagemagick.texture_update(tex_id)
			


texture_transpose

Description

Applies a transpose effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_transpose(
 tex_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_transpose(tex_id)
gh_imagemagick.texture_update(tex_id)
			


texture_update

Description

Updates the texture after ImageMagick operations on it (like cropping, effects, etc.).


Syntax

gh_imagemagick.texture_update(
 tex_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_update(tex_id)
			


texture_wave

Description

Applies a wave effect on the ImageMagick data of a texture.


Syntax

gh_imagemagick.texture_wave(
 tex_id,
 amplitude, wave_length,
 interpolation_method
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


interpolation_method:
'spline'
'nearest'
'triangular_mesh'
'integer_floor'
'catrom'
'blend'
'bilinear'
'background'
'average16'
'average9'
'average4'

gh_imagemagick.texture_wave(tex_id, amplitude, wave_length, "bilinear")
gh_imagemagick.texture_update(tex_id)
			


texture_write

Description

Writes / saves a texture to a file.


Syntax

gh_imagemagick.texture_write(
 tex_id,
 filename
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_write(tex_id, filename)
			






GeeXLab Rootard Guide | Downloads | Contact