G'MIC - GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing
GREYC CNRS ENSICAEN UNICAEN

A Full-Featured Open-Source Framework for Image Processing



Latest stable version: 3.5.5        Current pre-release: 3.5.6 (2025/06/13)

Reference

Table of Contents  ▸  List of Commands  ▸  Image Drawing  ▸  pack_sprites◀  object3d    |    piechart  ▶

pack_sprites

Arguments:

Description:

Try to randomly pack as many sprites as possible onto the empty areas of an image.

Sprites can be eventually rotated and scaled during the packing process.
Selected image is the canvas that will be filled with the sprites.
The zero values of its alpha channel defines the potential locations for drawing the sprites.
[sprite_set] defines the set of sprites considered for filling the canvas.
The zero values of their alpha channels defines the sprite shape.
Sprite packing is done on random locations and iteratively with decreasing scales.
nb_scales sets the number of decreasing scales considered for all specified sprites to be packed.
min_scale (in %) sets the minimal size considered for packing (specified as a percentage of the
original sprite size).
spacing can be positive or negative.
max_attempts defines the maximum number of attempts to pack a sprite for each scale.

Default values:

nb_scales=1, min_scale=25, allow_rotation=0, spacing=1 and max_attempts=512.

Example of use:

shape_heart 512 negate normalize 0,255 channels -3,0 repeat 3 { ball 48,${-RGB} } pack_sprites[0] [^0],5,15

Command: shape_heart 512 negate normalize 0,255 channels -3,0 repeat 3 { ball 48,${-RGB} } pack_sprites[0] [^0],5,15
Command: shape_heart 512 negate normalize 0,255 channels -3,0 repeat 3 { ball 48,${-RGB} } pack_sprites[0] [^0],5,15
Command: shape_heart 512 negate normalize 0,255 channels -3,0 repeat 3 { ball 48,${-RGB} } pack_sprites[0] [^0],5,15
Command: shape_heart 512 negate normalize 0,255 channels -3,0 repeat 3 { ball 48,${-RGB} } pack_sprites[0] [^0],5,15
G'MIC - GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing

G'MIC is an open-source software distributed under the CeCILL free software licenses (LGPL-like and/or
GPL-compatible). Copyrights (C) Since July 2008, David Tschumperlé - GREYC UMR CNRS 6072, Image Team.