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



file_ping

Description

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


Syntax

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

Languages

Lua - Python


Parameters


Return Values


Code sample

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


file_convert

Description

Converts an image file (new format).


Syntax

ret = gh_imagemagick.file_convert(
 filename_src,
 filename_dst
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
ret = gh_imagemagick.file_convert(filename_src, filename_dst)
            


file_resize

Description

Resizes an image file.


Syntax

ret = gh_imagemagick.file_resize(
 filename_src,
 filename_dst,
 width, height
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
ret = gh_imagemagick.file_resize(filename_src, filename_dst, 640, 480)
            


file_crop

Description

Crops an image file.


Syntax

ret = gh_imagemagick.file_crop(
 filename_src,
 filename_dst,
 x, y, width, height
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
ret = gh_imagemagick.file_crop(filename_src, filename_dst, x, y, width, height)
            


file_exif_to_log

Description

Writes to the log all EXIF data of an image.


Syntax

gh_imagemagick.file_exif_to_log(
 filename
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_imagemagick.file_exif_to_log(filename)
            


file_exif_get_num_properties

Description

Gets the number of EXIF properties of an image.


Syntax

n = gh_imagemagick.file_exif_get_num_properties(
 filename
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
n = gh_imagemagick.file_exif_get_num_properties(filename)
            


file_exif_get_property

Description

Gets a particular EXIF property of an image.


Syntax

property_name, property_value = gh_imagemagick.file_exif_get_property(
 filename,
 property_index
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
property_name, property_value = gh_imagemagick.file_exif_get_property(filename, property_index)
            


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

Lua - Python


Parameters


Return Values


Code sample

    
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

Lua - Python


Parameters


Return Values


Code sample

    
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_create_from_buffer

Description

Creates a texture object from a memory buffer.


Syntax

tex_id = gh_imagemagick.texture_create_from_buffer(
 buffer_ptr,
 buffer_size,
 pf,
 gen_mipmaps,
 free_cpu_memory,
 upload_to_gpu
)

Languages

Lua - Python


Parameters


Return Values


Code sample

    
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_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

Lua - Python


Parameters


Return Values


Code sample

    
ret = gh_imagemagick.texture_constitute(texture_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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_imagemagick.texture_cleanup(texture_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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_imagemagick.texture_read(texture_id, filename, PF_U8_RGBA)
            


texture_write

Description

Writes / saves a texture to a file.


Syntax

gh_imagemagick.texture_write(
 tex_id,
 filename
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_imagemagick.texture_write(texture_id, filename)
            


texture_update

Description

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


Syntax

gh_imagemagick.texture_update(
 tex_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_imagemagick.texture_update(texture_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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_imagemagick.texture_negate(texture_id, 0)
gh_imagemagick.texture_update(texture_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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample

    
gh_imagemagick.texture_blur(texture_id, radius, sigma)
gh_imagemagick.texture_update(texture_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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


num_colors = 4
color_space_type = "srgb"         
treedepth = 1       
dither_method_type = "none"                
gh_imagemagick.texture_quantize(texture_id, num_colors, color_space_type, treedepth, dither_method_type)
gh_imagemagick.texture_update(texture_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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


num_colors = 4
dither_method_type = "none"                
gh_imagemagick.texture_posterize(texture_id, num_colors, dither_method_type)
gh_imagemagick.texture_update(texture_id)
            


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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


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


texture_resize

Description

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


Syntax

gh_imagemagick.texture_resize(
 tex_id,
 width, height
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


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


texture_sepia

Description

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


Syntax

gh_imagemagick.texture_sepia(
 tex_id,
 threshold
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_sepia(texture_id, threshold)
gh_imagemagick.texture_update(texture_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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


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


texture_encipher

Description

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


Syntax

gh_imagemagick.texture_encipher(
 tex_id,
 passphrase
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


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


texture_decipher

Description

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


Syntax

gh_imagemagick.texture_decipher(
 tex_id,
 passphrase
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_decipher(texture_id, "geexlab")
gh_imagemagick.texture_update(texture_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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_wave(texture_id, amplitude, wave_length, interpolation_method)
gh_imagemagick.texture_update(texture_id)
            


texture_transpose

Description

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


Syntax

gh_imagemagick.texture_transpose(
 tex_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_transpose(texture_id)
gh_imagemagick.texture_update(texture_id)
            


texture_flip

Description

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


Syntax

gh_imagemagick.texture_flip(
 tex_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_flip(texture_id)
gh_imagemagick.texture_update(texture_id)
            


texture_flop

Description

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


Syntax

gh_imagemagick.texture_flop(
 tex_id
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_flop(texture_id)
gh_imagemagick.texture_update(texture_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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_swirl(texture_id, degrees, interpolation_method)
gh_imagemagick.texture_update(texture_id)
            


texture_solarize

Description

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


Syntax

gh_imagemagick.texture_solarize(
 tex_id,
 threshold
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_solarize(texture_id)
gh_imagemagick.texture_update(texture_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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_sketch(texture_id, radius, sigma, angle)
gh_imagemagick.texture_update(texture_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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_motion_blur(texture_id, radius, sigma, angle)
gh_imagemagick.texture_update(texture_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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_gaussian_blur(texture_id, radius, sigma)
gh_imagemagick.texture_update(texture_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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


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


texture_edge

Description

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


Syntax

gh_imagemagick.texture_edge(
 tex_id,
 radius
)

Languages

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_edge(texture_id, radius)
gh_imagemagick.texture_update(texture_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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


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


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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


gh_imagemagick.texture_auto_level(texture_id)
gh_imagemagick.texture_update(texture_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

Lua - Python


Parameters


Return Values

This function has no return value(s).


Code sample


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






GeeXLab Rootard Guide | Downloads | Contact | Newsletter