1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888
|
\title{Perl API Methods}
\toctitle{Perl API Methods}
\titlerunning{Perl API Methods}
\maketitle
\section{Image::Magick Attributes}
\label{Image::Magick Attributes}
An image has certain attributes associated with it such as width,
height, number of colors in the colormap, page geometry, and others.
Many of the image methods allow you to set relevant attributes directly
in the method call, or you can use Set(), as in:
{\small
\begin{verbatim}
$image->Set(loop=>100);
$image->[$x]->Set(dither=>1);
\end{verbatim}
}
To get an imageattribute, use Get():
{\small
\begin{verbatim}
($width, $height, $depth) = $image->Get('width', 'height', 'depth');
$colors = $image->[2]->Get('colors');
\end{verbatim}
}
The methods GetAttribute() and SetAttribute() are aliases for Get() and
Set() and may be used interchangeably.
Following is a list of image attributes acceptable to either Set() or
Get() as noted.
\subsubsection{adjoin}
join images into a single multi-image file.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(adjoin=$>$\var{boolean}) \\
\hspace*{-0.25in}
\$image-$>$Get('adjoin')
\end{quote}
Certain file formats accept multiple images within a single file (e.g.
a GIF animation). If \texttt{adjoin} is value other than 0 and the image is a
multi-image format, multiple reads to the same image object will join the
images into a single file when you call the Write() method. Set
\texttt{adjoin} to 0 if you do not want the images output to a single file.
\subsubsection{antialias}
remove pixel aliasing.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(antialias=$>$\var{boolean}) \\
\hspace*{-0.25in}
\$image-$>$Get('antialias')
\end{quote}
The visible effect of antialias is to blend the edges of any text or
graphics with the image background. This attribute affects how text and
graphics are rendered when certain image formats are read (e.g.
Postscript or SVG) or when certain Image::Magick methods are called
(e.g. Annotate() or Draw()).
\subsubsection{background}
image background color.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(background=$>$\var{color-name}) \\
\hspace*{-0.25in}
\$image-$>$Get('background')
\end{quote}
This attribute sets (or gets) the background color of an image. Image formats
such as GIF, PICT, PNG, and WMF retain the background color information.
\subsubsection{base-filename}
base image filename (before transformations).
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('base-filename'')
\end{quote}
The original filename is returned as a string.
\subsubsection{base-height}
base image height (before transformations).
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('base-height')
\end{quote}
This attribute returns the original height of image before any
resizing operation.
\subsubsection{base-width}
base image width (before transformations).
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('base-width')
\end{quote}
This attribute returns the original width of image before any
resizing operation.
\subsubsection{blue-primary}
chromaticity blue primary point.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(blue-primary=$>$\var{x-value},\var{y-value}) \\
\hspace*{-0.25in}
\$image-$>$Get('blue-primary')
\end{quote}
This attribute sets or returns the chromaticity blue primary point. This is
a color management option.
\subsubsection{cache-threshold}
cache threshold.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(cache-threshold=$>$\var{integer}) \\
\hspace*{-0.25in}
\$image-$>$Get('cache-threshold')
\end{quote}
Image pixels are stored in your computer's memory until it has been
consumed or the cache threshold is exceeded. Subsequent pixel operations
are cached to disk. Operations to memory are significantly faster,
but if your computer does not have a sufficient amount of free memory
to read or transform an image, you may need to set this threshold to a
small megabyte value (e.g. 32). Use 0 to cache all images to disk.
\subsubsection{class}
image class.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('class')
\end{quote}
A \texttt{Direct} class image is a continuous tone image and is stored
as a sequence of red-green-blue and optional opacity intensity values.
A \texttt{Pseudo} class image is an image with a colormap, where the
image is stored as a map of colors and a sequence of indexes into the map.
\subsubsection{clip-mask}
associate a clip mask with the image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set('clip-mask'=$>$\var{image}) \\
\$image-$>$Get('clip-mask') \\
\end{quote}
\texttt{Clip-mask} associates a clip mask with the image.
\subsubsection{colormap}
color of a particular colormap entry.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set('colormap[\var{\$i}]'=$>$\var{color-name}) \\
\hspace*{-0.25in}
\$image-$>$Get('colormap[\var{\$i}]')
\end{quote}
This attribute returns the red, green, blue, and opacity values
at colormap position \var{\$i}. You can set the color with a
colorname (e.g. red) or color hex value (e.g. \#ccbdbd).
\subsubsection{colors}
number of distinct colors in the image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('colors')
\end{quote}
This attribute returns the number of distinct colors in the image.
\subsubsection{comment}
image comment.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('comment')
\end{quote}
Return the image comment.
\subsubsection{compression}
type of compression.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(compression=$>$\var{string}) \\
\hspace*{-0.25in}
\$image-$>$Get('compression')
\end{quote}
\texttt{Compression} defaults to the compression type of the image when it was
first read. The value of \texttt{compression} can be one of the following:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> None \> BZip \> Fax \\
\> Group4 \> JPEG \> LosslessJPEG \\
\> LZW \> RLE \> Zip
\end{tabbing}
If you set a compression type that is incompatible with the output file type,
a compatible compression value is used instead (e.g. a PNG image ignores
a \texttt{compression} value of JPEG and saves with Zip compression).
\subsubsection{delay}
interframe delay.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(delay=$>$\var{integer}) \\
\hspace*{-0.25in}
\$image-$>$Get('delay')
\end{quote}
\texttt{Delay} regulates the playback speed of a sequence of images. The
value is the number of hundredths of a second that must pass before
displaying the next image. The default is 0 which means there is no delay
and the animation will play as fast as possible.
\subsubsection{density}
image resolution.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(density=$>$\var{geometry}) \\
\hspace*{-0.25in}
\$image-$>$Get('density')
\end{quote}
This attribute to set the horizontal and vertical resolution of an
image. Use attribute \texttt{units} to define the units of resolution.
The default is 72 dots-per-inch.
\subsubsection{depth}
color component depth.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('depth')
\end{quote}
Return the color component depth of the image, either 8 or 16. A depth
of 8 represents color component values from 0 to 255 while a depth of
16 represents values from 0 to 65535.
\subsubsection{directory}
thumbnail names of an image montage.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('directory')
\end{quote}
A montage is one or more image thumbnails regularly spaced across a
color or textured background created by the Montage() method or
\textit{montage} program. \texttt{Directory} returns the filenames
associated with each thumbnail.
\subsubsection{dispose}
GIF disposal method.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(dispose=$>$\var{0, 1, 2, 3}) \\
\hspace*{-0.25in}
\$image-$>$Get('dispose')
\end{quote}
The \texttt{dispose} attribute sets the GIF disposal method that defines how
an image is refreshed when flipping between scenes in a sequence. The
disposal methods are defined as:
\begin{tabbing}
0000\=1111111111\=222222222222222\kill
\> 0 \> replace one full-size, non-transparent frame with another\\
\> 1 \> any pixels not covered up by the next frame continue to display\\
\> 2 \> background color or background tile shows through transparent pixels\\
\> 3 \> restore to the state of a previous, undisposed frame
\end{tabbing}
\subsubsection{dither}
apply dithering to the image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(dither=$>$\var{boolean}) \\
\hspace*{-0.25in}
\$image-$>$Get('dither')
\end{quote}
Color reduction is performed implicitly when an image is converted from
a file format that allows many colors to one that allows fewer
(e.g. JPEG to GIF). Dithering helps smooth out the apparent contours
produced when sharply reducing colors. The default is to dither an image
during color reduction.
\subsubsection{error}
mean error per pixel.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('error')
\end{quote}
This value reflects the mean error per pixel introduced when reducing the
number of colors in an image either implicitedly or explicitly:
\begin{enumerate}
\item Explicitly, when you use the Quantize() method.
\item Implicitly, when an image is converted from a file format that
allows many colors to one that allows fewer (e.g. JPEG to GIF).
\end{enumerate}
The mean error gives one measure of how well the color reduction
algorithm performed and how similiar the color reduced image is to the
original.
\subsubsection{file}
Perl filehandle.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(file=$>$\var{filehandle}) \\
\hspace*{-0.25in}
\$image-$>$Get('file')
\end{quote}
The Read() and Write() methods accept an already opened Perl filehandle
and the image is read or written directly from or to the specified filehandle.
\subsubsection{filename}
filename of image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(filename=$>$\var{string}) \\
\hspace*{-0.25in}
\$image-$>$Get('filename')
\end{quote}
The default filename is the name of the file from which the image was read.
Write() accepts a filename as a parameter, however, if you do not specify one,
it uses the name defined by the \texttt{filename} attribute. For example:
{\small
\begin{verbatim}
$image->Read('logo.gif');
$image->Write(); # write image as logo.gif
$image->Set(filename=>'logo.png');
$image->Write(); # write image as logo.png
\end{verbatim}
}
\subsubsection{filesize}
size of file in bytes.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('filesize')
\end{quote}
Returns the number of bytes the image consumes in memory or on disk.
\subsubsection{font}
text font.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(font=$>$\var{string}) \\
\hspace*{-0.25in}
\$image-$>$Get('font')
\end{quote}
Both Annotate() and Draw() require a font to render text to an image.
A font can be Truetype (Arial.ttf), Postscript (Helvetica), or a
fully-qualified X11 font (-*-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-*)
name.
\subsubsection{format}
descriptive image format.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('format')
\end{quote}
Attribute \texttt{magick} returns the abbreviated image format (e.g. JPEG)
while \texttt{format} returns more descriptive text about the format
(e.g. Joint Photographic Experts Group JFIF format).
\subsubsection{fuzz}
close colors are treated as equal.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(fuzz=$>$\var{integer}) \\
\hspace*{-0.25in}
\$image-$>$Get('fuzz')
\end{quote}
A number of image methods (e.g. ColorFloodfill()) compare a target color to a
color within the image. By default these colors must match exactly. However,
in many cases two colors may differ by a small amount. \texttt{Fuzz} defines
how much tolerance is acceptable to consider two different colors as the same.
For example, set \texttt{fuzz} to 10 and the color red at intensities of 100
and 102 respectively are now interpreted as the same color.
\subsubsection{gamma}
image gamma.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(gamma=$>$\var{float}) \\
\hspace*{-0.25in}
\$image-$>$Get('gamma')
\end{quote}
Set or return the image gamma value. Unlike Gamma() that actually
applies the gamma value to the image pixels, here we just set the
value. This is useful if the correct gamma is already known about a
particular image.
\subsubsection{geometry}
shortcut for specifying width and height.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(geometry=$>$\var{geometry}) \\
\hspace*{-0.25in}
\$image-$>$Get('geometry')
\end{quote}
The \texttt{geometry} attribute is a convenient way to specify the width,
height, and any offset of an image region as a single string. For example,
{\small
\begin{verbatim}
geometry=>'640x80'
\end{verbatim}
}
is equivalent to:
{\small
\begin{verbatim}
width=>640, height=>480
\end{verbatim}
}
To refer to a 20 x 20 region of pixels starting at coordinate (100, 150),
use:
{\small
\begin{verbatim}
geometry=>'20x20+100+150'
\end{verbatim}
}
\subsubsection{gravity}
type of gravity.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(gravity=$>$\var{string}) \\
\hspace*{-0.25in}
\$image-$>$Get('gravity')
\end{quote}
\texttt{Gravity} defaults to NorthWest. The value of
\texttt{gravity} can be one of the following:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> NorthWest \> North \> NorthEast \\
\> West \> Center \> East \\
\> SouthWest \> South \> SouthEast
\end{tabbing}
\subsubsection{green-primary}
chromaticity green primary point.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(green-primary=$>$\var{x-value},\var{y-value}) \\
\hspace*{-0.25in}
\$image-$>$Get('green-primary')
\end{quote}
This attribute sets or returns the chromaticity green primary point. This is
a color management option.
\subsubsection{height}
image height.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('height')
\end{quote}
This attribute returns the height (in pixel rows) of the image.
\subsubsection{index}
colormap index at a particular pixel location.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set('index[\var{\$x, \$y}]'=$>$\var{color-name}) \\
\hspace*{-0.25in}
\$image-$>$Get('index[\var{\$x, \$y}]')
\end{quote}
This attribute sets or returns the colormap index at position
(\var{\$x, \$y}). The result is undefined if the image does not have a
colormap or the specified location lies outside the the image area.
\subsubsection{ICM}
color information profile.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('ICM')
\end{quote}
This attribute returns the color information profile.
\subsubsection{id}
ImageMagick registry ID.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('id')
\end{quote}
This attribute returns the ImageMagick registry ID. The registry allows
for persistent images that can later be referenced as a filename (e.g.
\texttt{registry:0xbd}).
\subsubsection{interlace}
type of interlacing scheme.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(interlace=$>$\var{string}) \\
\hspace*{-0.25in}
\$image-$>$Get('interlace')
\end{quote}
The \texttt{interlace} attribute allows you to specify the interlacing
scheme used by certain image formats such as GIF, JPEG, RGB, and CMYK.
The default is \texttt{None} but can be any of the following:
\begin{tabbing}
0000\=1111111111\=222222222222222\kill
\> None \> no interlacing \\
\> Line \> scanline interlacing \\
\> Plane \> plane interlacing \\
\> Partition \> partition interlacing
\end{tabbing}
\subsubsection{IPTC}
newswire information profile.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('IPTC')
\end{quote}
This attribute returns the newswire information profile.
\subsubsection{label}
image label.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(label=$>$\var{string}) \\
\hspace*{-0.25in}
\$image-$>$Get('label')
\end{quote}
Use labels to optionally annotate a Postscript or PDF image or the thumbnail
images of a montage created by the Montage() method or \textit{montage} program.
A label can include any of the special formatting characters described in the
Comment() method description.
\subsubsection{loop}
add loop extension to your image sequence.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(loop=$>$\var{integer}) \\
\hspace*{-0.25in}
\$image-$>$Get('loop')
\end{quote}
The \texttt{loop} attribute adds the Netscape looping extension to an image
sequence. A value of 0 causes the animation sequence to loop continuously.
Any other value results in the animation being repeated for the specified
number of times. The default value is 1.
\subsubsection{magick}
image file format.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(magick=$>$\var{string}) \\
\hspace*{-0.25in}
\$image-$>$Get('magick')
\end{quote}
The default image format is whatever format the image was in when it
was read. Write() accepts an image format as a parameter, however, if you
do not specify one, it uses the format defined by the \texttt{magick}
attribute. For example:
{\small
\begin{verbatim}
$image->Read('logo.gif');
$image->Write(); # write image as GIF
$image->Set(magick=>'PNG');
$image->Write(); # write image as PNG
\end{verbatim}
}
\subsubsection{matte}
transparency boolean.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(matte=$>$\var{boolean}) \\
\hspace*{-0.25in}
\$image-$>$Get('matte')
\end{quote}
Some images have a transparency mask associated with each pixel ranging
from opaque (pixel obscures background) to fully transparent (background
shows thru). The transparency mask, if it exists, is ignored if
the \texttt{matte} attribute is 0 and all pixels are treated as opaque.
\subsubsection{maximum-error}
normalized maximum mean error per pixel.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('maximum-error')
\end{quote}
This value reflects the normalized maximum per pixel introduced when reducing
the number of colors in an image either implicitedly or explicitly:
\begin{enumerate}
\item Explicitly, when you use the Quantize() method.
\item Implicitly, when an image is converted from a file format that
allows many colors to one that allows fewer (e.g. JPEG to GIF).
\end{enumerate}
The normalized maximum error gives one measure of how well the color reduction
algorithm performed and how similiar the color reduced image is to the original.
\subsubsection{mean-error}
normalized mean mean error per pixel.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('mean-error')
\end{quote}
This value reflects the normalized mean per pixel introduced when reducing
the number of colors in an image either implicitedly or explicitly:
\begin{enumerate}
\item Explicitly, when you use the Quantize() method.
\item Implicitly, when an image is converted from a file format that
allows many colors to one that allows fewer (e.g. JPEG to GIF).
\end{enumerate}
The normalized mean error gives one measure of how well the color reduction
algorithm performed and how similiar the color reduced image is to the original.
\subsubsection{montage}
tile size and offset within an image montage.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('montage')
\end{quote}
A montage is one or more image thumbnails regularly spaced across a
color or textured background returned by the Montage() method or
\textit{montage} program. The \texttt{montage} attribute returns the
geometry of the region associated with each image thumbnail
(e.g. 160x120+10+10). This information is useful for creating image maps
for dynamic web pages.
\subsubsection{page}
perferred size and location of the image canvas.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(page=$>$\var{string}) \\
\hspace*{-0.25in}
\$image-$>$Get('page')
\end{quote}
\texttt{Page} declares the image canvas size and location. Typically this
is only useful for the Postscript, text, and GIF formats. The value of
\texttt{string} can be:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Letter \> Tabloid \> Ledger \\
\> Legal \> Statement \> Executive \\
\> A3 \> A4 \> A5 \\
\> B4 \> B5 \> Folio \\
\> Quarto \> 10x14 \>
\end{tabbing}
or a geometry (612x792). The default value is \texttt{Letter}.
\subsubsection{pointsize}
pointsize of a font.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(pointsize=$>$\var{integer}) \\
\hspace*{-0.25in}
\$image-$>$Get('pointsize')
\end{quote}
The \texttt{pointsize} attribute determines how large to draw a Postscript
or TrueType font with the Annotate() or Draw() methods. The default is 12.
\subsubsection{preview}
type of image preview.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(preview=$>$\var{string}) \\
\hspace*{-0.25in}
\$image-$>$Get('preview')
\end{quote}
Set or get the type of preview for the Preview image format.
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Rotate\> Shear\> Roll \\
\> Hue\> Saturation\> Brightness \\
\> Gamma\> Spiff\> Dull \\
\> Grayscale\> Quantize \\
\> Despeckle\> ReduceNoise \\
\> AddNoise\> Sharpen\> Blur \\
\> Threshold\> EdgeDetect \\
\> Spread\> Solarize\> Shade \\
\> Raise\> Segment\> Swirl \\
\> Implode\> Wave\> OilPaint \\
\> CharcoalDrawing\> JPEG
\end{tabbing}
Suppose we want to determine an ideal gamma setting for our image:
{\small
\begin{verbatim}
$image->Write(filename=>'model.png',preview=>'Gamma');
$image->Display();
\end{verbatim}
}
\subsubsection{quality}
compression level.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(quality=$>$\var{integer}) \\
\hspace*{-0.25in}
\$image-$>$Get('quality')
\end{quote}
The quality attribute sets the JPEG, MIFF, MNG, or PNG compression level. The
range is 0 (worst) to 100 (best). The default is 75.
Quality is a trade-off between image size and compression speed for the
MIFF, MNG, and PNG formats. The higher the quality, the smaller the
resulting image size but with a requisite increase in compute time.
The quality value is used as two decimal digits. The ``tens'' digit
conveys the zlib compression level and the ``ones'' digit conveys the
PNG filter method. When the compression level is 0, the Huffman compression
strategy is used, which is fast but does not necessarily obtain the worst
compression. The MIFF encoder ignores the PNG filter method conveyed
by the ``ones'' digit.
The JPEG trade-off is between image size and image appearance. A high
quality returns an image nearly free of compression artifacts but with
a larger image size. If you can accept a lower quality image
appearance, the resulting image size would be considerably less.
\subsubsection{red-primary}
chromaticity red primary point.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(red-primary=$>$\var{x-value},\var{y-value}) \\
\hspace*{-0.25in}
\$image-$>$Get('red-primary')
\end{quote}
This attribute sets or returns the chomaticity red primary point. This is
a color management option.
\subsubsection{rendering-intent}
intended rendering model.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(rendering-intent=$>$\var{string}) \\
\hspace*{-0.25in}
\$image-$>$Get('rendering-intent')
\end{quote}
This is a color management option. Choose from these models:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Undefined \> Saturation \> Perceptual \\
\> Absolute \> Relative \>
\end{tabbing}
\subsubsection{sampling-factor}
image sampling factor.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set('sampling-factor'=$>$\var{geometry}) \\
\hspace*{-0.25in}
\$image-$>$Get('sampling-factor')
\end{quote}
Use this attribute to set the horizontal and vertical sampling factor
for use by the JPEG encoder.
\subsubsection{scene}
image scene number.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(scene=$>$\var{integer}) \\
\hspace*{-0.25in}
\$image-$>$Get('scene')
\end{quote}
By default each image in a sequence has a scene number that starts at 0 and
each subsequent image in the sequence increments by 1. Use \texttt{scene} to
reset this value to whatever is appropriate for your needs.
\subsubsection{signature}
SHA-256 message digest.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('signature')
\end{quote}
Retrieves the SHA-256 message digest associated with the image.
A signature is generated across all the image pixels. If a single pixel
changes, the signature will change as well. The signature is mostly useful
for quickly determining if two images are identical or if an image has been
modified.
\subsubsection{size}
width and height of a raw image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(size=$>$\var{geometry}) \\
\hspace*{-0.25in}
\$image-$>$Get('size')
\end{quote}
Set the \texttt{size} attribute before reading an image from a raw data file
format such as RGB, GRAY, TEXT, or CMYK (e.g. 640x480) or identify a desired
resolution for Photo CD images (e.g. 768x512).
{\small
\begin{verbatim}
$image->Set(size=>'640x480');
$image->Read('gray:protein');
\end{verbatim}
}
\subsubsection{server}
X server to contact.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(server=$>$\var{string}) \\
\hspace*{-0.25in}
\$image-$>$Get('server')
\end{quote}
Display(), Animate(), or any X11 font use with Annotate() require contact with
an X server. Use \texttt{server} to specify which X server to contact (e.g.
\texttt{mysever:0}).
\subsubsection{taint}
pixel change boolean.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('taint')
\end{quote}
\texttt{Taint} returns a value other than 0 if any image pixel has modified
since it was first read.
\subsubsection{texture}
name of texture to tile.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(texture=$>$\var{string}) \\
\hspace*{-0.25in}
\$image-$>$Get('texture')
\end{quote}
The \texttt{texture} attribute assigns a filename of a texture to be tiled
onto the image background when any TXT or WMF image formats are read.
\subsubsection{type}
image type.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(type=$>$\var{string}) \\
\hspace*{-0.25in}
\$image-$>$Get('type')
\end{quote}
The image type can be any of the following
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Bilevel \> Grayscale \> GrayscaleMatte \\
\> Palette \> PaletteMatte \> TrueColor\\
\> TrueColorMatte \> ColorSeparation \> ColorSeparationMatte \\
\> Optimize
\end{tabbing}
When getting this attribute, the value reflects the type of image pixels.
For example a colormapped GIF image would most likely return Palette as the
image type. You can also force a particular type with Set(). For example if
you want to force your color image to black and white, use:
{\small
\begin{verbatim}
$image->Set(type=>'Bilevel');
\end{verbatim}
}
\subsubsection{units}
units of resolution.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(units=$>$\var{string}) \\
\hspace*{-0.25in}
\$image-$>$Get('units')
\end{quote}
Return or set the units in which the image's resolution are defined.
Values may be:
\begin{tabbing}
0000\=111111111111111\kill
\> Undefined \\
\> pixels/inch \\
\> pixels/centimeter
\end{tabbing}
\subsubsection{verbose}
print details.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(verbose=$>$\var{boolean}) \\
\end{quote}
When set, \texttt{verbose} causes some image operations to print details
about the operation as it progresses.
\subsubsection{white-point}
chromaticity white point.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(white-point=$>$\var{x-value},\var{y-value}) \\
\hspace*{-0.25in}
\$image-$>$Get('white-point')
\end{quote}
This attribute sets or returns the chomaticity white point. This is
a color management option.
\subsubsection{width}
image width.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('width')
\end{quote}
Returns the width (integer number of pixel columns) of the image.
\subsubsection{x-resolution}
horizontal resolution.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('x-resolution')
\end{quote}
Returns the \textit{x} resolution of the image in the units defined
by the \texttt{units} attribute (e.g. 72 pixels/inch). Use the
\texttt{density} attribute to change this value.
\subsubsection{y-resolution}
vertical resolution.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get('y-resolution')
\end{quote}
Returns the \textit{y} resolution of the image in the units defined
by the \texttt{units} attribute (e.g. 72 pixels/inch). Use the
\texttt{density} attribute to change this value.
\section{Image::Magick Methods}
\subsubsection{AddNoise()}
add noise to an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$AddNoise(noise=$>$\var{string})
\end{quote}
This method adds random noise to the image, where \var{string} specifies one
of the following types:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Uniform \> Gaussian \> Multiplicative \\
\> Impulse \> Laplacian \> Poisson
\end{tabbing}
\subsubsection{AffineTransform}
affine transform the image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$AffineTransform(affine=$>$\var{array of float values},
rotate=$>$\var{rotate-angle}, scale=$>$\var{sx, sy}, skewX=$>$\var{skew-angle},
skewY=$>$\var{skew-angle}, translate=$>$\var{tx, ty})
\end{quote}
AffineTransform()
\begin{description}
\item[rotate] Specifies a rotation of \var{rotate-angle} degrees about a given
point.
\item[scale] Specifies a scale operation by \var{sx} and \var{sy}.
\item[skewX] Specifies a skew transformation along the x-axis.
\item[skewY] Specifies a skew transformation along the y-axis.
\item[translate] Specifies a translation by \var{tx} and \var{ty}.
\end{description}
\subsubsection{Animate()}
animate an image sequence.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Animate()
\end{quote}
Animate() repeatedly displays an image sequence to any X window screen. This
method accepts the same parameters as Set() as described in section
\ref{Image::Magick Attributes}.
\subsubsection{Annotate()}
annotate an image with text.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Annotate(text=$>$\var{string}, affine=$>$\var{array of float values},
align=$>$\var{string}, antialias=$>$\var{boolean},
density=$>$\var{geometry}, encoding$>$\var{string},
fill=$>$\var{color-name}, family=$>$\var{string}, font=$>$\var{string},
geometry=$>$\var{geometry}, gravity=$>$\var{string}, pointsize=$>$\var{integer},
rotate=$>$\var{rotate-angle}, scale=$>$\var{sx, sy}, skewX=$>$\var{skew-angle},
skewY=$>$\var{skew-angle}, stroke=$>$\var{color-name},
strokewidth=$>$\var{integer}, stretch=$>$\var{string}, style=$>$\var{string},
translate=$>$\var{tx, ty}, undercolor=$>$\var{color-name},
unicode=$>$\var{boolean}, weight=$>$\var{string}, x=$>$\var{integer},
y=$>$\var{integer})
\end{quote}
Annotate() allows you to scribble text across an image. The text may be
represented as a string or filename. Precede the filename with an
"at" sign (\texttt{@}) and the contents of the file are drawn on the
image. You can affect how text is drawn by specifying one or more
of the following parameters:
\begin{description}
\item[align] font alignment. Choose from these alignments:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Left \> Center \> Right
\end{tabbing}
\item[antialias] The visible effect of antialias is to smooth out the
rounded corners of text characters. Set to 0 to keep crisp edges.
\item[density] Set the vertical and horizontal resolution of the font.
The default is 72 pixels/inch.
\item[encoding] Font encoding.
\item[family] font family.
\item[fill] The fill color paints any areas inside the outline of the text.
\item[font] A font can be a Truetype (arial.ttf), Postscript (Helvetica), or a
fully-qualified X11 font (-*-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-*).
\item[geometry] Geometry defines the baseline position where text is
rendered (e.g. +100+50).
\item[gravity] Gravity affects how the text is rendered relative to the
(\var{x, y}) baseline position. By default gravity is NorthWest which renders
text above the baseline position. Choose from these gravities:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> NorthWest \> North \> NorthEast \\
\> West \> Center \> East \\
\> SouthWest \> South \> SouthEast
\end{tabbing}
\item[pointsize] The font pointsize. The default is 12.
\item[rotate] Specifies a rotation by the specified number of degrees about a
given point.
\item[scale] Specifies a scale operation by \var{sx} and \var{sy}.
\item[skewX] Specifies a skew transformation along the x-axis.
\item[skewY] Specifies a skew transformation along the y-axis.
\item[stretch] font stretch. Choose from these stretches:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Normal \> UltraCondensed \> ExtraCondensed \\
\> Condensed \> SemiCondensed \> SemiExpanded \\
\> Expanded \> ExtraExpanded \> UltraExpanded
\end{tabbing}
\item[stroke] A stroke color paints along the outline of the text.
\item[strokewidth] The width of the stroke on the text. A zero value
causes no stroke to be painted.
\item[style] font style. Choose from these styles:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Normal \> Italic \> Oblique \\
\> Any
\end{tabbing}
\item[translate] Specifies a translation by \var{tx} and \var{ty}.
\item[undercolor] By default text is blended with the image background.
Set the undercolor color to give a uniform background to your text of the
color you choose.
\item[unicode] Set to true if text is Unicode.
\item[weight] Font weight.
\item[x] Specifies the \var{x} baseline position of the text.
\item[y] Specifies the \var{y} baseline position of the text.
\end{description}
\subsubsection{Append()}
append a set of images.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Append(stack=$>$\var{boolean})
\end{quote}
The Append() method takes a set of images and appends them to each other.
Append() returns a single image where each image in the original set
is side-by-side. If the stack parameter is True, the images
are stacked top-to-bottom.
{\small
\begin{verbatim}
$append = $image->Append();
\end{verbatim}
}
\subsubsection{Average()}
average a set of images.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Average()
\end{quote}
The Average() method takes a set of images and averages them together.
Each image in the set must have the same width and the same height.
Average() returns a single image with each corresponding pixel component
of each image averaged.
\subsubsection{BlobToImage()}
return an image from a Binary Large OBject.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$BlobToImage(\var{blob})
\end{quote}
Read() returns an image from a file on disk, whereas, BlobToImage() performs
the same function if the image format is stored in memory:
{\small
\begin{verbatim}
@blob = $db->GetImage(); # get blob from database
$image = Image::Magick->New(magick=>'jpg');
# the blob is a JPEG image
$image->BlobToImage(@blob); # convert blob to Image::Magick object
\end{verbatim}
}
\subsubsection{Blur()}
blur the image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Blur(geometry=$>$\var{geometry}, radius=$>$\var{float},
sigma=$>$\var{float})
\end{quote}
Blur() blurs an image. We convolve the image with a Gaussian operator of the
given radius and standard deviation (sigma). For reasonable results, the
radius should be larger than sigma. Use a radius of 0 and Blur()
selects a suitable radius for you. \texttt{Geometry} represents
radius x sigma as one parameter (e.g. 0x1).
\subsubsection{Border()}
frame the image with a border.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Border(geometry=$>$\var{geometry}, width=$>$\var{integer},
height=$>$\var{integer}, fill=$>$\var{color-name})
\end{quote}
This method surrounds the image with a border of the specified color.
\texttt{Geometry} represents {\it width x height} as one parameter (e.g. 10x5).
\subsubsection{Channel()}
extract a channel from the image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Channel(channel=$>$\var{string});
\end{quote}
Extract a channel from the image. A channel is a particular color component
of each pixel in the image. Choose from these components:
\begin{tabbing}
0000\=111111\kill
\> Red \\
\> Cyan \\
\> Green \\
\> Magenta \\
\> Blue \\
\> Yellow \\
\> Opacity \\
\> Black
\end{tabbing}
\subsubsection{Charcoal()}
special effect filter.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Charcoal(geometry=$>$\var{geometry}, radius=$>$\var{float},
sigma=$>$\var{float})
\end{quote}
Charcoal() is a special effect filter that simulates a charcoal drawing.
We convolve the image with a Gaussian operator of the given radius and
standard deviation (sigma). For reasonable results, radius should be larger
than sigma. Use a radius of 0 and Charcoal() selects a suitable radius for
you. \texttt{Geometry} represents radius x sigma as one parameter
(e.g. 0x1).
\subsubsection{Chop()}
chop an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Chop(geometry=$>$geometry, width=$>$integer, height=$>$integer,
x=$>$integer, y=$>$integer)
\end{quote}
Chop() removes a region of an image and collapses the image to occupy the
removed portion. Columns \texttt{x} through \texttt{x+width} and the rows
\texttt{y} through \texttt{y+height} are chopped. Use \texttt{Geometry} as a
shortcut for {\it width x height + x + y} (e.g. 100x50+10+20).
\subsubsection{Clone()}
create a new copy of an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Clone()
\end{quote}
The Clone() method copies a set of images and returns the copy as a new
image object. For example
{\small
\begin{verbatim}
$clone = $image=>Clone();
\end{verbatim}
}
copies all of the images from \texttt{\$image} to \texttt{\$clone}.
\subsubsection{Coalesce()}
coalesce a set of images.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Coalesce()
\end{quote}
This method composites a set of images while respecting any page
offsets and disposal methods. GIF, MIFF, and MNG animation sequences
typically start with an image background and each subsequent image
varies in size and offset. Coalesce() returns a new sequence
where each image in the sequence is the same size as the first and
composited over the previous images in the sequence.
\subsubsection{ColorFloodfill()}
floodfill the designed area with color.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$ColorFloodfill(geometry=$>$\var{geometry}, x=$>$\var{integer},
y=$>$\var{integer}, fill=$>$\var{color-name}, bordercolor=$>$\var{color-name},
fuzz=$>$\var{float})
\end{quote}
ColorFloodfill() changes the color value of any pixel that matches
\texttt{fill} and is an immediate neighbor. If \texttt{bordercolor} is
specified, the color value is changed for any neighbor pixel that
is not \texttt{bordercolor}. Use \texttt{Geometry} as a shortcut for
{\it x + y} (e.g. +10+20).
By default \texttt{fill} must match a particular pixel color exactly.
However, in many cases two colors may differ by a small amount.
\texttt{Fuzz} defines how much tolerance is acceptable to consider
two colors as the same. For example, set fuzz to 10 and the color red
at intensities of 100 and 102 respectively are now interpreted as the
same color for the purposes of the floodfill.
\subsubsection{Colorize()}
colorize an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Colorize(fill=$>$\var{color-name}, opacity=$>$\var{string})
\end{quote}
Colorize() blends the fill color with each pixel in the image. A
percentage blend is specified with \texttt{opacity}. Control the
application of different color components by specifying a different
percentage for each component (e.g. 90/100/10 is 90\% red, 100\% green,
and 10\% blue).
\subsubsection{Comment()}
add a comment to an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Comment(comment=$>$\var{string})
\end{quote}
Add a comment to an image. Optionally you can include any of the following
bits of information about the image by embedding the appropriate special
characters:
\begin{tabbing}
0000\=1111\=222222222222222\kill
\> \%b \> file size in bytes. \\
\> \%c \> comment. \\
\> \%d \> directory in which the image resides. \\
\> \%e \> extension of the image file. \\
\> \%f \> original filename of the image. \\
\> \%g \> page geometry. \\
\> \%h \> height of image. \\
\> \%i \> filename of the image. \\
\> \%k \> number of unique colors. \\
\> \%l \> image label. \\
\> \%m \> image file format. \\
\> \%n \> number of images in the image sequence. \\
\> \%o \> output image filename. \\
\> \%p \> page number of the image. \\
\> \%q \> image depth (8 or 16). \\
\> \%s \> image scene number. \\
\> \%t \> image filename without any extension. \\
\> \%u \> a unique temporary filename. \\
\> \%w \> image width. \\
\> \%x \> x resolution of the image. \\
\> \%y \> y resolution of the image. \\
\> \%z \> image depth. \\
\> \%\# \> SHA-256 message digest.
\end{tabbing}
Given an image whose filename is \texttt{logo.gif} and dimensions of
640 pixels in width and 480 pixels in height, this statement:
{\small
\begin{verbatim}
$image->Comment('%f %m %wx%h')
\end{verbatim}
}
generates a comment that reads: \texttt{logo.gif GIF 640x480}.
\subsubsection{Composite}
composite one image to another.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Composite(image=$>$\var{image-handle}, color=$>$\var{color-name},
compose=$>$\var{string}, geometry=$>$\var{geometry}, mask=$>$\var{image-handle},
gravity=$>$\var{string}, opacity=$>$\var{integer}, rotate=$>$\var{float},
tile=$>$\var{boolean} x=$>$\var{integer}, y=$>$\var{integer},
)
\end{quote}
Composite() allows you to overlay one image to another. You can affect
how and where the composite is overlaid by specifying one or more of the
following options:
\begin{description}
\item[compose] This operator affects how the composite is applied to
the image. The default is Over. Choose from these operators:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Over \> In \> Out \\
\> Atop \> Xor \> Plus \\
\> Minus \> Add \> Subtract \\
\> Difference \> Bumpmap \> Copy \\
\> Displace
\end{tabbing}
\item[geometry] Geometry defines the baseline position where the composite is
placed (e.g. +100+50).
\item[gravity] Gravity affects how the image is placed
relative to the (\var{x, y}) baseline position. By default
gravity is NorthWest which renders the image just below the baseline position.
Choose from these gravities:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> NorthWest \> North \> NorthEast \\
\> West \> Center \> East \\
\> SouthWest \> South \> SouthEast
\end{tabbing}
\item[image] The image.
\item[mask] The mask image.
\item[opacity] Blend composite with the image background. \texttt{Opacity}
is expressed as percent transparency.
\item[rotate] Rotate image before it is composited, expressed in degrees.
\item[tile] A value other than 0 tiles the composite repeatedly across
\item[x] Specifies the \var{x} baseline position of the composite.
\item[y] Specifies the \var{y} baseline position of the composite.
and down the image.
\end{description}
\subsubsection{Contrast()}
enhance or reduce the image contrast.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Contrast(sharpen=$>$\var{boolean})
\end{quote}
Contrast() enhances the intensity differences between the lighter and
darker elements of the image. Set \texttt{sharpen} to a value other than
0 to increase the image contrast otherwise the contrast is reduced.
\subsubsection{Convolve()}
apply a convolution kernel to the image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Convolve(coefficients=$>$\var{array of float values})
\end{quote}
Apply a custom convolution kernel to the image. Given a particular
kernel \var{order}, you must supply \var{order x order} float values.
For example, a kernel of order 3 implies 9 values (3x3):
{\small
\begin{verbatim}
$image->Convolve([1, 2, 1, 2, 4, 2, 1, 2, 1]);
\end{verbatim}
}
\subsubsection{Crop}
crop an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Crop(geometry=$>$\var{geometry}, width=$>$\var{integer},
height=$>$\var{integer}, x=$>$\var{integer}, y=$>$\var{integer})
\end{quote}
Crop() extracts a region of the image starting at the offset defined
by \texttt{x} and \texttt{y} and extending for \texttt{width} and
\texttt{height}. \texttt{Geometry} is a shorthard method to define
a region. To crop 100 x 50 region that begins at position (10, 20),
use
{\small
\begin{verbatim}
$image->Crop('100x50+10+20');
\end{verbatim}
}
\subsubsection{CycleColormap}
displace a colormap.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$CycleColormap(display=$>$\var{integer})
\end{quote}
CycleColormap() displaces an image's colormap by a given number of positions.
If you cycle the colormap a number of times you can produce a psychodelic
effect.
\subsubsection{Deconstruct}
return the constituent parts of an image sequence.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Deconstruct()
\end{quote}
Deconstruct() returns a new sequence that consists of the first image
in the sequence followed by the maximum bounding region of any differences
in subsequent images. This method can undo a coalesced sequence returned
by Coalesce(), and is useful for removing redundant information
from a GIF or MNG animation.
\subsubsection{Despeckle}
filter speckles.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Despeckle()
\end{quote}
Despeckle() reduces the {\em speckle} noise in an image while perserving
the edges of the original image.
\subsubsection{Display()}
display image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Display(server=$>$\var{server-name})
\end{quote}
Display() displays the image to any X window screen.
\subsubsection{Draw}
annotate an image with a graphic primitive.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Draw(primitive=$>$\var{string},
affine=$>$\var{array of float values}, antialias=$>$\var{boolean},
bordercolor=$>$\var{color-name}, density=$>$\var{geometry},
fill=$>$\var{color-name}, font=$>$\var{string}, geometry=$>$\var{geometry},
method=$>$\var{string}, points=$>$\var{string}, pointsize=$>$\var{integer},
rotate=$>$\var{rotate-angle}, scale=$>$\var{sx, sy}, skewX=$>$\var{skew-angle},
skewY=$>$\var{skew-angle}, stroke=$>$\var{color-name},
strokewidth=$>$\var{integer}, translate=$>$\var{tx, ty}
\end{quote}
Draw() allows you to draw a graphic primitive on your image. The primitive
may be represented as a string or filename. Precede the filename with an
"at" sign (\texttt{@}) and the contents of the file are drawn on the
image. You can affect how text is drawn by specifying one or more
of the following parameters:
\begin{description}
\item[primitive] The primitive describes the type of graphic to draw.
Choose from these primitives:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Point \> Line \> Rectangle \\
\> roundRectangle \> Arc \> Ellipse \\
\> Circle \> Polyline \> Polygon \\
\> Bezier \> Path \> Color \\
\> Matte \> Text \> Image
\end{tabbing}
\item[antialias] The visible effect of antialias is to smooth out the
rounded corners of the drawn shape. Set to 0 to keep crisp edges.
\item[bordercolor] The Color primitive with a method of FloodFill
changes the color value of any pixel that matches \texttt{fill} and is an
immediate neighbor. If \texttt{bordercolor} is specified, the color
value is changed for any neighbor pixel that is not \texttt{fill}.
\item[density] This parameter sets the vertical and horizontal resolution of
the font. The default is 72 pixels/inch.
\item[fill] The fill color paints any areas inside the outline of drawn shape.
\item[font] A font can be a Truetype (arial.ttf), Postscript (Helvetica), or a
fully-qualified X11 font (-*-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-*).
\item[geometry] Geometry defines the baseline position where the graphic
primitive is rendered (e.g. +100+50).
\item[method] Primitives Matte and Image behavior depends on the painting
method you choose:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Point \> Replace \> Floodfull \\
\> FillToBorder \> Reset
\end{tabbing}
\item[points] List one or more sets of coordinates as required by
the graphic primitive you selected.
\item[pointsize] The font pointsize. The default is 12.
\item[rotate] Specifies a rotation of \var{rotate-angle} degrees about a given
point.
\item[scale] Specifies a scale operation by \var{sx} and \var{sy}.
\item[skewX] Specifies a skew transformation along the x-axis.
\item[skewY] Specifies a skew transformation along the y-axis.
\item[stroke] A stroke color paints along the outline of the shape.
\item[strokewidth] The width of the stroke of the shape. A zero value
means no stroke is painted.
\item[translate] Specifies a translation by \var{tx} and \var{ty}.
\end{description}
\subsubsection{Edge}
detect edges within an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Edge(radius=$>$\var{float})
\end{quote}
Edge() finds edges in an image. \texttt{Radius} defines the radius of
the convolution filter. Use a radius of 0 and Edge() selects a suitable
radius for you.
\subsubsection{Emboss}
emboss the image.
\begin{quote}
\hspace*{-0.25in}
\code{\$image-$>$Emboss(geometry=$>$\var{geometry}, radius=$>$\var{float},
sigma=$>$\var{float})}
\end{quote}
Emboss() returns a grayscale image with a three-dimensional effect.
We convolve the image with a Gaussian operator of the given radius and
standard deviation (sigma). For reasonable results, radius should be
larger than sigma. Use a radius of 0 and Emboss() selects a suitable
radius for you. \texttt{Geometry} represents radius x sigma as one
parameter (e.g. 0x1).
\subsubsection{Enhance}
filter a noisy image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Enhance()
\end{quote}
Enhance() applies a digital filter that improves the quality of a noisy
image.
\subsubsection{Equalize}
equalize an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Equalize()
\end{quote}
Perform a histogram equalization on the image.
\subsubsection{Flatten()}
flatten a sequence of images.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Coalesce()
\end{quote}
This method composites a sequence of images while respecting any page
offsets. A Photoshop image typically starts with an image background and
each subsequent layer varies in size and offset. Flatten() returns a single
image with all the layers composited onto the first image in the sequence.
\subsubsection{Flip}
reflect an image vertically.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Flip()
\end{quote}
Flip() creates a vertical mirror image by reflecting the pixels around the
central x-axis.
\subsubsection{Flop}
reflect an image horizontally.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Flop()
\end{quote}
Flop() creates a horizontal mirror image by reflecting the pixels around the
central y-axis.
\subsubsection{Frame}
surround the image with a decorative border.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Frame(geometry=$>$\var{geometry}, width=$>$\var{integer},
height=$>$\var{integer}, inner=$>$\var{integer}, outer=$>$\var{integer},
fill=$>$\var{color-name})
\end{quote}
Frame() adds a simulated three-dimensional border around the image.
The color of the border is defined by \texttt{fill}.
\texttt{Width} and \texttt{height} specify the border width of the
vertical and horizontal sides of the frame. The \texttt{inner} and
\texttt{outer} parameters indicate the width of the inner and outer
{\em shadows} of the frame. Use \texttt{Geometry} as a shortcut for
\texttt{width}, \texttt{height}, \texttt{inner}, and \texttt{outer}
(e.g. 10x10+3+3).
\subsubsection{Gamma}
gamma-correct the image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Gamma(gamma=$>$\var{string},
channel=$>$\var{Red, Green, Blue, Opacity, Index, Cyan, Yellow, Magenta, Black, or All})
\end{quote}
Use Gamma() to gamma-correct an image. The same image viewed on
different devices will have perceptual differences in the way the
image's intensities are represented on the screen. Specify individual
gamma levels for the red, green, and blue channels, or adjust all three
with the \texttt{gamma} parameter. Values typically range from 0.8 to
2.3.
You can also reduce the influence of a particular channel with a gamma value
of 0.
\subsubsection{Get()}
get an image attribute.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Get(\var{attribute}, ...)
\end{quote}
Get() accepts one or more image attributes listed in section
\ref{Image::Magick Attributes} and return their value.
\subsubsection{ImageToBlob()}
return image as a Perl variable.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$ImageToBlob()
\end{quote}
ImageToBlob() behaves just like Write() except the image is returned
as a Perl variable rather than written to disk. This method accepts the
same parameters as Set() as described in section \ref{Image::Magick
Attributes}.
\subsubsection{Implode()}
apply an implosion/explosion filter.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Implode(amount=$>$\var{double})
\end{quote}
Implode() applies a special effects filter to the image where
\texttt{amount} determines the amount of implosion. Use a negative
amount for an explosive effect.
\subsubsection{Label()}
add a label to an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Label(label=$>$\var{string})
\end{quote}
Use labels to optionally annotate a Postscript or PDF image or the thumbnail
images of a montage created by the Montage() method or \textit{montage} program.
A label can include any of the special formatting characters described in the
Comment() method description.
\subsubsection{Level}
adjust the level of image contrast.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Level(levels=$>$\var{string},
'black-point'=$>$\var{float}, 'mid-point'=$>$\var{float},
'white-point'=$>$\var{float})
\end{quote}
The white and black points range from 0 to MaxRGB and mid ranges from 0 to 10.
\subsubsection{Magnify()}
scale the image to twice its size.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Magnify()
\end{quote}
Magnify() is a convenience method that scales an image proportionally
to twice its size.
\subsubsection{Map()}
choose a set of colors from another image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Map(image=$>$\var{image-handle}, dither=$>$\var{boolean})
\end{quote}
Map() changes the colormap of the image to that of the image given by
\texttt{image}. Use this method to change the colormap in an image or
image sequence to a set of predetermined colors. Set \texttt{dither}
to a value other than zero to helps smooth out the apparent contours
produced when sharply reducing colors.
One useful example of mapping is to convert an image to the Netscape
216-color web safe palette:
{\small
\begin{verbatim}
$safe = new Image::Magick;
$safe->Read('Netscape:');
$image->Map(image=>$safe, dither=>'True');
\end{verbatim}
}
\subsubsection{MatteFloodfill()}
floodfill an area with transparency.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$MatteFloodfill(geometry=$>$\var{geometry}, x=$>$\var{integer},
y=$>$\var{integer}, opacity=$>$\var{integer}, bordercolor=$>$\var{color-name},
fuzz=$>$\var{float})
\end{quote}
MatteFloodfill() changes the transparency value of any pixel that matches
\texttt{opacity} and is an immediate neighbor. If \texttt{bordercolor} is
specified, the transparency value is changed for any neighbor pixel that
is not \texttt{bordercolor}. Use \texttt{Geometry} as a shortcut for
{\it x + y} (e.g. +10+20).
By default \texttt{opacity} must match a particular pixel transparency exactly.
However, in many cases two transparency values may differ by a small
amount. \texttt{Fuzz} defines how much tolerance is acceptable to consider
two transparency values as the same. For example, set fuzz to 10 and the
opacity values of 100 and 102 respectively are now interpreted as the
same value for the purposes of the floodfill.
\subsubsection{MedianFilter()}
filter a noisy image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$MedianFilter(radius=$>$\var{float})
\end{quote}
MedianFilter() applies a digital filter that improves the quality of a noisy
image. Each pixel is replaced by the median in a set of neighboring pixels
as defined by \texttt{radius}.
\subsubsection{Minify()}
scale the image to half its size.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Magnify()
\end{quote}
Minify() is a convenience method that scales an image proportionally
to half its size.
\subsubsection{Modulate}
adjust the brightness, saturation, and hue.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Modulate(factor=$>$\var{string}, brightness=$>$\var{float},
saturation=$>$\var{float}, hue=$>$\var{float})
\end{quote}
Modulate() lets you control the brightness, saturation, and hue of an image.
Each parameter is in the form of a percentage relative to 100. For example,
to decrease the brightness by 10% and increase saturation by 50%, use:
{\small
\begin{verbatim}
$image->Modulate(brightness=$>$90, saturation=$>$150);
\end{verbatim}
}
\texttt{Factor} represents the brightness, saturation, and hue as one
parameter (e.g. 90/150/100).
\subsubsection{Mogrify()}
alternative calling scheme.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Mogrify(method, ...)
\end{quote}
The Mogrify() method is convenience function that allows you to call any
image manipulation method by giving a method name followed by one or
parameters to pass to the method. The following calls have the same
result:
{\small
\begin{verbatim}
$image->Crop('340x256+0+0')
$image->Mogrify('Crop', '340x256+0+0')
\end{verbatim}
}
\subsubsection{MogrifyRegion()}
apply method to a region.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$MogrifyRegion(geometry, method, ...)
\end{quote}
MogrifyRegion() applies an image manipulation method to a region of the
image as defined by \var{geometry}. For example if you want to sharpen
a 100 x 100 region starting at position (20, 20), use:
result:
{\small
\begin{verbatim}
$image->MogrifyRegion('100x100+20+20', Sharpen, '0x1')
\end{verbatim}
}
\subsubsection{Montage()}
uniformly tile thumbnails across an image canvas.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Montage(background=$>$\var{color-name},
bordercolor=$>$\var{color-name}, borderwidth=$>$\var{integer},
compose=$>$\var{string}, fill=$>$\var{color-name}, font=$>$\var{string},
frame=$>$\var{geometry}, geometry=$>$\var{geometry}, gravity=$>$\var{string},
label=$>$\var{string}, mattecolor=$>$\var{color-name}, mode=$>$\var{string},
pointsize=$>$\var{integer}, shadow=$>$\var{boolean},
stroke=$>$\var{color-name}, texture=$>$\var{string},
tile=$>$\var{geometry}, title=$>$\var{string},
transparent=$>$\var{color-name})
\end{quote}
The Montage() method is a layout manager that lets you tile one or more
thumbnails across an image canvas. Use these parameters to control how the
layout manager places the thumbnails:
\begin{description}
\item[background] The color name for the montage background.
\item[bordercolor] The color name for the thumbnail border.
\item[borderwidth] The width of the thumbnail border.
\item[compose] This operator affects how the thumbnail is composited
on the image canvas. The default is Over. Choose from these operators:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Over, \> In \> Out \\
\> Atop \> Xor \> Plus \\
\> Minus \> Add \> Subtract \\
\> Difference \> Bumpmap \> Copy \\
\> Displace
\end{tabbing}
\item[fill] The fill color paints any areas inside the outline of the
thumbnail label.
\item[font] A font can be a Truetype (arial.ttf), Postscript (Helvetica), or a
fully-qualified X11 font (-*-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-*).
\item[frame] Adds a simulated three-dimensional border around each thumbnail.
The color of the border is defined by \texttt{mattecolor}. Specify
the border width of the vertical and horizontal sides of the frame
and the inner and outer {\em shadows} of the frame as a geometry (e.g.
10x10+3+3).
\item[geometry] Geometry defines the baseline position where a thumbnail is
composited (e.g. +100+50).
\item[gravity] Gravity affects how the thumbnail is placed
relative to the (\var{x, y}) baseline position. By default
gravity is South which positions the thumbnail centered south of the
baseline position. Choose from these gravities:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> NorthWest \> North \> NorthEast \\
\> West \> Center \> East \\
\> SouthWest \> South \> SouthEast
\end{tabbing}
\item[label] A label optionally appears just below each thumbnail. Use this
parameter to customize the label. See Comment() for a list of embedded
formatting options for the thumbnail label.
\item[mode] Define one of three thumbnail framing options:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Frame \> Unframe \> Concatentate
\end{tabbing}
The default is \texttt{Frame} which adds a simulated three-dimensional border
around each thumbnail. \texttt{Unframe} tiles thumbnails without any
border or frame, and \texttt{Concatentate} causes each image to be
tightly packed without any border, frame, or space between them.
\item[pointsize] The font pointsize. The default is 12.
\item[shadow] Any value other than 0 will add a simulated shadow beneath and
to the right side of each thumbnail.
\item[stroke] The stroke color paints along the outline of any text labels.
\item[texture] Tile this image across and down the image canvas before
compositing the image thumbnails.
\item[tile] Give the number of thumbnails across and down the canvas
as a geometry string. The default is 5 x 4. If the number of thumbnails
exceed this maximum, more then one image canvas is created.
\item[title] Give a title to the montage. The title is centered near the top
of the montage image.
\item[transparent] Make this color transparent.
\end{description}
\subsubsection{Mosaic()}
form a single coherent picture.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Mosiac()
\end{quote}
The Mosaic() method takes a set of images and inlays them to form
a single coherent pictiure. Mosaic() returns a single image with each
image in the sequence inlayed in the image canvas at an offset as defined
in the image.
{\small
\begin{verbatim}
$mosaic = $image->Mosaic();
\end{verbatim}
}
\subsubsection{MotionBlur()}
simulate motion blur.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$MotionBlur(geometry=$>$\var{geometry}, radius=$>$\var{float},
sigma=$>$\var{float}, angle=$>$\var{float})
\end{quote}
MotionBlur() simulates motion blur. We convolve the image with a Gaussian
operator of the given radius and standard deviation (sigma). For reasonable
results, radius should be larger than sigma. Use a radius of 0 and MotionBlur()
selects a suitable radius for you. \texttt{Geometry} represents
radius x sigma as one parameter (e.g. 0x1). \texttt{Angle} gives the angle
of the blurring motion.
\subsubsection{Morph()}
morph a set of images.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Morph(frames=$>$\var{integer})
\end{quote}
The Morph() method requires a minimum of two images. The first image is
transformed into the second by a number of intervening images as specified by
\texttt{frames}. The result is returned as a new image sequence, for example:
{\small
\begin{verbatim}
$morph = $image->Morph(30);
\end{verbatim}
}
\subsubsection{Negate}
apply color inversion.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Negate(gray=$>$\var{boolean})
\end{quote}
Negate() negates the intensities of each pixel in the image. If \texttt{gray}
is a value other than 0, only the grayscale pixels are inverted.
\subsubsection{New()}
create an image object.
\begin{quote}
\hspace*{-0.25in}
\$image = new Image::Magick; \\
\$image = Image::Magick->New()
\end{quote}
New() instantiates an image object. As a convenience, you can set any image
attribute that Set() knows about. See section \ref{Get or Set an Image
Attribute} for a list of known image attributes. Here is an example:
{\small
\begin{verbatim}
$image = Image::Magick->New(size=>'160x120');
$image->Read('gray:protein');
\end{verbatim}
}
\subsubsection{Normalize()}
enhance image contrast.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Normalize()
\end{quote}
The Normalize() method enhances the contrast of a color image by
adjusting the pixels color to span the entire range of colors available.
\subsubsection{OilPaint()}
simulate an oil painting.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$OilPaint(radius=$>$\var{integer})
\end{quote}
OilPaint() applies a special effect filter that simulates an oil painting.
Each pixel is replaced by the most frequent color occurring in a
circular region defined by \texttt{radius}.
\subsubsection{Opaque()}
globally change a color.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Opaque(color=$>$\var{color-name}, fill=$>$\var{color-name},
fuzz=$>$\var{float})
\end{quote}
Opaque() changes any pixel that matches \texttt{color} with the color
defined by \texttt{fill}.
By default \texttt{color} must match a particular pixel color exactly.
However, in many cases two colors may differ by a small amount.
\texttt{Fuzz} defines how much tolerance is acceptable to consider
two colors as the same. For example, set fuzz to 10 and the color red
at intensities of 100 and 102 respectively are now interpreted as the
same color.
\subsubsection{OrderedDither()}
reduce the image to black and white.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$OrderedDither()
\end{quote}
The OrderedDither() method reduces the image to black and white.
\subsubsection{Ping()}
get information about an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Ping(filename=$>$\var{string}, file=$>$\var{file-handle},
blob=$>$\var{blob})
\end{quote}
Ping() is a convenience method that returns information about an
image without having to read the image into memory. It returns the
width, height, file size in bytes, and the file format of the image.
You can specify more than one filename but only one filehandle:
{\small
\begin{verbatim}
($width, $height, $size, $format) = $image->Ping('logo.gif');
($width, $height, $size, $format) = $image->Ping(file=>\*IMAGE);
($width, $height, $size, $format) = $image->Ping(blob=>\$blob);
\end{verbatim}
}
\subsubsection{Profile()}
add, remove, or apply an image profile.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Profile(name=$>$\var{variable}, profile=$>$\var{blob})
\end{quote}
The Profile() method adds, removes, or applies an image profile.
The two most common profiles are ICC, a color management option,
IPTC, a newswire profile, and APP1, which is a JPEG marker that
can contain EXIF data. \texttt{Profile} is a Perl variable representing
the binary profile information. To remove all profiles from the image, use an
asterick as the profile name:
{\small
\begin{verbatim}
$image->Profile('*');
\end{verbatim}
}
\subsubsection{Quantize()}
set the maximum number of colors in an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Quantize(colors=$>$\var{integer}, colorspace=$>$\var{string},
dither=$>$\var{boolean}, global\_colormap=$>$\var{boolean}
measure\_error=$>$\var{boolean}, tree\_depth=$>$\var{integer})
\end{quote}
The Quantize() method sets the maximum number of colors in an image. If the
number of colors in the image exceeds \texttt{colors}, a color reduction
algorithm repeatly merges pixels of similar color until the total number
of unique colors is less or equal to the maximum. Here is a description of
the color reduction parameters:
\begin{description}
\item[colors] Set the maximum number of colors in the image.
\item[colorspace] By default, color merging is performed in the RGB
colorspace. However, RGB is not perceptually uniform like YCbCr for
example. You may get better results by trying one of the following
colorspaces:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> CMYK \> Gray \> OHTA \\
\> RGB \> sRGB \> Transparent \\
\> XYZ \> YCbCr \> YCC \\
\> YIQ \> YPbPr \> YUV
\end{tabbing}
\item[dither] Images which suffer from severe contouring when reducing colors
can be improved with this option.
\item[global\_colormap] A value other than 0 creates one global colormap
for a sequence of images.
\item[measure\_error] A value other than 0 returns a measure of how closely
the color reduced image matches the original. The mean error, normalized mean
error, and normalized maximum mean error per pixel are computed. Obtain these
values with the Get() method.
\item[tree\_depth] By default, the color reduction uses a Oct-tree algorithm
whose depth ranges from 1-8 which is optimally determined to allow the
best representation of the image with the fastest computational speed and
least amount of memory consumption. You can override the default with this
parameter.
\end{description}
\subsubsection{QueryColor()}
return numerical values corresponding to a color name.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$QueryColor( ... )
\end{quote}
Call QueryColor() with no parameters to return a list of known colors names
or specify one or more color names to get these attributes: red, green, blue,
and opacity value.
{\small
\begin{verbatim}
@colors = $image->QueryColor();
($red, $green, $blue, $opacity) = $image->QueryColor('red');
($red, $green, $blue, $opacity) = $image->QueryColor('#716bae');
\end{verbatim}
}
\subsubsection{QueryColorname()}
return a color name corresponding to the numerical values.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$QueryColorname( ... )
\end{quote}
QueryColorname() accepts one or more numerical values and returns their
respective color name:
{\small
\begin{verbatim}
$color = $image->QueryColorname('rgba(65535,0,0,0)');
\end{verbatim}
}
\subsubsection{QueryFont()}
get font attributes.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$QueryFont( ... )
\end{quote}
Call QueryFont() with no parameters to return a list of known fonts
or specify one or more font names to get these attributes: font name,
description, family, style, stretch, weight, encoding, foundry,
format, metrics, and glyphs values.
{\small
\begin{verbatim}
@fonts = $image->QueryFont();
$weight = ($image->QueryFont('Helvetica'))[5];
\end{verbatim}
}
\subsubsection{QueryFontMetrics()}
query font metrics.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$QueryFontMetrics(font=>\var{string}, ... )
\end{quote}
QueryFontMetrics() accepts a font name and any parameter acceptable to
Annotate(). The method returns these attributes associated with the given
font:
\begin{itemize}
\item character width
\item character height
\item ascender
\item descender
\item text width
\item text height
\item maximum horizontal advance
\end{itemize}
For example,
{\small
\begin{verbatim}
@metrics = $image->QueryFontMetrics(font=>'arial.ttf', pointsize=>24);
\end{verbatim}
}
\subsubsection{QueryFormat()}
get image format attributes.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$QueryFormat( ... )
\end{quote}
Call QueryFormat() with no parameters to return a list of known image formats
or specify one or more format names to get these attributes: adjoin,
blob support, raw, format, decoder, encoder, description, and module.
{\small
\begin{verbatim}
@formats = $image->QueryFormat();
($adjoin, $blob_support, $raw, $decoder, $encoder, $description, $module) = $image->QueryFormat('gif');
\end{verbatim}
}
\subsubsection{Raise()}
lighten or darken edges to create a 3-D effect.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Raise(geometry=$>$\var{geometry}, width=$>$\var{integer},
height=$>$\var{integer}, raise=$>$\var{boolean})
\end{quote}
Raise() creates a simulated three-dimensional button-like effect by
lightening and darkening the edges of the image. \texttt{Width} and
\texttt{height} define the width of the vertical and horizontal edge
of the effect. Use \texttt{Geometry} as a shortcut for
\texttt{width} and \texttt{height} (e.g. 10x10).
A value other than 0 for \texttt{raise} simulates a raised button-like
effect otherwise a sunken button-like effect is applied to the image.
\subsubsection{Read()}
read one or more image files.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Read(filename=$>$\var{float}, file=$>$\var{file-handle})
\end{quote}
\begin{description}
\item[filename] the name of an image file.
\item[file-handle] read the image from an open filehandle.
\end{description}
The Read() method reads an image or image sequence from one or more
filenames or the filehandle you specify. You can specify more than one
filename but only one filehandle:
{\small
\begin{verbatim}
$image->Read(filename=>'logo.gif'); # read a single GIF into
# $image object.
$image->Read('logo.jpg', 'button.gif'); # read two images.
$image->Read('*.png'); # read all the PNG files in the
# current directory.
$image->Read(file=>\*IMAGE); # read from open Perl filehandle.
\end{verbatim}
}
Read() returns the number of images that were successfully read.
\subsubsection{ReduceNoise()}
smooth an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$ReduceNoise(radius=$>$\var{float})
\end{quote}
The ReduceNoise() method smooths the contours of an image while still
preserving edge information. The algorithm works by replacing each
pixel with its neighbor closest in value. A neighbor is defined by
\texttt{radius}. Use a radius of 0 and ReduceNoise() selects a suitable
radius for you.
\subsubsection{Resize()}
scale an image with a filter.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Resize(geometry=$>$\var{geometry}, width=$>$\var{integer},
height=$>$\var{integer}, filter=$>$\var{string}, blur=$>$\var{float})
\end{quote}
Resize() scales an image to the desired dimensions with one of these filters:
\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Bessel \> Blackman \> Box \\
\> Catrom \> Cubic \> Gaussian \\
\> Hanning \> Hermite \> Lanczos \\
\> Mitchell \> Point \> Quadratic \\
\> Sinc \> Triangle \>
\end{tabbing}
The default is Lanczos.
Use \texttt{width} and \texttt{height} to specify the image size, or use
\texttt{geometry} as a shortcut (e.g. 640x480).
Set \texttt{Blur} to a value greater than 1 to blur the image as it is scaled.
A value less than 1 sharpens as the image is scaled.
\subsubsection{Roll()}
offset and roll over an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Roll(geometry=$>$\var{geometry}, x=$>$\var{integer},
y=$>$\var{integer})
\end{quote}
Roll() offsets an image as defined by \texttt{x} and \texttt{y}.
\texttt{Geometry} represents + x + y as one parameter (e.g. +10+20).
\subsubsection{Rotate()}
rotate an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Rotate(degrees=$>$\var{float}, color=$>$\var{color-name})
\end{quote}
Rotate() rotates an image around the x axis by the number of degrees by
\texttt{degrees}. Any empty spaces are filled with \texttt{color}.
\subsubsection{Sample()}
sample an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Sample(geometry=$>$\var{geometry}, width=$>$\var{integer},
height=$>$\var{integer})
\end{quote}
Sample() scales an image to the desired dimensions with pixel sampling.
Unlike other scaling methods, this method does not introduce any additional
color into the scaled image.
Use \texttt{width} and \texttt{height} to specify the image size, or use
\texttt{geometry} as a shortcut (e.g. 640x480).
\subsubsection{Scale()}
scale an image to given dimensions.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Scale(geometry=$>$\var{geometry}, width=$>$\var{integer},
height=$>$\var{integer})
\end{quote}
Scale() changes the size of an image to the given dimensions.
Use \texttt{width} and \texttt{height} to specify the image size, or use
\texttt{geometry} as a shortcut (e.g. 640x480).
\subsubsection{Segment()}
segment an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Segment(geometry=$>$\var{geometry},
cluster\_threshold=$>$\var{float}, smoothing\_threshold=$>$\var{float},
colorspace=$>$\var{string}, verbose=$>$\var{boolean})
\end{quote}
Segment() segments an image by by analyzing the histograms of the color
components and identifying units that are homogeneous. The default value
for \texttt{cluster\_threshold} is 1.0 and \texttt{smoothing\_threshold} is
1.5. This can be represented with a shortcut geometry of 1.0x1.5.
\subsubsection{Set()}
set an image attribute.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Set(\var{attribute}, ...)
\end{quote}
Set() accepts one or more image attributes listed in section
\ref{Image::Magick Attributes} and sets their value.
\subsubsection{Shade()}
shade the image with light source.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Shade(geometry=$>$\var{geometry}, azimuth=$>$\var{float},
elevation=$>$\var{float}, color=$>$\var{boolean})
\end{quote}
Shade() shines a distant light on an image to create a three-dimensional
effect. You control the positioning of the light with \var{azimuth} and
\var{elevation}; azimuth is measured in degrees off the x axis and elevation
is measured in pixels above the Z axis. The geometry parameter is a shortcut
for azimuth x elevation (e.g. 30x30).
\subsubsection{Sharpen()}
sharpen an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Sharpen(geometry=$>$\var{geometry}, radius=$>$\var{float},
sigma=$>$\var{float})
\end{quote}
Sharpen() sharpens an image. We convolve the image with a Gaussian operator
of the given radius and standard deviation (sigma). For reasonable results,
radius should be larger than sigma. Use a radius of 0 and Sharpen()
selects a suitable radius for you. \texttt{Geometry} represents
radius x sigma as one parameter (e.g. 0x1).
\subsubsection{Shave()}
shave pixels from the image edges.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Border(geometry=$>$\var{geometry}, width=$>$\var{integer},
height=$>$\var{integer})
\end{quote}
This method shaves pixels from the image edges.
\texttt{Geometry} represents {\it width x height} as one parameter (e.g. 10x5).
\subsubsection{Shear()}
shear an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Shear(geometry=$>$\var{geometry}, x=$>$\var{float},
y=$>$\var{float}, color=$>$\var{color-name})
\end{quote}
Shear() transforms an image by shearing it along the x or y axis.
The \texttt{x} and \texttt{y} parameters specify the degree of shear
and ranges from -179.9 to 179.9. \texttt{Geometry} represents
x x y as one parameter (e.g. 30x60). Any empty spaces created when shearing
are filled with \texttt{color}.
\subsubsection{Signature()}
generate an SHA-256 message digest.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Signature()
\end{quote}
Signature() generates an SHA-256 message digest across all the image pixels.
The signature can later be used to verify the color integrity of the image.
Two images with the same signature are identical.
\subsubsection{Solarize()}
apply solorization special effect.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Solarize(threshold=$>$\var{float})
\end{quote}
Solarize() applies a special effect to the image, similar to the effect
achieved in a photo darkroom by selectively exposing areas of photo
sensitive paper to light. \texttt{Threshold} ranges from 0 to MaxRGB
and is a measure of the extent of the solarization.
\subsubsection{Spread()}
randomly displace pixels.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Spread(amount=$>$\var{integer})
\end{quote}
Spead() is a special effects method that randomly displaces each pixel in a
block defined by the \texttt{amount} parameter.
\subsubsection{Stereo()}
create a stereo special effect.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Stereo(image=$>$\var{image-handle})
\end{quote}
Stereo() combines two images and produces a single image that is the
composite of a left and right image of a stereo pair. Special red-green
stereo glasses are required to view this effect.
\subsubsection{Stegano()}
hide a digital watermark.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Stegano(image=$>$\var{image-handle}, offset=$>$\var{integer})
\end{quote}
Use Stegano() to hide a digital watermark within the image. Recover the
hidden watermark later to prove that the authenticity of an image.
texttt{Offset} defines the start position within the image to hide the
watermark.
\subsubsection{Swirl()}
swirl pixels about image center.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Swirl(degrees=$>$\var{float})
\end{quote}
The Swirl() method swirls the pixels about the center of the image, where
\texttt{degrees} indicates the sweep of the arc through which each pixel
is moved. You get a more dramatic effect as the degrees move from
1 to 360.
\subsubsection{Texture()}
tile a texture on image background.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Texture(texture=$>$\var{image-handle})
\end{quote}
Texture() repeatedly tiles the texture image across and down the image
canvas.
\subsubsection{Threshold()}
divide pixels based on intensity values.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Threshold(threshold=$>$\var{integer})
\end{quote}
Threshold() changes the value of individual pixels based on the intensity
of each pixel compared to \texttt{threshold}. The result is a high-contrast,
two color image.
\subsubsection{Transform()}
resize or crop an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Transform(geometry=$>$\var{string}, crop=$>$\var{string})
\end{quote}
Transform() behaves like Resize() or Crop() but rather than acting on
the image, it returns a new image handle:
{\small
\begin{verbatim}
$slices = $image->Transform(crop=>'100x100')
\end{verbatim}
}
\subsubsection{Transparent()}
make color transparent.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Transparent(color=$>$\var{color-name}, opacity=$>$\var{integer}
fuzz=$>$\var{float})
\end{quote}
Transparent() changes the opacity value associated with any pixel that
matches \texttt{color} to the value defined by \texttt{opacity}.
By default \texttt{color} must match a particular pixel color exactly.
However, in many cases two colors may differ by a small amount.
\texttt{Fuzz} defines how much tolerance is acceptable to consider
two colors as the same. For example, set fuzz to 10 and the color red
at intensities of 100 and 102 respectively are now interpreted as the
same color.
\subsubsection{Trim()}
remove background color from edges of image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Trim(fuzz=$>$\var{float})
\end{quote}
Trim() crops a rectangular box around the image to remove edges that are the
background color.
By default the edge pixels must match in color exactly to be trimmed.
However, in many cases two colors may differ by a small amount.
\texttt{Fuzz} defines how much tolerance is acceptable to consider
two colors as the same. For example, set fuzz to 10 and the color red
at intensities of 100 and 102 respectively are now interpreted as the
same color.
\subsubsection{UnsharpMask()}
sharpen an image.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$UnsharpMask(geometry=$>$\var{geometry}, radius=$>$\var{float},
sigma=$>$\var{float}, amount=$>$\var{float}, threshold=$>$\var{float})
\end{quote}
UnsharpMask() sharpens an image. We convolve the image with a Gaussian operator
of the given radius and standard deviation (sigma). For reasonable results,
radius should be larger than sigma. Use a radius of 0 and UnsharpMask()
selects a suitable radius for you. \texttt{Geometry} represents
radius x sigma as one parameter (e.g. 0x1).
\subsubsection{Wave()}
special effects filter.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Wave(geometry=$>$\var{string}, amplitude=$>$\var{float},
wavelength=$>$\var{float})
\end{quote}
The Wave() filter creates a "ripple" effect in the image by shifting the
pixels vertically along a sine wave whose amplitude and wavelength is
specified by the given parameters. \texttt{Geometry} represents
amplitude x wavelength as one parameter (e.g. 30x30).
\subsubsection{Write()}
write one or more image files.
\begin{quote}
\hspace*{-0.25in}
\$image-$>$Write(filename=$>$\var{float}, file=$>$\var{file-handle})
\end{quote}
Write() allows you to write a single or image or a sequence to a file or
filehandle. You can specify more than one filename but only one filehandle:
{\small
\begin{verbatim}
$image->Write(filename=>'logo.gif'); # write a single GIF image.
$image->Write('logo.jpg', 'button.gif'); # write two images.
$image->Write('gif:-'); # write to STDOUT.
$image->[0]->Write('logo.png'); # write only first image
# in a sequence.
$image->Write(file=>\*IMAGE); # write to a open Perl filehandle.
\end{verbatim}
}
Write() returns the number of images that were written.
\section{Image::Magick Errors}
Most Image::Magick methods return an undefined value if the operation
was successful. When an error occurs, a message is returned with an
embedded numeric status code. Look up the status code in table
\ref{Error and Warning Codes} to determine the reason the operation failed.
The mnemonics are aliases for the the corresponding numeric codes.
\begin{longtable}{p{1cm} | p{4cm} | p{8cm}}
\caption{Error and Warning Codes} \\[0.5in]
\multicolumn{3}{c}{Error and Warning Codes}\\[0.5in]
\textbf{Code} & \textbf{Mnemonic} & \textbf{Description} \\ \hline
\endfirsthead
\multicolumn{3}{c}{Error and Warning Codes (continued)}\\[0.5in]
\textbf{Code} & \textbf{Mnemonic} & \textbf{Description} \\ \hline
\endhead
0 & Success & Method completed without an error or warning. \\
300 & ResourceLimitWarning & A program resource is exhausted (e.g. not enough memory). \\
305 & TypeWarning & A font is unavailable; a substitution may have occured. \\
310 & OptionWarning & An option parameter was malformed. \\
315 & DelegateWarning & An ImageMagick {\em delegate} returned a warning. \\
320 & MissingDelegateWarning & The image type can not be read or written because the required {\em delegate} is missing. \\
325 & CorruptImageWarning & The image file may be corrupt. \\
330 & FileOpenWarning & The image file could not be opened. \\
335 & BlobWarning & A Binary Large OBject could not be allocated. \\
340 & StreamWarning & There was a problem reading or writing from a stream. \\
345 & CacheWarning & Pixels could not be saved to the pixel cache. \\
385 & XServerWarning & An X resource is unavailable. \\
390 & RegistryWarning & There was a problem getting or setting the registry. \\
395 & ConfigureWarning & There was a problem getting a configuration file. \\
400 & ResourceLimitError & A program resource is exhausted (e.g. not enough memory). \\
405 & TypeError & A font is unavailable; a substitution may have occured. \\
410 & OptionError & An option parameter was malformed. \\
415 & DelegateError & An ImageMagick {\em delegate} returned a warning. \\
420 & MissingDelegateError & The image type can not be read or written because the required {\em delegate} is missing. \\
425 & CorruptImageError & The image file may be corrupt. \\
430 & FileOpenError & The image file could not be opened. \\
435 & BlobError & A Binary Large OBject could not be allocated. \\
440 & StreamError & There was a problem reading or writing from a stream. \\
445 & CacheError & Pixels could not be saved to the pixel cache. \\
485 & XServerError & An X resource is unavailable. \\
490 & RegistryError & There was a problem getting or setting the registry. \\
495 & ConfigureError & There was a problem getting a configuration file. \\
\end{longtable}
|