1Imager::ImageTypes(3) User Contributed Perl DocumentationImager::ImageTypes(3)
2
3
4
6 Imager::ImageTypes - image models for Imager
7
9 use Imager;
10
11 $img = Imager->new(); # Empty image (size is 0 by 0)
12 $img->open(file=>'lena.png',type=>'png'); # Read image from file
13
14 $img = Imager->new(xsize=>400, ysize=>300); # RGB data
15
16 $img = Imager->new(xsize=>400, ysize=>300, # Grayscale
17 channels=>1); #
18
19 $img = Imager->new(xsize=>400, ysize=>300, # RGB with alpha
20 channels=>4); #
21
22 $img = Imager->new(xsize=>200, ysize=>200,
23 type=>'paletted'); # paletted image
24
25 $img = Imager->new(xsize=>200, ysize=>200,
26 bits=>16); # 16 bits/channel rgb
27
28 $img = Imager->new(xsize=>200, ysize=>200,
29 bits=>'double'); # 'double' floating point
30 # per channel
31
32 $img->img_set(xsize=>500, ysize=>500, # reset the image object
33 channels=>4);
34
35 # Example getting information about an Imager object
36
37 print "Image information:\n";
38 print "Width: ", $img->getwidth(), "\n";
39 print "Height: ", $img->getheight(), "\n";
40 print "Channels: ", $img->getchannels(), "\n";
41 print "Bits/Channel: ", $img->bits(), "\n";
42 print "Virtual: ", $img->virtual() ? "Yes" : "No", "\n";
43 my $colorcount = $img->getcolorcount(maxcolors=>512);
44 print "Actual number of colors in image: ";
45 print defined($colorcount) ? $colorcount : ">512", "\n";
46 print "Type: ", $img->type(), "\n";
47
48 if ($img->type() eq 'direct') {
49 print "Modifiable Channels: ";
50 print join " ", map {
51 ($img->getmask() & 1<<$_) ? $_ : ()
52 } 0..$img->getchannels();
53 print "\n";
54
55 } else {
56 # palette info
57 my $count = $img->colorcount;
58 @colors = $img->getcolors();
59 print "Palette size: $count\n";
60 my $mx = @colors > 4 ? 4 : 0+@colors;
61 print "First $mx entries:\n";
62 for (@colors[0..$mx-1]) {
63 my @res = $_->rgba();
64 print "(", join(", ", @res[0..$img->getchannels()-1]), ")\n";
65 }
66 }
67
68 my @tags = $img->tags();
69 if (@tags) {
70 print "Tags:\n";
71 for(@tags) {
72 print shift @$_, ": ", join " ", @$_, "\n";
73 }
74 } else {
75 print "No tags in image\n";
76 }
77
79 Imager supports two basic models of image:
80
81 · direct color - all samples are stored for every pixel. eg. for an
82 8-bit/sample RGB image, 24 bits are stored for each pixel.
83
84 · paletted - an index into a table of colors is stored for each
85 pixel.
86
87 Direct color or paletted images can have 1 to 4 samples per color
88 stored. Imager treats these as follows:
89
90 · 1 sample per color - grayscale image.
91
92 · 2 samples per color - grayscale image with alpha channel.
93
94 · 3 samples per color - RGB image.
95
96 · 4 samples per color - RGB image with alpha channel.
97
98 Direct color images can have sample sizes of 8-bits per sample, 16-bits
99 per sample or a double precision floating point number per sample
100 (64-bits on many systems).
101
102 Paletted images are always 8-bits/sample.
103
104 To query an existing image about it's parameters see the "bits()",
105 "type()", "getwidth()", "getheight()", "getchannels()" and "virtual()"
106 methods.
107
108 The coordinate system in Imager has the origin in the upper left cor‐
109 ner, see Imager::Draw for details.
110
111 The alpha channel when one is present is considered unassociated - ie.
112 the color data has not been scaled by the alpha channel. Note that not
113 all code follows this (recent) rule, but will over time.
114
115 Creating Imager Objects
116
117 new
118 $img = Imager->new();
119 $img->read(file=>"alligator.ppm") or die $img->errstr;
120
121 Here "new()" creates an empty image with width and height of zero.
122 It's only useful for creating an Imager object to call the read()
123 method on later.
124
125 %opts = (xsize=>300, ysize=>200);
126 $img = Imager->new(%opts); # create direct mode RGBA image
127 $img = Imager->new(%opts, channels=>4); # create direct mode RGBA image
128
129 The parameters for new are:
130
131 * "xsize", "ysize" - Defines the width and height in pixels of
132 the image. These must be positive.
133
134 If not supplied then only placeholder object is created, which
135 can be supplied to the "read()" or "img_set()" methods.
136
137 * "channels" - The number of channels for the image. Default 3.
138 Valid values are from 1 to 4.
139
140 * "bits" - The storage type for samples in the image. Default:
141 8. Valid values are:
142
143 * 8 - One byte per sample. 256 discrete values.
144
145 * 16 - 16-bits per sample, 65536 discrete values.
146
147 * "double" - one C double per sample.
148
149 Note: you can use any Imager function on any sample size image.
150
151 Paletted images always use 8 bits/sample.
152
153 * "type" - either 'direct' or 'paletted'. Default: 'direct'.
154
155 Direct images store color values for each pixel.
156
157 Paletted images keep a table of up to 256 colors called the
158 palette, each pixel is represented as an index into that table.
159
160 In most cases when working with Imager you will want to use the
161 "direct" image type.
162
163 If you draw on a "paletted" image with a color not in the
164 image's palette then Imager will transparently convert it to a
165 "direct" image.
166
167 * "maxcolors" - the maximum number of colors in a paletted image.
168 Default: 256. This must be in the range 1 through 256.
169
170 In the simplest case just supply the width and height of the image:
171
172 # 8 bit/sample, RGB image
173 my $img = Imager->new(xsize => $width, ysize => $height);
174
175 or if you want an alpha channel:
176
177 # 8 bits/sample, RGBA image
178 my $img = Imager->new(xsize => $width, ysize => $height, channels=>4);
179
180 Note that it is possible for image creation to fail, for example if
181 channels is out of range, or if the image would take too much mem‐
182 ory.
183
184 To create paletted images, set the 'type' parameter to 'paletted':
185
186 $img = Imager->new(xsize=>200, ysize=>200, type=>'paletted');
187
188 which creates an image with a maxiumum of 256 colors, which you can
189 change by supplying the "maxcolors" parameter.
190
191 For improved color precision you can use the bits parameter to
192 specify 16 bit per channel:
193
194 $img = Imager->new(xsize=>200, ysize=>200,
195 channels=>3, bits=>16);
196
197 or for even more precision:
198
199 $img = Imager->new(xsize=>200, ysize=>200,
200 channels=>3, bits=>'double');
201
202 to get an image that uses a double for each channel.
203
204 Note that as of this writing all functions should work on images
205 with more than 8-bits/channel, but many will only work at only
206 8-bit/channel precision.
207
208 If you want an empty Imager object to call the read() method on,
209 just call new() with no parameters:
210
211 my $img = Imager->new;
212 $img->read(file=>$filename)
213 or die $img->errstr;
214
215 img_set
216 img_set destroys the image data in the object and creates a new one
217 with the given dimensions and channels. For a way to convert image
218 data between formats see the "convert()" method.
219
220 $img->img_set(xsize=>500, ysize=>500, channels=>4);
221
222 This takes exactly the same parameters as the new() method.
223
224 Image Attribute functions
225
226 These return basic attributes of an image object.
227
228 getwidth
229 print "Image width: ", $img->getwidth(), "\n";
230
231 The "getwidth()" method returns the width of the image. This value
232 comes either from "new()" with xsize,ysize parameters or from read‐
233 ing data from a file with "read()". If called on an image that has
234 no valid data in it like "Imager->new()" returns, the return value
235 of "getwidth()" is undef.
236
237 getheight
238 print "Image height: ", $img->getheight(), "\n";
239
240 Same details apply as for getwidth.
241
242 getchannels
243 print "Image has ",$img->getchannels(), " channels\n";
244
245 To get the number of channels in an image "getchannels()" is used.
246
247 bits
248 The bits() method retrieves the number of bits used to represent
249 each channel in a pixel, 8 for a normal image, 16 for 16-bit image
250 and 'double' for a double/channel image.
251
252 if ($img->bits eq 8) {
253 # fast but limited to 8-bits/sample
254 }
255 else {
256 # slower but more precise
257 }
258
259 type
260 The type() method returns either 'direct' for truecolor images or
261 'paletted' for paletted images.
262
263 if ($img->type eq 'paletted') {
264 # print the palette
265 for my $color ($img->getcolors) {
266 print join(",", $color->rgba), "\n";
267 }
268 }
269
270 virtual
271 The virtual() method returns non-zero if the image contains no
272 actual pixels, for example masked images.
273
274 This may also be used for non-native Imager images in the future,
275 for example, for an Imager object that draws on an SDL surface.
276
277 is_bilevel
278 Tests if the image will be written as a monochrome or bi-level
279 image for formats that support that image organization.
280
281 In scalar context, returns true if the image is bi-level.
282
283 In list context returns a list:
284
285 ($is_bilevel, $zero_is_white) = $img->is_bilevel;
286
287 An image is considered bi-level, if all of the following are true:
288
289 * the image is a paletted image
290
291 * the image has 1 or 3 channels
292
293 * the image has only 2 colors in the palette
294
295 * those 2 colors are black and white, in either order.
296
297 If a real bi-level organization image is ever added to Imager, this
298 function will return true for that too.
299
300 Direct Type Images
301
302 Direct images store the color value directly for each pixel in the
303 image.
304
305 getmask
306 @rgbanames = qw( red green blue alpha );
307 my $mask = $img->getmask();
308 print "Modifiable channels:\n";
309 for (0..$img->getchannels()-1) {
310 print $rgbanames[$_],"\n" if $mask & 1<<$_;
311 }
312
313 "getmask()" is used to fetch the current channel mask. The mask
314 determines what channels are currently modifiable in the image.
315 The channel mask is an integer value, if the i-th lsb is set the
316 i-th channel is modifiable. eg. a channel mask of 0x5 means only
317 channels 0 and 2 are writable.
318
319 setmask
320 $mask = $img->getmask();
321 $img->setmask(mask=>8); # modify alpha only
322
323 ...
324
325 $img->setmask(mask=>$mask); # restore previous mask
326
327 "setmask()" is used to set the channel mask of the image. See get‐
328 mask for details.
329
330 Palette Type Images
331
332 Paletted images keep an array of up to 256 colors, and each pixel is
333 stored as an index into that array.
334
335 In general you can work with paletted images in the same way as RGB
336 images, except that if you attempt to draw to a paletted image with a
337 color that is not in the image's palette, the image will be converted
338 to an RGB image. This means that drawing on a paletted image with
339 anti-aliasing enabled will almost certainly convert the image to RGB.
340
341 Palette management takes place through "addcolors()", "setcolors()",
342 "getcolors()" and "findcolor()":
343
344 addcolors
345 You can add colors to a paletted image with the addcolors() method:
346
347 my @colors = ( Imager::Color->new(255, 0, 0),
348 Imager::Color->new(0, 255, 0) );
349 my $index = $img->addcolors(colors=>\@colors);
350
351 The return value is the index of the first color added, or undef if
352 adding the colors would overflow the palette.
353
354 The only parameter is "colors" which must be a reference to an
355 array of Imager::Color objects.
356
357 setcolors
358 $img->setcolors(start=>$start, colors=>\@colors);
359
360 Once you have colors in the palette you can overwrite them with the
361 "setcolors()" method: "setcolors()" returns true on success.
362
363 Parameters:
364
365 * start - the first index to be set. Default: 0
366
367 * colors - reference to an array of Imager::Color objects.
368
369 getcolors
370 To retrieve existing colors from the palette use the getcolors()
371 method:
372
373 # get the whole palette
374 my @colors = $img->getcolors();
375 # get a single color
376 my $color = $img->getcolors(start=>$index);
377 # get a range of colors
378 my @colors = $img->getcolors(start=>$index, count=>$count);
379
380 findcolor
381 To quickly find a color in the palette use findcolor():
382
383 my $index = $img->findcolor(color=>$color);
384
385 which returns undef on failure, or the index of the color.
386
387 Parameter:
388
389 * color - an Imager::Color object.
390
391 colorcount
392 Returns the number of colors in the image's palette:
393
394 my $count = $img->colorcount;
395
396 maxcolors
397 Returns the maximum size of the image's palette.
398
399 my $maxcount = $img->maxcolors;
400
401 Color Distribution
402
403 getcolorcount
404 Calculates the number of colors in an image.
405
406 The amount of memory used by this is proportional to the number of
407 colors present in the image, so to avoid using too much memory you
408 can supply a maxcolors parameter to limit the memory used.
409
410 Note: getcolorcount() treats the image as an 8-bit per sample
411 image.
412
413 * maxcolors - the maximum number of colors to return. Default:
414 unlimited.
415
416 if (defined($img->getcolorcount(maxcolors=>512)) {
417 print "Less than 512 colors in image\n";
418 }
419
420 getcolorusagehash
421 Calculates a histogram of colors used by the image.
422
423 * maxcolors - the maximum number of colors to return. Default:
424 unlimited.
425
426 Returns a reference to a hash where the keys are the raw color as
427 bytes, and the values are the counts for that color.
428
429 The alpha channel of the image is ignored. If the image is
430 grayscale then the hash keys will each be a single character.
431
432 my $colors = $img->getcolorusagehash;
433 my $blue_count = $colors->{pack("CCC", 0, 0, 255)} ⎪⎪ 0;
434 print "#0000FF used $blue_count times\n";
435
436 getcolorusage
437 Calculates color usage counts and returns just the counts.
438
439 * maxcolors - the maximum number of colors to return. Default:
440 unlimited.
441
442 Returns a list of the color frequencies in ascending order.
443
444 my @counts = $img->getcolorusage;
445 print "The most common color is used $counts[0] times\n";
446
447 Conversion Between Image Types
448
449 Warning: if you draw on a paletted image with colors that aren't in the
450 palette, the image will be internally converted to a normal image.
451
452 to_paletted
453 You can create a new paletted image from an existing image using
454 the to_paletted() method:
455
456 $palimg = $img->to_paletted(\%opts)
457
458 where %opts contains the options specified under "Quantization
459 options".
460
461 # convert to a paletted image using the web palette
462 # use the closest color to each pixel
463 my $webimg = $img->to_paletted({ make_colors => 'webmap' });
464
465 # convert to a paletted image using a fairly optimal palette
466 # use an error diffusion dither to try to reduce the average error
467 my $optimag = $img->to_paletted({ make_colors => 'mediancut',
468 translate => 'errdiff' });
469
470 to_rgb8
471 You can convert a paletted image (or any image) to an 8-bit/channel
472 RGB image with:
473
474 $rgbimg = $img->to_rgb8;
475
476 No parameters.
477
478 to_rgb16
479 You can convert a paletted image (or any image) to an 16-bit/chan‐
480 nel RGB image with:
481
482 $rgbimg = $img->to_rgb16;
483
484 No parameters.
485
486 masked
487 Creates a masked image. A masked image lets you create an image
488 proxy object that protects parts of the underlying target image.
489
490 In the discussion below there are 3 image objects involved:
491
492 * the masked image - the return value of the masked() method.
493 Any writes to this image are written to the target image,
494 assuming the mask image allows it.
495
496 * the mask image - the image that protects writes to the target
497 image. Supplied as the "mask" parameter to the masked()
498 method.
499
500 * the target image - the image you called the masked() method on.
501 Any writes to the masked image end up on this image.
502
503 Parameters:
504
505 * mask - the mask image. If not supplied then all pixels in the
506 target image are writable. On each write to the masked image,
507 only pixels that have non-zero in chennel 0 of the mask image
508 will be written to the original image. Default: none, if not
509 supplied then no masking is done, but the other parameters are
510 still honored.
511
512 * left, top - the offset of writes to the target image. eg. if
513 you attempt to set pixel (x,y) in the masked image, then pixel
514 (x+left, y+top) will be written to in the original image.
515
516 * bottom, right - the bottom right of the area in the target
517 available from the masked image.
518
519 Masked images let you control which pixels are modified in an
520 underlying image. Where the first channel is completely black in
521 the mask image, writes to the underlying image are ignored.
522
523 For example, given a base image called $img:
524
525 my $mask = Imager->new(xsize=>$img->getwidth, ysize=>$img->getheight,
526 channels=>1);
527 # ... draw something on the mask
528 my $maskedimg = $img->masked(mask=>$mask);
529
530 # now draw on $maskedimg and it will only draw on areas of $img
531 # where $mask is non-zero in channel 0.
532
533 You can specifiy the region of the underlying image that is masked
534 using the left, top, right and bottom options.
535
536 If you just want a subset of the image, without masking, just spec‐
537 ify the region without specifying a mask. For example:
538
539 # just work with a 100x100 region of $img
540 my $maskedimg = $img->masked(left => 100, top=>100,
541 right=>200, bottom=>200);
542
543 Tags
544
545 Image tags contain meta-data about the image, ie. information not
546 stored as pixels of the image.
547
548 At the perl level each tag has a name or code and a value, which is an
549 integer or an arbitrary string. An image can contain more than one tag
550 with the same name or code, but having more than one tag with the same
551 name is discouraged.
552
553 You can retrieve tags from an image using the tags() method, you can
554 get all of the tags in an image, as a list of array references, with
555 the code or name of the tag followed by the value of the tag.
556
557 tags
558 Retrieve tags from the image.
559
560 With no parameters, retrieves a list array references, each con‐
561 taining a name and value: all tags in the image:
562
563 # get a list of ( [ name1 => value1 ], [ name2 => value2 ] ... )
564 my @alltags = $img->tags;
565 print $_->[0], ":", $_->[1], "\n" for @all_tags;
566
567 # or put it in a hash, but this will lose duplicates
568 my %alltags = map @$_, $img->tags;
569
570 in scalar context this returns the number of tags:
571
572 my $num_tags = $img->tags;
573
574 or you can get all tags values for the given name:
575
576 my @namedtags = $img->tags(name => $name);
577
578 in scalar context this returns the first tag of that name:
579
580 my $firstnamed = $img->tags(name => $name);
581
582 or a given code:
583
584 my @tags = $img->tags(code=>$code);
585
586 addtag
587 You can add tags using the addtag() method, either by name:
588
589 my $index = $img->addtag(name=>$name, value=>$value);
590
591 or by code:
592
593 my $index = $img->addtag(code=>$code, value=>$value);
594
595 deltag
596 You can remove tags with the deltag() method, either by index:
597
598 $img->deltag(index=>$index);
599
600 or by name:
601
602 $img->deltag(name=>$name);
603
604 or by code:
605
606 $img->deltag(code=>$code);
607
608 In each case deltag() returns the number of tags deleted.
609
610 settag
611 settag() replaces any existing tags with a new tag. This is equiv‐
612 alent to calling deltag() then addtag().
613
614 Common Tags
615
616 Many tags are only meaningful for one format. GIF looping information
617 is pretty useless for JPEG for example. Thus, many tags are set by
618 only a single reader or used by a single writer. For a complete list
619 of format specific tags see Imager::Files.
620
621 Since tags are a relatively new addition their use is not wide spread
622 but eventually we hope to have all the readers for various formats set
623 some standard information.
624
625 · i_xres, i_yres - The spatial resolution of the image in pixels per
626 inch. If the image format uses a different scale, eg. pixels per
627 meter, then this value is converted. A floating point number
628 stored as a string.
629
630 # our image was generated as a 300 dpi image
631 $img->settag(name => 'i_xres', value => 300);
632 $img->settag(name => 'i_yres', value => 300);
633
634 # 100 pixel/cm for a TIFF image
635 $img->settag(name => 'tiff_resolutionunit', value => 3); # RESUNIT_CENTIMETER
636 # convert to pixels per inch, Imager will convert it back
637 $img->settag(name => 'i_xres', value => 100 * 2.54);
638 $img->settag(name => 'i_yres', value => 100 * 2.54);
639
640 · i_aspect_only - If this is non-zero then the values in i_xres and
641 i_yres are treated as a ratio only. If the image format does not
642 support aspect ratios then this is scaled so the smaller value is
643 72dpi.
644
645 · i_incomplete - If this tag is present then the whole image could
646 not be read. This isn't implemented for all images yet, and may
647 not be.
648
649 · i_lines_read - If "i_incomplete" is set then this tag may be set to
650 the number of scanlines successfully read from the file. This can
651 be used to decide whether an image is worth processing.
652
653 · i_format - The file format this file was read from.
654
655 · i_background - used when writing an image with an alpha channel to
656 a file format that doesn't support alpha channels. The "write"
657 method will convert a normal color specification like "#FF0000"
658 into a color object for you, but if you set this as a tag you will
659 need to format it like "color("red","green","blue")", eg
660 color(255,0,0).
661
662 Quantization options
663
664 These options can be specified when calling "to_paletted" in
665 Imager::ImageTypes, write_multi() for gif files, when writing a single
666 image with the gifquant option set to 'gen', or for direct calls to
667 i_writegif_gen and i_writegif_callback.
668
669 colors
670 A arrayref of colors that are fixed. Note that some color genera‐
671 tors will ignore this.
672
673 transp
674 The type of transparency processing to perform for images with an
675 alpha channel where the output format does not have a proper alpha
676 channel (eg. gif). This can be any of:
677
678 none
679 No transparency processing is done. (default)
680
681 threshold
682 Pixels more transparent that tr_threshold are rendered as
683 transparent.
684
685 errdiff
686 An error diffusion dither is done on the alpha channel. Note
687 that this is independent of the translation performed on the
688 colour channels, so some combinations may cause undesired arti‐
689 facts.
690
691 ordered
692 The ordered dither specified by tr_orddith is performed on the
693 alpha channel.
694
695 This will only be used if the image has an alpha channel, and if
696 there is space in the palette for a transparency colour.
697
698 tr_threshold
699 The highest alpha value at which a pixel will be made transparent
700 when transp is 'threshold'. (0-255, default 127)
701
702 tr_errdiff
703 The type of error diffusion to perform on the alpha channel when
704 transp is 'errdiff'. This can be any defined error diffusion type
705 except for custom (see errdiff below).
706
707 tr_orddith
708 The type of ordered dither to perform on the alpha channel when
709 transp is 'ordered'. Possible values are:
710
711 random
712 A semi-random map is used. The map is the same each time.
713
714 dot8
715 8x8 dot dither.
716
717 dot4
718 4x4 dot dither
719
720 hline
721 horizontal line dither.
722
723 vline
724 vertical line dither.
725
726 "/line"
727 slashline
728 diagonal line dither
729
730 '\line'
731 backline
732 diagonal line dither
733
734 tiny
735 dot matrix dither (currently the default). This is probably
736 the best for displays (like web pages).
737
738 custom
739 A custom dither matrix is used - see tr_map
740
741 tr_map
742 When tr_orddith is custom this defines an 8 x 8 matrix of integers
743 representing the transparency threshold for pixels corresponding to
744 each position. This should be a 64 element array where the first 8
745 entries correspond to the first row of the matrix. Values should
746 be betweern 0 and 255.
747
748 make_colors
749 Defines how the quantization engine will build the palette(s).
750 Currently this is ignored if 'translate' is 'giflib', but that may
751 change. Possible values are:
752
753 * none - only colors supplied in 'colors' are used.
754
755 * webmap - the web color map is used (need url here.)
756
757 * addi - The original code for generating the color map (Addi's
758 code) is used.
759
760 * mediancut - Uses a mediancut algorithm, faster than 'addi', but
761 not as good a result.
762
763 * mono, monochrome - a fixed black and white palette, suitable
764 for producing bi-level images (eg. facsimile)
765
766 Other methods may be added in the future.
767
768 colors
769 A arrayref containing Imager::Color objects, which represents the
770 starting set of colors to use in translating the images. webmap
771 will ignore this. The final colors used are copied back into this
772 array (which is expanded if necessary.)
773
774 max_colors
775 The maximum number of colors to use in the image.
776
777 translate
778 The method used to translate the RGB values in the source image
779 into the colors selected by make_colors. Note that make_colors is
780 ignored whene translate is 'giflib'.
781
782 Possible values are:
783
784 giflib
785 The giflib native quantization function is used.
786
787 closest
788 The closest color available is used.
789
790 perturb
791 The pixel color is modified by perturb, and the closest color
792 is chosen.
793
794 errdiff
795 An error diffusion dither is performed.
796
797 It's possible other transate values will be added.
798
799 errdiff
800 The type of error diffusion dither to perform. These values
801 (except for custom) can also be used in tr_errdif.
802
803 floyd
804 Floyd-Steinberg dither
805
806 jarvis
807 Jarvis, Judice and Ninke dither
808
809 stucki
810 Stucki dither
811
812 custom
813 Custom. If you use this you must also set errdiff_width,
814 errdiff_height and errdiff_map.
815
816 errdiff_width
817 errdiff_height
818 errdiff_orig
819 errdiff_map
820 When translate is 'errdiff' and errdiff is 'custom' these define a
821 custom error diffusion map. errdiff_width and errdiff_height
822 define the size of the map in the arrayref in errdiff_map.
823 errdiff_orig is an integer which indicates the current pixel posi‐
824 tion in the top row of the map.
825
826 perturb
827 When translate is 'perturb' this is the magnitude of the random
828 bias applied to each channel of the pixel before it is looked up in
829 the color table.
830
832 This documents the Imager initialization function, which you will
833 almost never need to call.
834
835 init
836 This is a function, not a method.
837
838 This function is a mess, it can take the following named parame‐
839 ters:
840
841 * log - name of a log file to log Imager's actions to. Not all
842 actions are logged, but the debugging memory allocator does log
843 allocations here. Ignored if Imager has been built without
844 logging support.
845
846 * loglevel - the maximum level of message to log. Default: 1.
847
848 * warn_obsolete - if this is non-zero then Imager will warn when
849 you attempt to use obsoleted parameters or functionality. This
850 currently only includes the old gif output options instead of
851 tags.
852
853 * t1log - if non-zero then T1lib will be configured to produce a
854 log file. This will fail if there are any existing T1lib font
855 objects.
856
857 Example:
858
859 Imager::init(log => 'trace.log', loglevel => 9);
860
862 $Revision: 1435 $
863
865 Tony Cook, Arnar M. Hrafnkelsson
866
868 Imager(3), Imager::Files(3), Imager::Draw(3), Imager::Color(3),
869 Imager::Fill(3), Imager::Font(3), Imager::Transformations(3),
870 Imager::Engines(3), Imager::Filters(3), Imager::Expr(3),
871 Imager::Matrix2d(3), Imager::Fountain(3)
872
873
874
875perl v5.8.8 2008-03-28 Imager::ImageTypes(3)