< 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: 37

  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_constitute (Lua - Python)
  10. gh_imagemagick.texture_cleanup (Lua - Python)
  11. gh_imagemagick.texture_read (Lua - Python)
  12. gh_imagemagick.texture_write (Lua - Python)
  13. gh_imagemagick.texture_update (Lua - Python)
  14. gh_imagemagick.texture_negate (Lua - Python)
  15. gh_imagemagick.texture_blur (Lua - Python)
  16. gh_imagemagick.texture_quantize (Lua - Python)
  17. gh_imagemagick.texture_posterize (Lua - Python)
  18. gh_imagemagick.texture_crop (Lua - Python)
  19. gh_imagemagick.texture_resize (Lua - Python)
  20. gh_imagemagick.texture_sepia (Lua - Python)
  21. gh_imagemagick.texture_oil_paint (Lua - Python)
  22. gh_imagemagick.texture_encipher (Lua - Python)
  23. gh_imagemagick.texture_decipher (Lua - Python)
  24. gh_imagemagick.texture_wave (Lua - Python)
  25. gh_imagemagick.texture_transpose (Lua - Python)
  26. gh_imagemagick.texture_flip (Lua - Python)
  27. gh_imagemagick.texture_flop (Lua - Python)
  28. gh_imagemagick.texture_swirl (Lua - Python)
  29. gh_imagemagick.texture_solarize (Lua - Python)
  30. gh_imagemagick.texture_sketch (Lua - Python)
  31. gh_imagemagick.texture_motion_blur (Lua - Python)
  32. gh_imagemagick.texture_gaussian_blur (Lua - Python)
  33. gh_imagemagick.texture_emboss (Lua - Python)
  34. gh_imagemagick.texture_edge (Lua - Python)
  35. gh_imagemagick.texture_charcoal (Lua - Python)
  36. gh_imagemagick.texture_auto_level (Lua - Python)
  37. gh_imagemagick.texture_sharpen (Lua - Python)



gh_imagemagick.file_ping

Description

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

Languages

Lua - Python

