| 1 |
This directory includes example code for Imager. |
| 2 |
|
| 3 |
If you have sample code to contribute, please contact the maintainer. |
| 4 |
|
| 5 |
The notes here just provide a basic description and the functions |
| 6 |
used. |
| 7 |
|
| 8 |
anaglyph.pl |
| 9 |
|
| 10 |
Produce a color, grey or pure anaglyph image given left and right |
| 11 |
images of a stereoscopic pair. |
| 12 |
|
| 13 |
Uses transform2() and convert(). |
| 14 |
|
| 15 |
replace_color.pl |
| 16 |
|
| 17 |
Example using Imager::transform2() to replace one color with another |
| 18 |
in an image. |
| 19 |
|
| 20 |
http://www.perlmonks.org/?node_id=497355 |
| 21 |
|
| 22 |
inline_replace_color.pl |
| 23 |
|
| 24 |
Example using Inline::C and the Imager API to replace one color with |
| 25 |
another in an image. |
| 26 |
|
| 27 |
interleave.pl |
| 28 |
|
| 29 |
Produce an interleaved image given the left and right images of a |
| 30 |
stereoscopic pair. Note that the source images must be pre-scaled. |
| 31 |
|
| 32 |
This includes 3 different implementations, first using transform2(), |
| 33 |
the second using the internal i_copyto() function and the third using |
| 34 |
the internal i_glin() and i_plin() functions. |
| 35 |
|
| 36 |
samp-form.cgi |
| 37 |
samp-image.cgi |
| 38 |
|
| 39 |
Example that demonstrates generating an image linked from a HTML form. |
| 40 |
|
| 41 |
The POD for this sample discusses alternate approaches and security |
| 42 |
considerations. |
| 43 |
|
| 44 |
samp-scale.html |
| 45 |
samp-scale.cgi |
| 46 |
|
| 47 |
Example that demonstrates reading an image uploaded via a HTML form. |
| 48 |
|
| 49 |
Produces an output image scaled to fit inside 200x200. |
| 50 |
|
| 51 |
samp-tags.html |
| 52 |
samp-tags.cgi |
| 53 |
|
| 54 |
Example that demonstrates reading an image uploaded via a HTML form. |
| 55 |
|
| 56 |
Produces a text/plain report of the tags that Imager defined for the |
| 57 |
image. |
| 58 |
|
| 59 |
This and the previous sample are very similar, the intent is to show |
| 60 |
the common elements and to demonstrate that the output is independent |
| 61 |
of the input. |
| 62 |
|
| 63 |
See the section "Parsing an image posted via CGI" in Imager::Cookbook |
| 64 |
for cautions and details on reading uploaded images. |
| 65 |
|
| 66 |
border.pl |
| 67 |
|
| 68 |
Example of adding a border to an image. |
| 69 |
|
| 70 |
slant_text.pl |
| 71 |
|
| 72 |
Example of drawing transformed text. |
| 73 |
|
| 74 |
Draws slanted or rotated text to a new image and saves it to a file. |
| 75 |
|
| 76 |
As part of this it demonstrates calculating the transformed bounding |
| 77 |
box of the text. |
| 78 |
|
| 79 |
tk-photo.pl |
| 80 |
|
| 81 |
Simple example of making a Tk::Photo object using Imager data. |
| 82 |
|
| 83 |
align-string.pl |
| 84 |
|
| 85 |
Simple demonstration of the align_string() method. Usage: |
| 86 |
|
| 87 |
perl align-string.pl fontfile size outputfile text... |
| 88 |
|
| 89 |
eg. |
| 90 |
|
| 91 |
perl align-string.pl fontfiles/ImUgly.ttf 60 test.ppm .A. |
| 92 |
|
| 93 |
This demonstrates how the various values of halign and valign |
| 94 |
behave. |
| 95 |
|
| 96 |
inline_capture2image.pl |
| 97 |
|
| 98 |
Demonstrates using Inline and Imager's API to convert captured BGR |
| 99 |
image data into an Imager image. |
| 100 |
|
| 101 |
flasher.pl |
| 102 |
|
| 103 |
Animate an image fading down to a background color and back again. |
| 104 |
|
| 105 |
Demonstrates setting an alpha channel with convert(), rubthrough(), |
| 106 |
and writing animated GIFs. |
| 107 |
|
| 108 |
gifscale.pl |
| 109 |
|
| 110 |
Scales an animated GIF image, preserving GIF animation information |
| 111 |
and adjusting the image screen positions to account for the scale |
| 112 |
factor. |
| 113 |
|
| 114 |
quad_to_square.pl |
| 115 |
|
| 116 |
Sample from Richard Fairhurst demonstrating the use of the transform2() |
| 117 |
det() function. Transforms an arbitrary quadrilateral in the input into |
| 118 |
a square on the output. |
| 119 |
|
| 120 |
wiggle.pl |
| 121 |
|
| 122 |
Produce an animated GIF that blends back and forth between the two |
| 123 |
supplied images. If the input images form a stereo pair the GIF can |
| 124 |
be used for wiggle stereoscopy. |
| 125 |
|
| 126 |
drop_shadow.pl |
| 127 |
|
| 128 |
Produce a drop shadow based on the source image alpha channel. |