Parameters

  • filename [STRING]: absolute path to the image.

    Return Values

  • width, height [INTEGER]: size of the image.
  • format [STRING]: image format (jpg, png, etc.).

    Code sample

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


    gh_imagemagick.file_convert

    Description

    Converts an image file (new format).

    Languages

    Lua - Python

    Parameters

  • filename_src [STRING]: absolute path to the source image.
  • filename_dst [STRING]: absolute path to the destination image.

    Return Values

  • ret [INTEGER]: return code (1==ok, 0==error).

    Code sample

        
    ret = gh_imagemagick.file_convert(filename_dst, filename_dst)
                


    gh_imagemagick.file_resize

    Description

    Resizes an image file.

    Languages

    Lua - Python

    Parameters

  • filename_src [STRING]: absolute path to the source image.
  • filename_dst [STRING]: absolute path to the destination image.
  • width, height [INTEGER]: new size.

    Return Values

  • ret [INTEGER]: return code (1==ok, 0==error).

    Code sample

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


    gh_imagemagick.file_crop

    Description

    Crops an image file.

    Languages

    Lua - Python

    Parameters

  • filename_src [STRING]: absolute path to the source image.
  • filename_dst [STRING]: absolute path to the destination image.
  • x, y, width, height [INTEGER]: crop rectangle.

    Return Values

  • ret [INTEGER]: return code (1==ok, 0==error).

    Code sample

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


    gh_imagemagick.file_exif_to_log

    Description

    Writes to the log all EXIF data of an image.

    Languages

    Lua - Python

    Parameters

  • filename [STRING]: absolute path to the image.

    Return Values

    This function has no return value(s).

    Code sample

        
    gh_imagemagick.file_exif_to_log(filename)
                


    gh_imagemagick.file_exif_get_num_properties

    Description

    Gets the number of EXIF properties of an image.

    Languages

    Lua - Python

    Parameters

  • filename [STRING]: absolute path to the image.

    Return Values

  • n [INTEGER]: number of EXIF properties.

    Code sample

        
    n = gh_imagemagick.file_exif_get_num_properties(filename)
                


    gh_imagemagick.file_exif_get_property

    Description

    Gets a particular EXIF property of an image.

    Languages

    Lua - Python

    Parameters

  • filename [STRING]: absolute path to the image.
  • property_index [INTEGER]: property index

    Return Values

  • property_name, property_value [STRING]: property name and value.

    Code sample

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


    gh_imagemagick.texture_create_from_file

    Description

    Creates a texture object from an image file.

    Languages

    Lua - Python

    Parameters

  • filename [STRING]: absolute path to the image.
  • pf [INTEGER]: pixel format. The following pixel formats are supported:
  • gen_mipmaps [INTEGER]: enable mipmap generation (0 or 1). Currently, works with OpenGL renderer only.
  • free_cpu_memory [INTEGER]: frees (0 or 1) the CPU memory after the loading in GPU memory.
  • upload_to_gpu [INTEGER]: uploads (0 or 1) the pixmap into GPU memory.

    Return Values

  • tex_id [INTEGER]: texture identifier.

    Code sample

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


    gh_imagemagick.texture_constitute

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.

    Return Values

  • ret [INTEGER]: return code (1==ok, 0==error).

    Code sample

        
    ret = gh_imagemagick.texture_constitute(texture_id)
                


    gh_imagemagick.texture_cleanup

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.

    Return Values

    This function has no return value(s).

    Code sample

        
    gh_imagemagick.texture_cleanup(texture_id)
                


    gh_imagemagick.texture_read

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • filename [STRING]: absolute path to the image.
  • pf [INTEGER]: pixel format. The following pixel formats are supported:

    Return Values

    This function has no return value(s).

    Code sample

        
    gh_imagemagick.texture_read(texture_id, filename, PF_U8_RGBA)
                


    gh_imagemagick.texture_write

    Description

    Writes / saves a texture to a file.

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • filename [STRING]: absolute path to the image.

    Return Values

    This function has no return value(s).

    Code sample

        
    gh_imagemagick.texture_write(texture_id, filename)
                


    gh_imagemagick.texture_update

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.

    Return Values

    This function has no return value(s).

    Code sample

        
    gh_imagemagick.texture_update(texture_id)
                


    gh_imagemagick.texture_negate

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • only_negate_grayscale_pixels [INTEGER]: only negate grayscale pixels (0 or 1).

    Return Values

    This function has no return value(s).

    Code sample

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


    gh_imagemagick.texture_blur

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • radius, sigma [REAL]: effect params.

    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)
                


    gh_imagemagick.texture_quantize

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • num_colors [INTEGER]: num of colors.
  • color_space_type [STRING]: color space. Possible values:
  • treedepth [INTEGER]: effect params.
  • dither_method_type [STRING]: dithering method. Possible values:

    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)
                


    gh_imagemagick.texture_posterize

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • num_colors [INTEGER]: effect params.
  • dither_method_type [STRING]: dithering method. Possible values:

    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)
                


    gh_imagemagick.texture_crop

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • x, y, width, height [INTEGER]: cropping region.

    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)
                


    gh_imagemagick.texture_resize

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • width, height [INTEGER]: new size.

    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)
                


    gh_imagemagick.texture_sepia

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • threshold [REAL]: effect param.

    Return Values

    This function has no return value(s).

    Code sample

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


    gh_imagemagick.texture_oil_paint

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • radius, sigma [REAL]: effect params.

    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)
                


    gh_imagemagick.texture_encipher

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • passphrase [STRING]: effect param.

    Return Values

    This function has no return value(s).

    Code sample

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


    gh_imagemagick.texture_decipher

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • passphrase [STRING]: effect param.

    Return Values

    This function has no return value(s).

    Code sample

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


    gh_imagemagick.texture_wave

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • amplitude, wave_length [REAL]: effect params.
  • interpolation_method [STRING]: interpolation. Possible values:

    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)
                


    gh_imagemagick.texture_transpose

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.

    Return Values

    This function has no return value(s).

    Code sample

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


    gh_imagemagick.texture_flip

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.

    Return Values

    This function has no return value(s).

    Code sample

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


    gh_imagemagick.texture_flop

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.

    Return Values

    This function has no return value(s).

    Code sample

    gh_imagemagick.texture_flop(texture_id)
    gh_imagemagick.texture_update(texture_id)
                


    gh_imagemagick.texture_swirl

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • degrees [REAL]: effect param.
  • interpolation_method [STRING]: interpolation. Possible values:

    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)
                


    gh_imagemagick.texture_solarize

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • threshold [REAL]: effect param.

    Return Values

    This function has no return value(s).

    Code sample

    gh_imagemagick.texture_solarize(texture_id)
    gh_imagemagick.texture_update(texture_id)
                


    gh_imagemagick.texture_sketch

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • radius, sigma, angle [REAL]: effect params.

    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)
                


    gh_imagemagick.texture_motion_blur

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • radius, sigma, angle [REAL]: effect params.

    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)
                


    gh_imagemagick.texture_gaussian_blur

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • radius, sigma [REAL]: effect params.

    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)
                


    gh_imagemagick.texture_emboss

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • radius, sigma [REAL]: effect params.

    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)
                


    gh_imagemagick.texture_edge

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • radius [REAL]: effect param.

    Return Values

    This function has no return value(s).

    Code sample

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


    gh_imagemagick.texture_charcoal

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • radius, sigma [REAL]: effect params.

    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)
                


    gh_imagemagick.texture_auto_level

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.

    Return Values

    This function has no return value(s).

    Code sample

    gh_imagemagick.texture_auto_level(texture_id)
    gh_imagemagick.texture_update(texture_id)
                


    gh_imagemagick.texture_sharpen

    Description

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

    Languages

    Lua - Python

    Parameters

  • tex_id [INTEGER]: texture identifier.
  • radius, sigma [REAL]: effect params.

    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