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 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007
|
\title{C API Methods}
\toctitle{C API Methods}
\titlerunning{C API Methods}
\maketitle
\section{Methods to Constitute an Image}
\subsection{ConstituteImage}
Method ConstituteImage is a convenience routine that creates an image from the pixel data you supply and returns it. It allocates the memory necessary for the new Image structure and returns a pointer to the new image. The pixel data must be in scanline order top-to-bottom. The data can be character, short int, integer, float, or double. Float and double require the pixels to be normalized [0..1]. The other types are [0..MaxRGB]. For example, to create a 640x480 image from unsigned red-green-blue character data, use
{\em image=ConstituteImage (640, 480, "RGB", 0, pixels, \&exception) }
\smallskip
{\em Image \*ConstituteImage (const unsigned int width, const unsigned int height, const char \*map, const StorageType type, const void \*pixels, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{image}]
Method Constitute returns a pointer to the image. A null image is returned if there is a memory shortage or if the image cannot be read.
\item[\textit{width}]
Specifies the width in pixels of the image.
\item[\textit{height}]
Specifies the height in pixels of the image.
\item[\textit{map}]
This character string can be any combination or order of R = red, G = green, B = blue, A = alpha, C = cyan, Y = yellow, M = magenta, and K = black. The ordering reflects the order of the pixels in the supplied pixel array.
\item[\textit{type}]
pixel type where 0 = unsigned char, 1 = short int, 2 = int, 3 = float, and 4 = double. Float and double types are expected to be normalized [0..1] otherwise [0..MaxRGB].
\item[\textit{pixels}]
This array of values contain the pixel components as defined by the map and type parameters. The length of the arrays must equal the area specified by the width and height values and type parameters.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{DispatchImage}
Method DispatchImage is a convenience routine. Use it to extract pixel data from an image and place it in a buffer you supply. The data is saved either as char, short int, integer, float or double format in the order specified by the type parameter. For example, we want to extract scanline 1 of a 640x480 image as character data in red-green-blue order:
{\em DispatchImage (image, 0, 0, 640, 1, "RGB", 0, pixels) }
\smallskip
{\em unsigned int DispatchImage (Image \*image, const int x, const int y, const unsigned int columns, const unsigned int rows, const char \*map, const StorageType type, void \*pixels) }
\smallskip
\begin{description}
\item[\textit{image}]
Specifies a pointer to a Image structure returned from ReadImage.
\item[\textit{x,y,columns,rows}]
These values define the perimeter of a region of pixels you want to extract.
\item[\textit{map}]
This character string can be any combination or order of R = red, G = green, B = blue, A = alpha, C = cyan, Y = yellow, M = magenta, and K = black. The ordering reflects the order of the pixels in the supplied pixel array.
\item[\textit{type}]
pixel type where 0 = unsigned char, 1 = short int, 2 = int, 3 = float, and 4 = double. Float and double types are expected to be normalized [0..1] otherwise [0..MaxRGB].
\item[\textit{pixels}]
This array of values contain the pixel components as defined by the map and type parameters. The length of the arrays must equal the area specified by the width and height values and type parameters.
\end{description}
\subsection{PingImage}
Method PingImage returns the image size in bytes if it exists and can be the image is returned as well. Note, only the first image in a multi-frame image file is pinged.
\smallskip
{\em Image \*PingImage (const ImageInfo \*image\_info, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{Image}]
Method PingImage returns the image size in bytes if the image file exists and it size can be determined otherwise 0.
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{ReadImage}
Method ReadImage reads an image and returns it. It allocates the memory necessary for the new Image structure and returns a pointer to the new image. By default, the image format is determined by its magic number. To specify a particular image format, precede the filename with an explicit image format name and a colon (i.e. ps:image) or as the filename suffix (i.e. image.ps).
\smallskip
{\em Image \*ReadImage (const ImageInfo \*image\_info, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{image}]
Method ReadImage returns a pointer to the image after reading. A null image is returned if there is a memory shortage or if the image cannot be read.
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{ReadImages}
Method ReadImages reads a list of image names from a file and then returns the images as a linked list.
\smallskip
{\em Image \*ReadImages (const ImageInfo \*image\_info, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{image}]
Method ReadImage returns a pointer to the image after reading. A null image is returned if there is a memory shortage or if the image cannot be read.
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\end{description}
\subsection{WriteImage}
Method WriteImage writes an image to a file as defined by image->filename. You can specify a particular image format by prefixing the file with the image type and a colon (i.e. ps:image) or specify the image type as the filename suffix (i.e. image.ps). The image may be modified to adapt it to the requirements of the image format. For example, DirectClass images must be color-reduced to PseudoClass if the format is GIF.
\smallskip
{\em unsigned int WriteImage (const ImageInfo \*image\_info, Image \*image) }
\smallskip
\begin{description}
\item[\textit{status}]
Method WriteImage return True if the image is written. False is returned is there is a memory shortage or if the image file fails to write.
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\item[\textit{image}]
A pointer to a Image structure.
\end{description}
\section{ImageMagick Image Methods}
\subsection{AllocateImage}
Method AllocateImage allocates an Image structure and initializes each field to a default value.
\smallskip
{\em Image \*AllocateImage (const ImageInfo \*image\_info) }
\smallskip
\begin{description}
\item[\textit{allocate\_image}]
Method AllocateImage returns a pointer to an image structure initialized to default values. A null image is returned if there is a memory shortage.
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\end{description}
\subsection{AllocateImageColormap}
Method AllocateImageColormap allocates an Image colormap and initializes it. The minimum number of colormap cells allocated is 256.
\smallskip
{\em unsigned int AllocateImageColormap (Image \*image, const unsigned int colors) }
\smallskip
\begin{description}
\item[\textit{status}]
Method AllocateImageColormap returns True if the colormap is successfully allocated and initialized, otherwise False.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{colors}]
The number of colors in the image colormap.
\end{description}
\subsection{AllocateNextImage}
Method AllocateNextImage allocates an Image structure and initializes each field to a default value.
\smallskip
{\em void AllocateNextImage (const ImageInfo \*image\_info, Image \*image) }
\smallskip
\begin{description}
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{AnimateImages}
Method AnimateImages displays one or more images to an X window.
\smallskip
{\em unsigned int AnimateImages (const ImageInfo \*image\_info, Image \*image) }
\smallskip
\begin{description}
\item[\textit{status}]
Method AnimateImages returns True if the images are displayed in an X window, otherwise False is returned.
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{AppendImages}
Method AppendImages appends a sequence of images. All the input images must have the same width or height. Images of the same width are stacked top-to-bottom. Images of the same height are stacked left-to-right. If stack is false, rectangular images are stacked left-to-right otherwise top-to-bottom.
\smallskip
{\em Image \*AppendImages (Image \*image, const unsigned int stack, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{stack}]
An unsigned value other than stacks rectangular image top-to-bottom otherwise left-to-right.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{AverageImages}
Method AverageImages averages a sequence of images. All the input image must be the same size in pixels.
\smallskip
{\em Image \*AverageImages (const Image \*image, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{average\_image}]
Method AverageImages returns the mean pixel value for an image sequence.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{ChannelImage}
Method ChannelImage extracts the specified channel from the referenced image.
\smallskip
{\em unsigned int ChannelImage (Image \*image, const ChannelType channel) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{channel}]
A value of type ChannelType that identifies which channel to extract.
\end{description}
\subsection{CloneImage}
Method CloneImage clones an image. If the specified columns and rows is 0, an exact copy of the image is returned, otherwise the pixel data is undefined and must be initialized with SetImagePixels() and SyncImagePixels() methods.
\smallskip
{\em Image \*CloneImage (Image \*image, const unsigned int columns, const unsigned int rows, const unsigned int orphan, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{clone\_image}]
Method CloneImage returns a pointer to the image after copying. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{columns}]
An integer that specifies the number of columns in the copied image.
\item[\textit{rows}]
An integer that specifies the number of rows in the copied image.
\item[\textit{orphan}]
if true, consider this image an orphan.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{CloneImageInfo}
Method CloneImageInfo makes a duplicate of the given image info, or if image info is NULL, a new one.
\smallskip
{\em ImageInfo \*CloneImageInfo (const ImageInfo \*image\_info) }
\smallskip
\begin{description}
\item[\textit{clone\_info}]
Method CloneImageInfo returns a duplicate of the given image info, or if image info is NULL a new one.
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\end{description}
\subsection{CompositeImage}
Method CompositeImage returns the second image composited onto the first at the specified offsets.
\smallskip
{\em unsigned int CompositeImage (Image \*image, const CompositeOperator compose, Image \*composite\_image, const int x\_offset, const int y\_offset) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{compose}]
Specifies an image composite operator.
\item[\textit{composite\_image}]
The address of a structure of type Image.
\item[\textit{x\_offset}]
An integer that specifies the column offset of the composited image.
\item[\textit{y\_offset}]
An integer that specifies the row offset of the composited image.
\end{description}
\subsection{CycleColormapImage}
Method CycleColormapImage cycles the image colormap by a specified amount.
\smallskip
{\em CycleColormapImage (image, amount) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{amount}]
An unsigned value that specifies the offset of the colormap.
\end{description}
\subsection{DescribeImage}
Method DescribeImage describes an image by printing its attributes to stdout.
\smallskip
{\em void DescribeImage (Image \*image, FILE \*file, const unsigned int verbose) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{file}]
send the image attributes to this file.
\item[\textit{verbose}]
an unsigned value other than zero prints detailed information about the image.
\end{description}
\subsection{DestroyImage}
Method DestroyImage deallocates memory associated with an image.
\smallskip
{\em void DestroyImage (Image \*image) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{DestroyImageInfo}
Method DestroyImageInfo deallocates memory associated with an ImageInfo structure.
\smallskip
{\em void DestroyImageInfo (ImageInfo \*image\_info) }
\smallskip
\begin{description}
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\end{description}
\subsection{DestroyImages}
Method DestroyImages deallocates memory associated with a linked list of images.
\smallskip
{\em void DestroyImages (Image \*image) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{DisplayImages}
Method DisplayImages displays one or more images to an X window.
\smallskip
{\em unsigned int DisplayImages (const ImageInfo \*image\_info, Image \*image) }
\smallskip
\begin{description}
\item[\textit{status}]
Method DisplayImages returns True if the images are displayed in an X window, otherwise False is returned.
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{GetImageBoundingBox}
Method GetImageBoundingBox returns the bounding box of an image canvas.
\smallskip
{\em RectangleInfo GetImageBoundingBox (Image \*image) }
\smallskip
\begin{description}
\item[\textit{bounds}]
Method GetImageBoundingBox returns the bounding box of an image canvas.
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{GetImageDepth}
Method GetImageDepth returns the depth of the image.
\smallskip
{\em unsigned int GetImageDepth (Image \*image) }
\smallskip
\begin{description}
\item[\textit{depth}]
Method GetImageDepth returns the depth of the image.
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{GetImageInfo}
Method GetImageInfo initializes the ImageInfo structure.
\smallskip
{\em void GetImageInfo (ImageInfo \*image\_info) }
\smallskip
\begin{description}
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\end{description}
\subsection{GetImageType}
Method GetImageType returns the type of image (e.g. bilevel, palette, etc).
\smallskip
{\em ImageType GetImageType (Image \*image) }
\smallskip
\begin{description}
\item[\textit{type}]
Method GetImageType returns a ImageType enum that specifies the type of the specified image (e.g. bilevel, palette, etc).
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{GetNextImage}
Method GetNextImage returns the next image in an image sequence.
\smallskip
{\em Image \*GetNextImage (Image \*image) }
\smallskip
\begin{description}
\item[\textit{next}]
Method GetNextImage returns the next image in an image sequence.
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{GetNumberScenes}
Method GetNumberScenes returns the number of scenes in an image sequence.
\smallskip
{\em unsigned int GetNumberScenes (const Image \*image) }
\smallskip
\begin{description}
\item[\textit{scenes}]
Method GetNumberScenes returns the number of scenes in an image sequence.
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{GetPageInfo}
Method GetPageInfo initializes the image page structure.
\smallskip
{\em void GetPageInfo (RectangleInfo \*page) }
\smallskip
\begin{description}
\item[\textit{page}]
Specifies a pointer to a RectangleInfo structure.
\end{description}
\subsection{GetPixelPacket}
Method GetPixelPacket initializes the PixelPacket structure.
\smallskip
{\em void GetPixelPacket (PixelPacket \*pixel) }
\smallskip
\begin{description}
\item[\textit{pixel}]
Specifies a pointer to a PixelPacket structure.
\end{description}
\subsection{IsGeometry}
Method IsGeometry returns True if the geometry specification is valid as determined by ParseGeometry.
\smallskip
{\em unsigned int IsGeometry (const char \*geometry) }
\smallskip
\begin{description}
\item[\textit{status}]
Method IsGeometry returns True if the geometry specification is valid otherwise False is returned.
\item[\textit{geometry}]
This string is the geometry specification.
\end{description}
\subsection{IsImagesEqual}
Method IsImagesEqual measures the difference between two images. The error is computed by summing over all pixels in an image the distance squared in RGB space between each image pixel and its corresponding pixel in the reference image. These values are computed:
\begin{description}
\item[\textit{mean\_error\_per\_pixel}]
This value is the mean error for any single pixel in the image.
\item[\textit{normalized\_mean\_square\_error}]
This value is the normalized mean quantization error for any single pixel in the image. This distance measure is normalized to a range between 0 and 1. It is independent of the range of red, green, and blue values in the image.
\item[\textit{normalized\_maximum\_square\_error}]
Thsi value is the normalized maximum quantization error for any single pixel in the image. This distance measure is normalized to a range between 0 and 1. It is independent of the range of red, green, and blue values in your image.
\end{description}
\smallskip
{\em unsigned int IsImagesEqual (Image \*image, Image \*reference) }
\begin{description}
\item[\textit{image}]
Specifies a pointer to an Image structure.
\item[\textit{reference}]
Specifies a pointer to an Image structure.
\end{description}
\subsection{IsTaintImage}
Method IsTaintImage returns True if the image has been altered since it was first read or if any image in the sequence has a difference magic or filename.
\smallskip
{\em unsigned int IsTaintImage (const Image \*image) }
\smallskip
\begin{description}
\item[\textit{status}]
Method IsTaintImage returns True if the image has been altered since it was first read.
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{IsSubimage}
Method IsSubimage returns True if the geometry is a valid subimage specification (e.g. [1], [1-9], [1,7,4]).
\smallskip
{\em unsigned int IsSubimage (const char \*geometry, const unsigned int pedantic) }
\smallskip
\begin{description}
\item[\textit{status}]
Method IsSubimage returns True if the geometry is a valid subimage specification otherwise False is returned.
\item[\textit{geometry}]
This string is the geometry specification.
\item[\textit{pedantic}]
A value other than 0 invokes a more restriction set of conditions for a valid specification (e.g. [1], [1-4], [4-1]).
\end{description}
\subsection{ListToGroupImage}
Method ListToGroupImage converts a linked list of images to a sequential array.
\smallskip
{\em Image \*\*ListToGroupImage (Image \*image, unsigned int \*number\_images) }
\smallskip
\begin{description}
\item[\textit{images}]
Method ListToGroupImage converts a linked list of images to a sequential array and returns the array..
\item[\textit{images}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{number\_images}]
A pointer to an unsigned integer. The number of images in the image array is returned here.
\end{description}
\subsection{MogrifyImage}
Method MogrifyImage applies image processing options to an image as prescribed by command line options.
\smallskip
{\em unsigned int MogrifyImage (const ImageInfo \*image\_info, const int argc, char \*\*argv, Image \*\*image) }
\smallskip
\begin{description}
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\item[\textit{argc}]
Specifies a pointer to an integer describing the number of elements in the argument vector.
\item[\textit{argv}]
Specifies a pointer to a text array containing the command line arguments.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\end{description}
\subsection{MogrifyImages}
Method MogrifyImages applies next processing options to a sequence of images as prescribed by command line options.
\smallskip
{\em unsigned int MogrifyImages (const ImageInfo \*next\_info, const int argc, char \*\*argv, Image \*\*image) }
\smallskip
\begin{description}
\item[\textit{next\_info}]
Specifies a pointer to an ImageInfo structure.
\item[\textit{argc}]
Specifies a pointer to an integer describing the number of elements in the argument vector.
\item[\textit{argv}]
Specifies a pointer to a text array containing the command line arguments.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\end{description}
\subsection{MosaicImages}
Method MosaicImages inlays a number of image to form a single coherent picture.
\smallskip
{\em Image \*MosaicImages (const Image \*image, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{ParseImageGeometry}
Method ParseImageGeometry parses a geometry specification and returns the width, height, x, and y values. It also returns flags that indicates which of the four values (width, height, xoffset, yoffset) were located in the string, and whether the x and y values are negative. In addition,
\smallskip
{\em int ParseImageGeometry (const char \*geometry, int \*x, int \*y, unsigned int \*width, unsigned int \*height) }
\smallskip
\begin{description}
\item[\textit{flags}]
Method ParseImageGeometry returns a bitmask that indicates which of the four values were located in the geometry string.
\item[\textit{image\_geometry}]
Specifies a character string representing the geometry specification.
\item[\textit{x,y}]
A pointer to an integer. The x and y offset as determined by the geometry specification is returned here.
\item[\textit{width,height}]
A pointer to an unsigned integer. The width and height as determined by the geometry specification is returned here.
\end{description}
\subsection{RGBTransformImage}
Method RGBTransformImage converts the reference image from RGB to an alternate colorspace. The transformation matrices are not the standard ones: the weights are rescaled to normalized the range of the transformed values to be [0..MaxRGB].
\smallskip
{\em unsigned int RGBTransformImage (Image \*image, const ColorspaceType colorspace) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{colorspace}]
An unsigned integer value that indicates which colorspace to transform the image.
\end{description}
\subsection{SetImage}
Method SetImage initializes the reference image to the background color.
\smallskip
{\em void SetImage (Image \*image, opacity) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{opacity}]
The transparency of the background color.
\end{description}
\subsection{SetImageDepth}
Method SetImageDepth sets the depth of the image.
\smallskip
{\em unsigned int SetImageDepth (Image \*image, const unsigned int) }
\smallskip
\begin{description}
\item[\textit{status}]
Method SetImageDepth returns True if the image depth is set.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{depth}]
specified the image depth.
\end{description}
\subsection{SetImageInfo}
Method SetImageInfo initializes the `magick' field of the ImageInfo structure. It is set to a type of image format based on the prefix or suffix of the filename. For example, `ps:image' returns PS indicating a Postscript image. JPEG is returned for this filename: `image.jpg'. The filename prefix has precendence over the suffix. Use an optional index enclosed in brackets after a file name to specify a desired subimage of a multi-resolution image format like Photo CD (e.g. img0001.pcd[4]).
\smallskip
{\em unsigned int SetImageInfo (ImageInfo \*image\_info, const unsigned int rectify) }
\smallskip
\begin{description}
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\item[\textit{rectify}]
an unsigned value other than zero rectifies the attribute for multi-frame support (user may want multi-frame but image format may not support it).
\end{description}
\subsection{SetImageOpacity}
Method SetImageOpacity initializes the opacity channel of the reference image to the specified value. If the image already has a matte channel it is attenuated with the opacity value.
\smallskip
{\em void SetImageOpacity (Image \*image, const unsigned int opacity) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{opacity}]
The level of transparency.
\end{description}
\subsection{SortColormapByIntentsity}
Method SortColormapByIntensity sorts the colormap of a PseudoClass image by decreasing color intensity.
\smallskip
unsigned int SortColormapByIntensity(Image \*image)
\smallskip
\begin{description}
\item[\textit{image}]
A pointer to a Image structure.
\end{description}
\subsection{SyncImage}
Method SyncImage initializes the red, green, and blue intensities of each pixel as defined by the colormap index.
\smallskip
{\em void SyncImage (Image \*image) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{TextureImage}
Method TextureImage layers a texture onto the background of an image.
\smallskip
{\em void TextureImage (Image \*image, Image \*texture) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{texture}]
This image contains the texture to layer on the background.
\end{description}
\subsection{TransformRGBImage}
Method TransformRGBImage converts the reference image from an alternate colorspace. The transformation matrices are not the standard ones: the weights are rescaled to normalize the range of the transformed values to be [0..MaxRGB].
\smallskip
{\em unsigned int TransformRGBImage (Image \*image, const ColorspaceType colorspace) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{colorspace}]
An unsigned integer value defines which colorspace to transform the image to.
\end{description}
\section{Methods to Resize an Image}
\subsection{MagnifyImage}
Method MagnifyImage creates a new image that is a integral size greater than an existing one. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
MagnifyImage scans the reference image to create a magnify image by bilinear interpolation. The magnify image columns and rows become:
number\_columns << 1
number\_rows << 1
\smallskip
{\em magnify\_image=MagnifyImage (image, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{magnify\_image}]
Method MagnifyImage returns a pointer to the image after magnification. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{MinifyImage}
Method MinifyImage creates a new image that is a integral size less than an existing one. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
MinifyImage scans the reference image to create a minified image by computing the weighted average of a 4x4 cell centered at each reference pixel. The target pixel requires two columns and two rows of the reference pixels. Therefore the minified image columns and rows become:
number\_columns/2
number\_rows/2
Weights assume that the importance of neighboring pixels is negately proportional to the square of their distance from the target pixel.
The scan only processes pixels that have a full set of neighbors. Pixels in the top, bottom, left, and right pairs of rows and columns are omitted from the scan.
\smallskip
{\em Image \*MinifyImage (Image \*image, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{minify\_image}]
Method MinifyImage returns a pointer to the image after reducing. A null image is returned if there is a memory shortage or if the image size is less than IconSize\*2.
\item[\textit{image}]
The address of a structur of type Image.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{ResizeImage}
Method ResizeImage creates a new image that is a scaled size of an existing one. It allocates the memory necessary for the new Image structure and returns a pointer to the new image. The Point filter gives fast pixel replication, Triangle is equivalent to bi-linear interpolation, and Mitchel giver slower, very high-quality results. See Graphic Gems III for details on this algorithm.
\smallskip
{\em Image \*ResizeImage (Image \*image, const unsigned int columns, const unsigned int rows, const FilterType filter, const double blur, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{resize\_image}]
Method ResizeImage returns a pointer to the image after scaling. A null image is returned if there is a memory shortage.
\item[\textit{image}]
the address of a structure of type Image.
\item[\textit{columns}]
an integer that specifies the number of columns in the resize image.
\item[\textit{rows}]
an integer that specifies the number of rows in the scaled image.
\item[\textit{filter}]
specifies which image filter to use.
\item[\textit{blur}]
specifies the blur factor where > 1 is blurry, < 1 is sharp.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{SampleImage}
Method SampleImage creates a new image that is a scaled size of an existing one using pixel sampling. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*SampleImage (Image \*image, const unsigned int columns, const unsigned int rows, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{sample\_image}]
Method SampleImage returns a pointer to the image after scaling. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{columns}]
An integer that specifies the number of columns in the sampled image.
\item[\textit{rows}]
An integer that specifies the number of rows in the sampled image.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{ScaleImage}
Method ScaleImage creates a new image that is a scaled size of an existing one. It allocates the memory necessary for the new Image structure and returns a pointer to the new image. To scale a scanline from x pixels to y pixels, each new pixel represents x/y old pixels. To read x/y pixels, read (x/y rounded up) pixels but only count the required fraction of the last old pixel read in your new pixel. The remainder of the old pixel will be counted in the next new pixel.
The scaling algorithm was suggested by rjohnson@shell.com and is adapted from pnmscale(1) of PBMPLUS by Jef Poskanzer.
\smallskip
{\em Image \*ScaleImage (Image \*image, const unsigned int columns, const unsigned int rows, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{scale\_image}]
Method ScaleImage returns a pointer to the image after scaling. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{columns}]
An integer that specifies the number of columns in the scaled image.
\item[\textit{rows}]
An integer that specifies the number of rows in the scaled image.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{ZoomImage}
Method ZoomImage creates a new image that is a scaled size of an existing one. It allocates the memory necessary for the new Image structure and returns a pointer to the new image. The Point filter gives fast pixel replication, Triangle is equivalent to bi-linear interpolation, and Mitchel giver slower, very high-quality results. See Graphic Gems III for details on this algorithm.
The filter member of the Image structure specifies which image filter to use. Blur specifies the blur factor where > 1 is blurry, < 1 is sharp.
\smallskip
{\em Image \*ZoomImage (Image \*image, const unsigned int columns, const unsigned int rows, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{zoom\_image}]
Method ZoomImage returns a pointer to the image after scaling. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{columns}]
An integer that specifies the number of columns in the zoom image.
\item[\textit{rows}]
An integer that specifies the number of rows in the scaled image.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\section{Methods to Transform an Image}
\subsection{ChopImage}
Method ChopImage creates a new image that is a subregion of an existing one. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*ChopImage (Image \*image, const RectangleInfo \*chop\_info) }
ExceptionInfo \*exception)
\smallskip
\begin{description}
\item[\textit{chop\_image}]
Method ChopImage returns a pointer to the chop image. A null image is returned if there is a memory shortage or if the image width or height is zero.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{chop\_info}]
Specifies a pointer to a RectangleInfo which defines the region of the image to crop.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{CoalesceImages}
Method CoalesceImages merges a sequence of images. This is useful for GIF and MNG animation sequences that have page offsets and disposal methods.
\smallskip
{\em Image \*CoalesceImages (Image \*image, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage. It points to the first image in the group to be coalesced.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{CropImage}
Method CropImage creates a new image that is a subregion of an existing one. It allocates the memory necessary for the new Image structure and returns a pointer to the new image. This method is optimized to preserve the runlength encoding. That is, the crop image will always use less memory than the original.
\smallskip
{\em Image \*CropImage (Image \*image, const RectangleInfo \*crop\_info, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{crop\_image}]
Method CropImage returns a pointer to the crop image. A null image is returned if there is a memory shortage or if the image width or height is zero.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{crop\_info}]
Specifies a pointer to a RectangleInfo which defines the region of the image to crop.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{DeconstructImages}
Method DeconstructImages breaks down an image sequence into constituent parts. This is useful for creating GIF or MNG animation sequences.
\smallskip
{\em Image \*DeconstructImages (Image \*image, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage. It points to the first next in the group to be deconstructed.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{FlipImage}
Method FlipImage creates a new image that reflects each scanline in the vertical direction It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*FlipImage (Image \*image, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{flip\_image}]
Method FlipImage returns a pointer to the image after reflecting. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{FlopImage}
Method FlopImage creates a new image that reflects each scanline in the horizontal direction It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*FlopImage (Image \*image, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{flop\_image}]
Method FlopImage returns a pointer to the image after reflecting. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{ProfileImage}
Method ProfileImage removes or adds a ICM, IPTC, or generic profile to an image. If the profile name is specified it is deleted from the image. If a filename is specified, one or more profiles are read and added to the image.
\smallskip
{\em unsigned int ProfileImage (Image \*image, const char \*profile\_name, const char \*filename) }
\smallskip
\begin{description}
\item[\textit{status}]
Method ProfileImage returns True if the profile is successfully added or removed from the image, otherwise False.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{profile\_name}]
Specifies the type of profile to add or remove.
\item[\textit{filename}]
Specifies the filename of the ICM or IPTC profile.
\end{description}
\subsection{RollImage}
Method RollImage rolls an image vertically and horizontally. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*RollImage (Image \*image, const int x\_offset, const int y\_offset, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{roll\_image}]
Method RollImage returns a pointer to the image after rolling. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{x\_offset}]
An integer that specifies the number of columns to roll in the horizontal direction.
\item[\textit{y\_offset}]
An integer that specifies the number of rows to roll in the vertical direction.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{TransformImage}
Method TransformImage creates a new image that is a transformed size of of existing one as specified by the crop and image geometries. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
If a crop geometry is specified a subregion of the image is obtained. If the specified image size, as defined by the image and scale geometries, is smaller than the actual image size, the image is first minified to an integral of the specified image size with an antialias digital filter. The image is then scaled to the exact specified image size with pixel replication. If the specified image size is greater than the actual image size, the image is first enlarged to an integral of the specified image size with bilinear interpolation. The image is then scaled to the exact specified image size with pixel replication.
\smallskip
{\em void TransformImage (Image \*\*image, const char \*crop\_geometry, const char \*image\_geometry) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of an address of a structure of type Image. The transformed image is returned as this parameter.
\item[\textit{crop\_geometry}]
Specifies a pointer to a crop geometry string. This geometry defines a subregion of the image.
\item[\textit{image\_geometry}]
Specifies a pointer to a image geometry string. The specified width and height of this geometry string are absolute.
\end{description}
\section{Methods to Draw on an Image}
\subsection{CloneDrawInfo}
Method CloneDrawInfo makes a duplicate of the given draw info, or if draw info is NULL, a new one.
\smallskip
{\em DrawInfo \*CloneDrawInfo (const ImageInfo \*image\_info, const DrawInfo \*draw\_info) }
\smallskip
\begin{description}
\item[\textit{clone\_info}]
Method CloneDrawInfo returns a duplicate of the given annotate info, or if annotate info is NULL a new one.
\item[\textit{image\_info}]
a structure of type ImageInfo.
\item[\textit{draw\_info}]
a structure of type DrawInfo.
\end{description}
\subsection{ColorFloodfillImage}
Method ColorFloodfillImage floodfills the designated area with a color. The floodfill algorithm is strongly based on a similar algorithm in "Graphics Gems" by Paul Heckbert.
\smallskip
{\em unsigned int ColorFloodfillImage (Image \*image, const DrawInfo \*draw\_info, const PixelPacket target, const int x\_offset, const int y\_offset, const PaintMethod method) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{draw\_info}]
a structure of type DrawInfo.
\item[\textit{target}]
A PixelPacket structure. This is the RGB value of the target color.
\item[\textit{x,y}]
Unsigned integers representing the current location of the pen.
\item[\textit{method}]
drawing method of type PrimitiveType: floodfill or fill to border.
\end{description}
\subsection{DestroyDrawInfo}
Method DestroyDrawInfo deallocates memory associated with an DrawInfo structure.
\smallskip
{\em void DestroyDrawInfo (DrawInfo \*draw\_info) }
\smallskip
\begin{description}
\item[\textit{draw\_info}]
Specifies a pointer to an DrawInfo structure.
\end{description}
\subsection{DrawImage}
Method DrawImage draws a primitive (line, rectangle, ellipse) on the image.
\smallskip
{\em unsigned int DrawImage (Image \*image, const DrawInfo \*draw\_info) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{draw\_info}]
The address of a DrawInfo structure.
\end{description}
\subsection{GetDrawInfo}
Method GetDrawInfo initializes the DrawInfo structure.
\smallskip
{\em void GetDrawInfo (const ImageInfo \*image\_info, DrawInfo \*draw\_info) }
\smallskip
\begin{description}
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\item[\textit{draw\_info}]
Specifies a pointer to a DrawInfo structure.
\end{description}
\subsection{MatteFloodfillImage}
Method MatteFloodfillImage floodfills the designated area with a matte value. The floodfill algorithm is strongly based on a similar algorithm in "Graphics Gems" by Paul Heckbert.
\smallskip
{\em unsigned int MatteFloodfillImage (Image \*image, const PixelPacket target, const unsigned int matte, const int x\_offset, const int y\_offset, const PaintMethod method) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{target}]
A PixelPacket structure. This is the RGB value of the target color.
\item[\textit{matte}]
A integer value representing the amount of transparency.
\item[\textit{x,y}]
Unsigned integers representing the current location of the pen.
\item[\textit{method}]
drawing method of type PrimitiveType: floodfill or fill to border.
\end{description}
\subsection{OpaqueImage}
Method OpaqueImage changes the color of an opaque point to the pen color.
\smallskip
{\em unsigned int OpaqueImage (Image \*image, const PixelPacket target, const PixelPacket pen\_color) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{target}]
the color to search for in the image.
\item[\textit{pen\_color}]
the color to replace it with.
\end{description}
\subsection{TransparentImage}
Method TransparentImage creates a matte image associated with the image. All pixel locations are initially set to opaque. Any pixel that matches the specified color are set to transparent.
\smallskip
{\em unsigned int TransparentImage (Image \*image, const PixelPacket target) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{target}]
The color to search for in the image.
\end{description}
\section{Methods to Annotate an Image}
\subsection{AnnotateImage}
Method AnnotateImage annotates an image with text. Optionally the annotation can include the image filename, type, width, height, or scene
\smallskip
{\em unsigned int AnnotateImage (Image \*image, DrawInfo \*draw\_info) }
\smallskip
\begin{description}
\item[\textit{status}]
Method AnnotateImage returns True if the image is annotated otherwise False.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{draw\_info}]
The address of a DrawInfo structure.
\end{description}
\subsection{GetTypeMetrics}
Method GetTypeMetrics returns the following information for the specified font and text:
\begin{description}
\item[\textit{o}]
character width, expressed in integer pixels o character height, expressed in integer pixels o ascent, expressed in 26.6 fixed point pixels o descent, expressed in 26.6 fixed point pixels o text width, expressed in 26.6 fixed point pixels o text height, expressed in 26.6 fixed point pixels o maximum horizontal advance, expressed in 26.6 fixed point pixels
\end{description}
\smallskip
{\em unsigned int GetTypeMetrics (Image \*image, const DrawInfo \*draw\_info, FontMetric metrics) }
\smallskip
\begin{description}
\item[\textit{status}]
Method GetTypeMetrics returns True if the metrics are available otherwise False.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{draw\_info}]
Specifies a pointer to a DrawInfo structure.
\item[\textit{metrics}]
Method GetTypeMetrics returns the font metrics.
\end{description}
\section{Methods to Count the Colors in an Image}
\subsection{CompressColormap}
Method CompressColormap compresses an image colormap removing any duplicate and unused color entries.
\smallskip
{\em void CompressColormap (Image \*image) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{GetNumberColors}
Method GetNumberColors returns the number of unique colors in an image.
\smallskip
{\em number\_colors=GetNumberColors (image, file) }
\begin{description}
\item[\textit{number\_colors}]
Method GetNumberColors returns the number of unique colors in the specified image.
\item[\textit{image}]
The address of a byte (8 bits) array of run-length encoded pixel data of your source image. The sum of the run-length counts in the source image must be equal to or exceed the number of pixels.
\item[\textit{file}]
An pointer to a FILE. If it is non-null a list of unique pixel field values and the number of times each occurs in the image is written to the file.
\end{description}
\subsection{IsGrayImage}
Method IsGrayImage returns True if the image is grayscale otherwise False is returned. If the image is DirectClass and grayscale, it is demoted to PseudoClass.
\smallskip
{\em unsigned int IsGrayImage (Image \*image) }
\smallskip
\begin{description}
\item[\textit{status}]
Method IsGrayImage returns True if the image is grayscale otherwise False is returned.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\end{description}
\subsection{IsMonochromeImage}
Method IsMonochromeImage returns True if the image is monochrome otherwise False is returned. If the image is DirectClass and grayscale (including monochrome), it is demoted to PseudoClass.
\smallskip
{\em status=IsMonochromeImage (image) }
\smallskip
\begin{description}
\item[\textit{status}]
Method IsMonochromeImage returns True if the image is monochrome otherwise False is returned.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\end{description}
\subsection{IsOpaqueImage}
Method IsOpaqueImage returns False if the image has one or more pixels that are transparent otherwise True is returned.
\smallskip
{\em unsigned int IsOpaqueImage (Image \*image) }
\smallskip
\begin{description}
\item[\textit{status}]
Method IsOpaqueImage returns False if the image has one or more pixels that are transparent otherwise True is returned.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\end{description}
\subsection{IsPseudoClass}
Method IsPseudoClass returns True if the image is PseudoClass and has 256 unique colors or less. If the image is DirectClass and has 256 colors or less, the image is demoted to PseudoClass.
\smallskip
{\em unsigned int IsPseudoClass (Image \*image) }
\begin{description}
\item[\textit{status}]
Method IsPseudoClass returns True is the image is PseudoClass or has 256 color or less.
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{ListColors}
Method ListColors reads the X client color database and returns a list of colors contained in the database sorted in ascending alphabetic order.
\smallskip
{\em filelist=ListColors (pattern, number\_colors) }
\smallskip
\begin{description}
\item[\textit{filelist}]
Method ListColors returns a list of colors contained in the database. If the database cannot be read, a NULL list is returned.
\item[\textit{pattern}]
Specifies a pointer to a text string containing a pattern.
\item[\textit{number\_colors}]
This integer returns the number of colors in the list.
\end{description}
\subsection{QueryColorDatabase}
Method QueryColorDatabase looks up a RGB values for a color given in the target string.
\smallskip
{\em unsigned int QueryColorDatabase (const char \*target, PixelPacket \*color) }
\smallskip
\begin{description}
\item[\textit{status}]
Method QueryColorDatabase returns True if the RGB values of the target color is defined, otherwise False is returned.
\item[\textit{target}]
Specifies the color to lookup in the X color database.
\item[\textit{color}]
A pointer to an PixelPacket structure. The RGB value of the target color is returned as this value.
\end{description}
\subsection{QueryColorName}
Method QueryColorName returns the name of the color that is closest to the supplied color in RGB space.
\smallskip
{\em unsigned int QueryColorName (const PixelPacket \*color, char \*name) }
\begin{description}
\item[\textit{distance}]
Method QueryColorName returns the distance-squared in RGB space as well as the color name that is at a minimum distance.
\item[\textit{color}]
This is a pointer to a PixelPacket structure that contains the color we are searching for.
\item[\textit{name}]
The name of the color that is closest to the supplied color is returned in this character buffer.
\end{description}
\section{ImageMagick Image Decoration Methods}
\subsection{BorderImage}
Method BorderImage takes an image and puts a border around it of a particular color. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*BorderImage (const Image \*image, const RectangleInfo \*border\_info, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{border\_image}]
Method BorderImage returns a pointer to the border image. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{border\_info}]
Specifies a pointer to a structure of type Rectangle which defines the border region.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{FrameImage}
Method FrameImage takes an image and puts a frame around it of a particular color. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*FrameImage (Image \*image, const FrameInfo \*frame\_info, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{frame\_image}]
Method FrameImage returns a pointer to the framed image. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{frame\_info}]
Specifies a pointer to a FrameInfo structure which defines the framed region.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{RaiseImage}
Method RaiseImage lightens and darkens the edges of an image to give a 3-D raised or lower effect.
\smallskip
{\em unsigned int RaiseImage (Image \*image, const RectangleInfo \*raise\_info, const int raised) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{raise\_info}]
Specifies a pointer to a XRectangle which defines the raised region.
\item[\textit{raised}]
A value other than zero causes the image to have a 3-D raised effect, otherwise it has a lowered effect.
\end{description}
\section{Methods to Create a Montage.}
\subsection{CloneMontageInfo}
Method CloneMontageInfo makes a duplicate of the given montage info, or if montage info is NULL, a new one.
\smallskip
{\em MontageInfo \*CloneMontageInfo (const ImageInfo \*image\_info, const MontageInfo \*montage\_info) }
\smallskip
\begin{description}
\item[\textit{clone\_info}]
Method CloneMontageInfo returns a duplicate of the given annotate info, or if annotate info is NULL a new one.
\item[\textit{image\_info}]
a structure of type ImageInfo.
\item[\textit{montage\_info}]
a structure of type MontageInfo.
\end{description}
\subsection{DestroyMontageInfo}
Method DestroyMontageInfo deallocates memory associated with an MontageInfo structure.
\smallskip
{\em void DestroyMontageInfo (MontageInfo \*montage\_info) }
\smallskip
\begin{description}
\item[\textit{montage\_info}]
Specifies a pointer to an MontageInfo structure.
\end{description}
\subsection{GetMontageInfo}
Method GetMontageInfo initializes the MontageInfo structure.
\smallskip
{\em void GetMontageInfo (const ImageInfo \*image\_info, MontageInfo \*montage\_info) }
\smallskip
\begin{description}
\item[\textit{image\_info}]
a structure of type ImageInfo.
\item[\textit{montage\_info}]
Specifies a pointer to a MontageInfo structure.
\end{description}
\subsection{MontageImages}
Method MontageImages creates a composite image by combining several separate images.
\smallskip
{\em Image \*MontageImages (Image \*image, const MontageInfo \*montage\_info, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{image}]
Specifies a pointer to an array of Image structures.
\item[\textit{montage\_info}]
Specifies a pointer to a MontageInfo structure.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\section{ImageMagick Image Effects Methods}
\subsection{AddNoiseImage}
Method AddNoiseImage creates a new image that is a copy of an existing one with noise added. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*AddNoiseImage (Image \*image, const NoiseType noise\_type, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{noise\_image}]
Method AddNoiseImage returns a pointer to the image after the noise is minified. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{noise\_type}]
The type of noise: Gaussian, multiplicative Gaussian, impulse, laplacian, or Poisson.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{BlurImage}
Method BlurImage creates a blurred copy of the input image. We convolve the image with a Gaussian operator of the given width and standard deviation (sigma).
Each output pixel is set to a value that is the weighted average of the input pixels in an area enclosing the pixel. The width parameter determines how large the area is. Each pixel in the area is weighted in the average according to its distance from the center, and the standard deviation, sigma. The actual weight is calculated according to the Gaussian distribution (also called normal distribution), which looks like a Bell Curve centered on a pixel. The standard deviation controls how 'pointy' the curve is. The pixels near the center of the curve (closer to the center of the area we are averaging) contribute more than the distant pixels.
In general, the width should be wide enough to include most of the total weight under the Gaussian for the standard deviation you choose. the width parameter to the function specifies the radius of the Gaussian convolution mask in pixels, not counting the centre pixel, the width parameter should be chosen larger than the standard deviation, perhaps about twice as large to three times as large. A width of 1 will give a (standard) 3x3 convolution mask, a width of 2 gives a 5 by 5 convolution mask. Using non-integral widths will result in some pixels being considered 'partial' pixels, in which case their weight will be reduced proportionally.
Pixels for which the convolution mask does not completely fit on the image (e.g. pixels without a full set of neighbours) are averaged with those neighbours they do have. Thus pixels at the edge of images are typically less blur.
Since a 2d Gaussian is seperable, we perform the Gaussian blur by convolving with two 1d Gaussians, first in the x, then in the y direction. For an n by n image and Gaussian width w this requires $2^2$ multiplications, while convolving with a 2d Gaussian requres $w^2n^2$ mults.
We blur the image into a copy, and the original is left untouched. We must process the image in two passes, in each pass we change the pixel based on its neighbors, but we need the pixel's original value for the next pixel's calculation. For the first pass we could use the original image but that's no good for the second pass, and it would imply that the original image have to stay around in ram. Instead we use a small (size=width) buffer to store the pixels we have overwritten.
This method was contributed by runger@cs.mcgill.ca.
\smallskip
{\em Image \*BlurImage (Image \*image, const double radius, const double sigma, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{blur\_image}]
Method BlurImage returns a pointer to the image after it is blur. A null image is returned if there is a memory shortage.
\item[\textit{radius}]
The radius of the Gaussian, in pixels, not counting the center pixel.
\item[\textit{sigma}]
The standard deviation of the Gaussian, in pixels.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{ColorizeImage}
Method ColorizeImage creates a new image that is a copy of an existing one with the image pixels colorized. The colorization is controlled with the pen color and the opacity levels.
\smallskip
{\em Image \*ColorizeImage (Image \*image, const char \*opacity, const PixelPacket target, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{opacity}]
A character string indicating the level of opacity as a percentage (0-0.5).
\item[\textit{target}]
A color value.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{ConvolveImage}
Method ConvolveImage applies a general image convolution kernel to an image returns the results. ConvolveImage allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*ConvolveImage (Image \*image, const unsigned int order, const double \*kernel, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{convolve\_image}]
Method ConvolveImage returns a pointer to the image after it is convolved. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{order}]
The number of columns and rows in the filter kernel.
\item[\textit{kernel}]
An array of double representing the convolution kernel.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{DespeckleImage}
Method DespeckleImage creates a new image that is a copy of an existing one with the speckle noise minified. It uses the eight hull algorithm described in Applied Optics, Vol. 24, No. 10, 15 May 1985, "Geometric filter for Speckle Reduction", by Thomas R Crimmins. Each pixel in the image is replaced by one of its eight of its surrounding pixels using a polarity and negative hull function. DespeckleImage allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*DespeckleImage (Image \*image, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{despeckle\_image}]
Method DespeckleImage returns a pointer to the image after it is despeckled. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{EdgeImage}
Method EdgeImage creates a new image that is a copy of an existing one with the edges enhanced. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*EdgeImage (Image \*image, const double radius, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{edge\_image}]
Method EdgeImage returns a pointer to the image after it is edge. A null image is returned if there is a memory shortage.
\item[\textit{image}]
the address of a structure of type Image returned from ReadImage.
\item[\textit{radius}]
the radius of the pixel neighborhood.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{EmbossImage}
Method EmbossImage creates a new image that is a copy of an existing one with the edge highlighted. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*EmbossImage (Image \*image, const double radius, const double sigma, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{emboss\_image}]
Method EmbossImage returns a pointer to the image after it is embossed. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{radius}]
the radius of the pixel neighborhood.
\item[\textit{sigma}]
The standard deviation of the Gaussian, in pixels.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{EnhanceImage}
Method EnhanceImage creates a new image that is a copy of an existing one with the noise minified. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
EnhanceImage does a weighted average of pixels in a 5x5 cell around each target pixel. Only pixels in the 5x5 cell that are within a RGB distance threshold of the target pixel are averaged.
Weights assume that the importance of neighboring pixels is negately proportional to the square of their distance from the target pixel.
The scan only processes pixels that have a full set of neighbors. Pixels in the top, bottom, left, and right pairs of rows and columns are omitted from the scan.
\smallskip
{\em Image \*EnhanceImage (Image \*image, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{enhance\_image}]
Method EnhanceImage returns a pointer to the image after it is enhanced. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{GaussianBlurImage}
Method GaussianBlurImage creates a new image that is a copy of an existing one with the pixels blur. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*GaussianBlurImage (Image \*image, const double radius, const double sigma, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{blur\_image}]
Method GaussianBlurImage returns a pointer to the image after it is blur. A null image is returned if there is a memory shortage.
\item[\textit{radius}]
the radius of the Gaussian, in pixels, not counting the center pixel.
\item[\textit{sigma}]
the standard deviation of the Gaussian, in pixels.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{ImplodeImage}
Method ImplodeImage creates a new image that is a copy of an existing one with the image pixels "implode" by the specified percentage. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*ImplodeImage (Image \*image, const double factor, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{implode\_image}]
Method ImplodeImage returns a pointer to the image after it is implode. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{factor}]
A double value that defines the extent of the implosion.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{MedianFilterImage}
Method MedianFilterImage creates a new image that is a copy of an existing one with each pixel component replaced with the median color in a pixel neighborhood.
\smallskip
{\em Image \*MedianFilterImage (Image \*image, const double radius, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{median\_image}]
Method MedianFilterImage returns a pointer to the image after it is `filtered'. A null image is returned if there is a memory shortage.
\item[\textit{image}]
the address of a structure of type Image returned from ReadImage.
\item[\textit{radius}]
the radius of the pixel neighborhood.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{MorphImages}
Method MorphImages morphs a sequence of images. Both the next pixels and size are linearly interpolated to give the appearance of a meta-morphosis from one next to the next.
\smallskip
{\em Image \*MorphImages (Image \*image, const unsigned int number\_frames, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{morph\_images}]
Method MorphImages returns an next sequence that has linearly interpolated pixels and size between two input image.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{number\_frames}]
This unsigned integer reflects the number of in-between image to generate. The more in-between frames, the smoother the morph.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{OilPaintImage}
Method OilPaintImage creates a new image that is a copy of an existing one with each pixel component replaced with the color of greatest frequency in a circular neighborhood.
\smallskip
{\em Image \*OilPaintImage (Image \*image, const double radius, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{paint\_image}]
Method OilPaintImage returns a pointer to the image after it is `painted'. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{radius}]
The radius of the circular neighborhood.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{PlasmaImage}
Method PlasmaImage initializes an image with plasma fractal values. The image must be initialized with a base color and the random number generator seeded before this method is called.
\smallskip
{\em unsigned int PlasmaImage (Image \*image, const SegmentInfo \*segment, int attenuate, int depth) }
\smallskip
\begin{description}
\item[\textit{status}]
Method PlasmaImage returns True when the fractal process is complete. Otherwise False is returned.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{segment}]
specifies a structure of type SegmentInfo that defines the boundaries of the area where the plasma fractals are applied.
\item[\textit{attenuate}]
specifies the plasma attenuation factor.
\item[\textit{depth}]
this integer values define the plasma recursion depth.
\end{description}
\subsection{ReduceNoiseImage}
Method ReduceNoiseImage creates a new image that is a copy of an existing one with the noise minified with a noise peak elimination filter. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
The principal function of noise peak elimination filter is to smooth the objects within an image without losing edge information and without creating undesired structures. The central idea of the algorithm is to replace a pixel with its next neighbor in value within a window, if this pixel has been found to be noise. A pixel is defined as noise if and only if this pixel is a maximum or minimum within the window.
\smallskip
{\em Image \*ReduceNoiseImage (Image \*image, const double, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{noise\_image}]
Method ReduceNoiseImage returns a pointer to the image after the noise is minified. A null image is returned if there is a memory shortage.
\item[\textit{image}]
the address of a structure of type Image returned from ReadImage.
\item[\textit{radius}]
the radius of the pixel neighborhood.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{ShadeImage}
Method ShadeImage creates a new image that is a copy of an existing one with the image pixels shaded using a distance light source. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*ShadeImage (Image \*image, const unsigned int color\_shading, double azimuth, double elevation, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{shade\_image}]
Method ShadeImage returns a pointer to the image after it is shaded. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{color\_shading}]
A value other than zero shades the red, green, and blue components of the image.
\item[\textit{azimuth, elevation}]
A double value that indicates the light source direction.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{SharpenImage}
Method SharpenImage creates a new image that is sharpened version of the original image using a Laplacian convolution kernel.
\smallskip
{\em Image \*SharpenImage (Image \*image, const double radius, const double sigma, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{sharp\_image}]
Method SharpenImage returns a pointer to the image after it is sharp. A null image is returned if there is a memory shortage.
\item[\textit{radius}]
The radius of the Gaussian, in pixels, not counting the center pixel.
\item[\textit{sigma}]
The standard deviation of the Laplacian, in pixels.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{SolarizeImage}
Method SolarizeImage produces a 'solarization' effect seen when exposing a photographic film to light during the development process.
\smallskip
{\em void SolarizeImage (Image \*image, const double factor) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{factor}]
An double value that defines the extent of the solarization.
\end{description}
\subsection{SpreadImage}
Method SpreadImage creates a new image that is a copy of an existing one with the image pixels randomly displaced. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*SpreadImage (Image \*image, const unsigned int amount, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{spread\_image}]
Method SpreadImage returns a pointer to the image after it is spread. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{amount}]
An unsigned value constraining the "vicinity" for choosing a random pixel to swap.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{SteganoImage}
Method SteganoImage hides a digital watermark within the image.
\smallskip
{\em Image \*SteganoImage (Image \*image, Image \*watermark, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{stegano\_image}]
Method SteganoImage returns a pointer to the steganographic image with the watermark hidden. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{watermark}]
The address of a structure of type Image.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{StereoImage}
Method StereoImage combines two images and produces a single image that is the composite of a left and right image of a stereo pair. The left image is converted to gray scale and written to the red channel of the stereo image. The right image is converted to gray scale and written to the blue channel of the stereo image. View the composite image with red-blue glasses to create a stereo effect.
\smallskip
{\em Image \*StereoImage (Image \*image, Image \*offset\_image, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{stereo\_image}]
Method StereoImage returns a pointer to the stereo image. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{offset\_image}]
The address of a structure of type Image.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{SwirlImage}
Method SwirlImage creates a new image that is a copy of an existing one with the image pixels "swirl" at a specified angle. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*SwirlImage (Image \*image, double degrees, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{swirl\_image}]
Method SwirlImage returns a pointer to the image after it is swirl. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{degrees}]
An double value that defines the tightness of the swirling.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{ThresholdImage}
Method ThresholdImage thresholds the reference image.
\smallskip
{\em unsigned int ThresholdImage (Image \*image, const double threshold) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{threshold}]
A double indicating the threshold value.
\end{description}
\subsection{UnsharpMaskImage}
Method UnsharpMaskImage creates a new image that is sharpened version of the original image using the unsharp mask algorithm.
\smallskip
{\em Image \*UnsharpMaskImage (Image \*image, const double radius, const double sigma, const double amount, const double threshold, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{unsharp\_image}]
Method UnsharpMaskImage returns a pointer to the image after it is blur. A null image is returned if there is a memory shortage.
\item[\textit{radius}]
The radius of the Gaussian, in pixels, not counting the center pixel.
\item[\textit{sigma}]
The standard deviation of the Gaussian, in pixels.
\item[\textit{amount}]
The percentage of the difference between the original and the blur image that is added back into the original.
\item[\textit{threshold}]
The threshold in pixels needed to apply the diffence amount.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{WaveImage}
Method WaveImage creates a new image that is a copy of an existing one with the image pixels altered along a sine wave. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.
\smallskip
{\em Image \*WaveImage (Image \*image, const double amplitude, const double wave\_length, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{wave\_image}]
Method WaveImage returns a pointer to the image after it is waved. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{amplitude, frequency}]
A double value that indicates the amplitude and wave\_length of the sine wave.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\section{Methods to Enhance an Image}
\subsection{ContrastImage}
Method ContrastImage enhances the intensity differences between the lighter and darker elements of the image.
\smallskip
{\em unsigned int ContrastImage (Image \*image, const unsigned int sharpen) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{sharpen}]
If True, the intensity is increased otherwise it is decreased.
\end{description}
\subsection{EqualizeImage}
Method EqualizeImage performs histogram equalization on the reference image.
\smallskip
{\em unsigned int EqualizeImage (Image \*image) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\end{description}
\subsection{GammaImage}
Method GammaImage converts the reference image to gamma corrected colors.
\smallskip
{\em unsigned int GammaImage (Image \*image, const char \*gamma) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{gamma}]
A character string indicating the level of gamma correction.
\end{description}
\subsection{ModulateImage}
Method ModulateImage modulates the hue, saturation, and brightness of an image.
\smallskip
{\em unsigned int ModulateImage (Image \*image, const char \*modulate) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{modulate}]
A character string indicating the percent change in brightness, saturation, and hue in floating point notation separated by commas (e.g. 110.1,100.0,83.1).
\end{description}
\subsection{NegateImage}
Method NegateImage negates the colors in the reference image. The Grayscale option means that only grayscale values within the image are negated.
\smallskip
{\em unsigned int NegateImage (Image \*image, const unsigned int grayscale) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\end{description}
\subsection{NormalizeImage}
Method NormalizeImage normalizes the pixel values to span the full range of color values. This is a contrast enhancement technique.
\smallskip
{\em unsigned int NormalizeImage (Image \*image) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\end{description}
\section{Methods to Reduce the Number of Unique Colors in an Image}
\subsection{CloneQuantizeInfo}
Method CloneQuantizeInfo makes a duplicate of the given quantize info structure, or if quantize info is NULL, a new one.
\smallskip
{\em QuantizeInfo \*CloneQuantizeInfo (const QuantizeInfo \*quantize\_info) }
\smallskip
\begin{description}
\item[\textit{clone\_info}]
Method CloneQuantizeInfo returns a duplicate of the given quantize info, or if image info is NULL a new one.
\item[\textit{quantize\_info}]
a structure of type info.
\end{description}
\subsection{DestroyQuantizeInfo}
Method DestroyQuantizeInfo deallocates memory associated with an QuantizeInfo structure.
\smallskip
{\em DestroyQuantizeInfo (QuantizeInfo \*quantize\_info) }
\smallskip
\begin{description}
\item[\textit{quantize\_info}]
Specifies a pointer to an QuantizeInfo structure.
\end{description}
\subsection{GetQuantizeInfo}
Method GetQuantizeInfo initializes the QuantizeInfo structure.
\smallskip
{\em GetQuantizeInfo (QuantizeInfo \*quantize\_info) }
\smallskip
\begin{description}
\item[\textit{quantize\_info}]
Specifies a pointer to a QuantizeInfo structure.
\end{description}
\subsection{MapImage}
MapImage replaces the colors of an image with the closest color from a reference image.
\smallskip
{\em unsigned int MapImage (Image \*image, Image \*map\_image, const unsigned int dither) }
\smallskip
\begin{description}
\item[\textit{image}]
Specifies a pointer to an Image structure.
\item[\textit{map\_image}]
Specifies a pointer to a Image structure. Reduce image to a set of colors represented by this image.
\item[\textit{dither}]
Set this integer value to something other than zero to dither the quantized image.
\end{description}
\subsection{MapImages}
MapImages replaces the colors of a sequence of images with the closest color from a reference image.
\smallskip
{\em unsigned int MapImages (Image \*images, Image \*map\_image, const unsigned int dither) }
\smallskip
\begin{description}
\item[\textit{image}]
Specifies a pointer to a set of Image structures.
\item[\textit{map\_image}]
Specifies a pointer to a Image structure. Reduce image to a set of colors represented by this image.
\item[\textit{dither}]
Set this integer value to something other than zero to dither the quantized image.
\end{description}
\subsection{QuantizationError}
Method QuantizationError measures the difference between the original and quantized images. This difference is the total quantization error. The error is computed by summing over all pixels in an image the distance squared in RGB space between each reference pixel value and its quantized value. These values are computed:
\begin{description}
\item[\textit{mean\_error\_per\_pixel}]
This value is the mean error for any single pixel in the image.
\item[\textit{normalized\_mean\_square\_error}]
This value is the normalized mean quantization error for any single pixel in the image. This distance measure is normalized to a range between 0 and 1. It is independent of the range of red, green, and blue values in the image.
\item[\textit{normalized\_maximum\_square\_error}]
Thsi value is the normalized maximum quantization error for any single pixel in the image. This distance measure is normalized to a range between 0 and 1. It is independent of the range of red, green, and blue values in your image.
\end{description}
\smallskip
{\em unsigned int QuantizationError (Image \*image) }
\begin{description}
\item[\textit{image}]
Specifies a pointer to an Image structure returned from ReadImage.
\end{description}
\subsection{QuantizeImage}
Method QuantizeImage analyzes the colors within a reference image and chooses a fixed number of colors to represent the image. The goal of the algorithm is to minimize the difference between the input and output image while minimizing the processing time.
\smallskip
{\em unsigned int QuantizeImage (const QuantizeInfo \*quantize\_info, Image \*image) }
\smallskip
\begin{description}
\item[\textit{quantize\_info}]
Specifies a pointer to an QuantizeInfo structure.
\item[\textit{image}]
Specifies a pointer to a Image structure.
\end{description}
\subsection{QuantizeImages}
QuantizeImages analyzes the colors within a set of reference images and chooses a fixed number of colors to represent the set. The goal of the algorithm is to minimize the difference between the input and output images while minimizing the processing time.
\smallskip
{\em unsigned int QuantizeImages (const QuantizeInfo \*quantize\_info, Image \*images) }
\smallskip
\begin{description}
\item[\textit{quantize\_info}]
Specifies a pointer to an QuantizeInfo structure.
\item[\textit{images}]
Specifies a pointer to a list of Image structures.
\end{description}
\section{Methods to Segment an Image with Thresholding Fuzzy c-Means}
\subsection{SegmentImage}
Method SegmentImage segment an image by analyzing the histograms of the color components and identifying units that are homogeneous with the fuzzy c-means technique.
Specify cluster threshold as the number of pixels in each cluster must exceed the the cluster threshold to be considered valid. Smoothing threshold eliminates noise in the second derivative of the histogram. As the value is increased, you can expect a smoother second derivative. The default is 1.5.
\smallskip
{\em unsigned int SegmentImage (Image \*image, const ColorspaceType colorspace, const unsigned int verbose, const double cluster\_threshold, const double smoothing\_threshold) }
\begin{description}
\item[\textit{colors}]
The SegmentImage function returns this integer value. It is the actual number of colors allocated in the colormap.
\item[\textit{image}]
Specifies a pointer to an Image structure returned from ReadImage.
\item[\textit{colorspace}]
An unsigned integer value that indicates the colorspace. Empirical evidence suggests that distances in YUV or YIQ correspond to perceptual color differences more closely than do distances in RGB space. The image is then returned to RGB colorspace after color reduction.
\item[\textit{verbose}]
A value greater than zero prints detailed information about the identified classes.
\end{description}
\section{Methods to Shear or Rotate an Image by an Arbitrary Angle}
\subsection{RotateImage}
Method RotateImage creates a new image that is a rotated copy of an existing one. Positive angles rotate counter-clockwise (right-hand rule), while negative angles rotate clockwise. Rotated images are usually larger than the originals and have 'empty' triangular corners. X axis. Empty triangles left over from shearing the image are filled with the color defined by the pixel at location (0,0). RotateImage allocates the memory necessary for the new Image structure and returns a pointer to the new image.
Method RotateImage is based on the paper "A Fast Algorithm for General Raster Rotatation" by Alan W. Paeth. RotateImage is adapted from a similar method based on the Paeth paper written by Michael Halle of the Spatial Imaging Group, MIT Media Lab.
\smallskip
{\em Image \*RotateImage (Image \*image, const double degrees, ExceptionInfo \*exception) }
\begin{description}
\item[\textit{status}]
Method RotateImage returns a pointer to the image after rotating. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{degrees}]
Specifies the number of degrees to rotate the image.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{ShearImage}
Method ShearImage creates a new image that is a shear\_image copy of an existing one. Shearing slides one edge of an image along the X or Y axis, creating a parallelogram. An X direction shear slides an edge along the X axis, while a Y direction shear slides an edge along the Y axis. The amount of the shear is controlled by a shear angle. For X direction shears, x\_shear is measured relative to the Y axis, and similarly, for Y direction shears y\_shear is measured relative to the X axis. Empty triangles left over from shearing the image are filled with the color defined by the pixel at location (0,0). ShearImage allocates the memory necessary for the new Image structure and returns a pointer to the new image.
Method ShearImage is based on the paper "A Fast Algorithm for General Raster Rotatation" by Alan W. Paeth.
\smallskip
{\em Image \*ShearImage (Image \*image, const double x\_shear, const double y\_shear, ExceptionInfo \*exception) }
\begin{description}
\item[\textit{status}]
Method ShearImage returns a pointer to the image after rotating. A null image is returned if there is a memory shortage.
\item[\textit{image}]
The address of a structure of type Image returned from ReadImage.
\item[\textit{x\_shear, y\_shear}]
Specifies the number of degrees to shear the image.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\section{Methods to Compute a Digital Signature for an Image}
\subsection{SignatureImage}
Method SignatureImage computes a digital signature from an image. This signature uniquely identifies the image and is convenient for determining if the colormap of a sequence of images is identical when animating. The digital signature is from RSA Data Security MD5 Digest Algorithm described in Internet draft [MD5], July 1992, computed on the pixels after expanding them to 64-bit RGBA representation, with the two bytes of each 16-bit sample ordered most significant byte first. The signature is in RGBA or CMYK order depending on the colorspace of the image. If the image does not have any alpha information, an opaque value (65535) is used.
\smallskip
{\em unsigned int SignatureImage (Image \*image) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\section{Image Pixel FIFO}
\subsection{ReadStream}
Method ReadStream makes the image pixels available to a user supplied callback method immediately upon reading a scanline with the ReadImage() method.
\smallskip
{\em unsigned int ReadStream (const ImageInfo \*image\_info, void (\*Stream) (const Image \*, const void \*, const size\_t), ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{status}]
Method ReadStream returns True if the image pixels are streamed to the user supplied callback method otherwise False.
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\item[\textit{stream}]
a callback method.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{WriteStream}
Method WriteStream makes the image pixels available to a user supplied callback method immediately upon writing pixel data with the WriteImage() method.
\smallskip
{\em unsigned int WriteStream (const ImageInfo \*image\_info, Image \*, int (\*Stream) (const Image \*, const void \*, const size\_t)) }
\smallskip
\begin{description}
\item[\textit{status}]
Method WriteStream returns True if the image pixels are streamed to the user supplied callback method otherwise False.
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\item[\textit{stream}]
a callback method.
\end{description}
\section{Image Text Attributes Methods}
\subsection{DestroyImageAttributes}
Method DestroyImageAttributes deallocates memory associated with the image attribute list.
\smallskip
{\em DestroyImageAttributes (Image \*image) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{GetImageAttribute}
Method GetImageAttribute searches the list of image attributes and returns a pointer to attribute if it exists otherwise NULL.
\smallskip
{\em ImageAttribute \*GetImageAttribute (const Image \*image, const char \*key) }
\smallskip
\begin{description}
\item[\textit{attribute}]
Method GetImageAttribute returns the attribute if it exists otherwise NULL.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{key}]
These character strings are the name of an image attribute to return.
\end{description}
\subsection{GetImageInfoAttribute}
Method GetImageInfoAttribute returns a "fake" attribute based on data in the image info or image structures.
\smallskip
ImageAttribute \*GetImageAttribute(const Image \*image,const char \*key)
\smallskip
\begin{description}
\item[\textit{attribute}]
Method GetImageInfoAttribute returns the attribute if it exists otherwise NULL.
\item[\textit{image\_info}]
The address of a structure of type ImageInfo.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{key}]
These character strings are the name of an image attribute to return.
\end{description}
\subsection{SetImageAttribute}
Method SetImageAttribute searches the list of image attributes and replaces the attribute value. If it is not found in the list, the attribute name and value is added to the list. If the attribute exists in the list, the value is concatenated to the attribute. SetImageAttribute returns True if the attribute is successfully concatenated or added to the list, otherwise False. If the value is NULL, the matching key is deleted from the list.
\smallskip
{\em unsigned int SetImageAttribute (Image \*image, const char \*key, const char \*value) }
\smallskip
\begin{description}
\item[\textit{status}]
Method SetImageAttribute returns True if the attribute is successfully replaced or added to the list, otherwise False.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{key,value}]
These character strings are the name and value of an image attribute to replace or add to the list.
\end{description}
\subsection{StoreImageAttribute}
Method StoreImageAttribute is used to store an image attribute from a text string with the syntax: NAME=VALUE.
\smallskip
{\em StoreImageAttribute (Image \*image, char \*text) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{text}]
The text string that is parsed and used to determine the name and value of the new attribute.
\end{description}
\section{Methods to Get or Set Image Pixels}
\subsection{ClosePixelCache}
Method ClosePixelCache closes the pixel cache. Use this method to prevent the too many file descriptors from being allocated when reading an image sequence. File descriptors are only used for a disk-based cache. This is essentially a no-op for a memory-based cache.
\smallskip
{\em void ClosePixelCache (Image \*image) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{DestroyPixelCache}
Method DestroyPixelCache deallocates memory associated with the pixel cache.
\smallskip
{\em void DestroyPixelCache (Image \*image) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{GetIndexesFromCache}
Method GetIndexesFromCache returns the colormap indexes associated with the last call to the SetPixelCache() or GetPixelCache() methods.
\smallskip
{\em IndexPacket \*GetIndexesFromCache (const Image \*image) }
\smallskip
\begin{description}
\item[\textit{indexes}]
Method GetIndexesFromCache returns the colormap indexes associated with the last call to the SetPixelCache() or GetPixelCache() methods.
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{GetOnePixelFromCache}
Method GetOnePixelFromCache returns a single pixel at the specified (x,y) location. The image background color is returned if an error occurs.
\smallskip
{\em PixelPacket \*GetOnePixelFromCache (const Image image, const int x, const int y) }
\smallskip
\begin{description}
\item[\textit{pixels}]
Method GetOnePixelFromCache returns a pixel at the specified (x,y) location.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{x,y}]
These values define the location of the pixel to return.
\end{description}
\subsection{GetPixelCache}
Method GetPixelCache gets pixels from the in-memory or disk pixel cache as defined by the geometry parameters. A pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.
\smallskip
{\em PixelPacket \*GetPixelCache (Image \*image, const int x, const int y, const unsigned int columns, const unsigned int rows) }
\smallskip
\begin{description}
\item[\textit{status}]
Method GetPixelCache returns a pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{x,y,columns,rows}]
These values define the perimeter of a region of pixels.
\end{description}
\subsection{GetPixelsFromCache}
Method GetPixelsFromCache returns the pixels associated with the last call to the SetPixelCache() or GetPixelCache() methods.
\smallskip
{\em PixelPacket \*GetPixelsFromCache (const Image image) }
\smallskip
\begin{description}
\item[\textit{pixels}]
Method GetPixelsFromCache returns the pixels associated with the last call to the SetPixelCache() or GetPixelCache() methods.
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{SetPixelCache}
Method SetPixelCache allocates an area to store image pixels as defined by the region rectangle and returns a pointer to the area. This area is subsequently transferred from the pixel cache with method SyncPixelCache. A pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.
\smallskip
{\em PixelPacket \*SetPixelCache (Image \*image, const int x, const int y, const unsigned int columns, const unsigned int rows) }
\smallskip
\begin{description}
\item[\textit{pixels}]
Method SetPixelCache returns a pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{x,y,columns,rows}]
These values define the perimeter of a region of pixels.
\end{description}
\subsection{SyncPixelCache}
Method SyncPixelCache saves the image pixels to the in-memory or disk cache. The method returns True if the pixel region is synced, otherwise False.
\smallskip
{\em unsigned int SyncPixelCache (Image \*image) }
\smallskip
\begin{description}
\item[\textit{status}]
Method SyncPixelCache returns True if the image pixels are transferred to the in-memory or disk cache otherwise False.
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{WriteCacheInfo}
Method WriteCacheInfo writes the persistent cache meta information to a file on disk.
\smallskip
{\em unsigned int WriteCacheInfo (Image \*image) }
\smallskip
\begin{description}
\item[\textit{status}]
Method WriteCacheInfo returns True if the cache meta information is written to the specified file, otherwise False.
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\section{}
\subsection{BlobToImage}
Method BlobToImage implements direct to memory image formats. It returns the blob as an image.
\smallskip
{\em Image \*BlobToImage (const ImageInfo \*image\_info, const void \*blob, const size\_t length, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{image}]
Method BlobToImage returns an image from the supplied blob. If an error occurs NULL is returned.
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\item[\textit{blob}]
The address of a character stream in one of the image formats understood by ImageMagick.
\item[\textit{length}]
This size\_t integer reflects the length in bytes of the blob.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{DestroyBlobInfo}
Method DestroyBlobInfo deallocates memory associated with an BlobInfo structure.
\smallskip
{\em void DestroyBlobInfo (BlobInfo \*blob) }
\smallskip
\begin{description}
\item[\textit{blob}]
Specifies a pointer to a BlobInfo structure.
\end{description}
\subsection{GetBlobInfo}
Method GetBlobInfo initializes the BlobInfo structure.
\smallskip
{\em void GetBlobInfo (BlobInfo \*blob) }
\smallskip
\begin{description}
\item[\textit{blob}]
Specifies a pointer to a BlobInfo structure.
\end{description}
\subsection{ImageToBlob}
Method ImageToBlob implements direct to memory image formats. It returns the image as a blob and its length. The magick member of the Image structure determines the format of the returned blob (GIG, JPEG, PNG, etc.).
\smallskip
{\em void \*ImageToBlob (const ImageInfo \*image\_info, Image \*image, size\_t \*length, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{blob}]
Method ImageToBlob returns a chunk of memory written in the desired image format (e.g. JPEG, GIF, etc.). If an error occurs NULL is returned.
\item[\textit{image\_info}]
Specifies a pointer to an ImageInfo structure.
\item[\textit{image}]
The address of a structure of type Image.
\item[\textit{length}]
This pointer to a size\_t integer sets the initial length of the blob. On return, it reflects the actual length of the blob.
\item[\textit{exception}]
return any errors or warnings in this structure.
\end{description}
\subsection{SetBlobQuantum}
Method SetBlobQuantum set the current value of the blob quantum. This is the size in bytes to add to a blob when writing to a blob exceeds its current length.
\smallskip
{\em void SetBlobQuantum (BlobInfo \*blob, const size\_t quantum) }
\smallskip
\begin{description}
\item[\textit{blob}]
A pointer to a BlobInfo structure.
\item[\textit{quantum}]
A size\_t that reflects the number of bytes to increase a blob.
\end{description}
\section{Methods to Read or List ImageMagick Image formats}
\subsection{DestroyMagickInfo}
Method DestroyMagickInfo deallocates memory associated MagickInfo list.
\smallskip
{\em void DestroyMagickInfo (void) }
\subsection{GetImageMagick}
Method GetImageMagick searches for an image format that matches the specified magick string. If one is found the tag is returned otherwise NULL.
\smallskip
{\em char \*GetImageMagick (const unsigned char \*magick, const unsigned int length) }
\smallskip
\begin{description}
\item[\textit{tag}]
Method GetImageMagick returns a tag that matches the specified magick string.
\item[\textit{magick}]
a character string that represents the image format we are looking for.
\item[\textit{length}]
The length of the binary string.
\end{description}
\subsection{GetMagickConfigurePath}
Method GetMagickConfigurePath searches a number of pre-defined locations for the specified ImageMagick configuration file and returns the path. The search order follows:
MagickModulesPath
$HOME/.magick/
$MAGICK\_HOME/
<program directory>/
MagickLibPath
MagickSharePath
X11ConfigurePath
\smallskip
{\em char \*GetMagickConfigurePath (const char \*filename) }
\smallskip
\begin{description}
\item[\textit{path}]
Method GetMagickConfigurePath returns the path if the configuration file is found, otherwise NULL is returned.
\item[\textit{filename}]
A character string representing the desired configuration file.
\end{description}
\subsection{GetMagickInfo}
Method GetMagickInfo returns a pointer MagickInfo structure that matches the specified tag. If tag is NULL, the head of the image format list is returned.
\smallskip
{\em MagickInfo \*GetMagickInfo (const char \*tag) }
\smallskip
\begin{description}
\item[\textit{magick\_info}]
Method GetMagickInfo returns a pointer MagickInfo structure that matches the specified tag.
\item[\textit{tag}]
a character string that represents the image format we are looking for.
\end{description}
\subsection{GetMagickVersion}
Method GetMagickVersion returns the ImageMagick API version as a string and as a number.
\smallskip
{\em char \*GetMagickVersion (unsigned int \*version) }
\smallskip
\begin{description}
\item[\textit{string}]
Method GetMagickVersion returns the ImageMagick version string.
\item[\textit{version}]
The ImageMagick version is returned as a number.
\end{description}
\subsection{ListMagickInfo}
Method ListMagickInfo lists the image formats to a file.
\smallskip
{\em void ListMagickInfo (FILE \*file) }
\begin{description}
\item[\textit{file}]
A pointer to a FILE structure.
\end{description}
\subsection{MagickIncarnate}
Method MagickIncarnate initializes the ImageMagick environment.
\smallskip
{\em MagickIncarnate (const char \*path) }
\smallskip
\begin{description}
\item[\textit{path}]
Specifies a pointer to the execution path of the current ImageMagick client.
\end{description}
\subsection{RegisterMagickInfo}
Method RegisterMagickInfo adds attributes for a particular image format to the list of supported formats. The attributes include the image format tag, a method to read and/or write the format, whether the format supports the saving of more than one frame to the same file or blob, whether the format supports native in-memory I/O, and a brief description of the format.
\smallskip
{\em MagickInfo \*RegisterMagickInfo (MagickInfo \*entry) }
\smallskip
\begin{description}
\item[\textit{magick\_info}]
Method RegisterMagickInfo returns a pointer MagickInfo structure that contains the specified tag info.
\item[\textit{entry}]
A pointer to a structure of type MagickInfo.
\end{description}
\subsection{SetMagickInfo}
Method SetMagickInfo allocates a MagickInfo structure and initializes the members to default values.
\smallskip
{\em MagickInfo \*SetMagickInfo (const char \*tag) }
\smallskip
\begin{description}
\item[\textit{magick\_info}]
Method SetMagickInfo returns the allocated and initialized MagickInfo structure.
\item[\textit{tag}]
a character string that represents the image format associated with the MagickInfo structure.
\end{description}
\subsection{UnregisterMagickInfo}
Method UnregisterMagickInfo removes a tag from the magick info list. It returns False if the tag does not exist in the list otherwise True.
\smallskip
{\em unsigned int UnregisterMagickInfo (const char \*tag) }
\smallskip
\begin{description}
\item[\textit{status}]
Method UnregisterMagickInfo returns False if the tag does not exist in the list otherwise True.
\item[\textit{tag}]
a character string that represents the image format we are looking for.
\end{description}
\section{ImageMagick Error Methods}
\subsection{CatchImageException}
Method CatchImageException returns if no exceptions are found in the image sequence, otherwise it determines the most severe exception and reports it as a warning or error depending on the severity.
\smallskip
{\em CatchImageException (Image \*image) }
\smallskip
\begin{description}
\item[\textit{image}]
Specifies a pointer to a list of one or more images.
\end{description}
\subsection{DestroyExceptionInfo}
Method DestroyExceptionInfo deallocates memory associated with an ExceptionInfo structure.
\smallskip
{\em void DestroyExceptionInfo (ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{exception}]
Specifies a pointer to an ExceptionInfo structure.
\end{description}
\subsection{GetExceptionInfo}
Method GetExceptionInfo initializes the ExceptionInfo structure.
\smallskip
{\em GetExceptionInfo (ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{error\_info}]
Specifies a pointer to a ExceptionInfo structure.
\end{description}
\subsection{GetImageException}
Method GetImageException traverses an image sequence and returns any error more severe than noted by the exception parameter.
\smallskip
{\em GetImageException (Image \*image, ExceptionInfo \*exception) }
\smallskip
\begin{description}
\item[\textit{image}]
Specifies a pointer to a list of one or more images.
\item[\textit{exception}]
return the highest severity exception.
\end{description}
\subsection{MagickError}
Method MagickError calls the error handler methods with an error reason.
\smallskip
{\em void MagickError (const ExceptionType error, const char \*reason, const char \*description) }
\smallskip
\begin{description}
\item[\textit{exception}]
Specifies the numeric error category.
\item[\textit{reason}]
Specifies the reason to display before terminating the program.
\item[\textit{description}]
Specifies any description to the reason.
\end{description}
\subsection{MagickWarning}
Method MagickWarning calls the warning handler methods with a warning reason.
\smallskip
{\em void MagickWarning (const ExceptionType warning, const char \*reason, const char \*description) }
\smallskip
\begin{description}
\item[\textit{warning}]
Specifies the numeric warning category.
\item[\textit{reason}]
Specifies the reason to display before terminating the program.
\item[\textit{description}]
Specifies any description to the reason.
\end{description}
\subsection{SetErrorHandler}
Method SetErrorHandler sets the error handler to the specified method and returns the previous error handler.
\smallskip
{\em ErrorHandler SetErrorHandler (ErrorHandler handler) }
\smallskip
\begin{description}
\item[\textit{handler}]
Specifies a pointer to a method to handle errors.
\end{description}
\subsection{SetWarningHandler}
Method SetWarningHandler sets the warning handler to the specified method and returns the previous warning handler.
\smallskip
{\em ErrorHandler SetWarningHandler (ErrorHandler handler) }
\smallskip
\begin{description}
\item[\textit{handler}]
Specifies a pointer to a method to handle warnings.
\end{description}
\subsection{ThrowException}
Method ThrowException throws an exception with the specified severity code, reason, and optional description.
\smallskip
{\em void ThrowException (ExceptionInfo \*exception, const ExceptionType severity, const char \*reason, const char \*description) }
\smallskip
\begin{description}
\item[\textit{exception}]
Specifies a pointer to the ExceptionInfo structure.
\item[\textit{severity}]
This ExceptionType declares the severity of the exception.
\item[\textit{reason}]
Specifies the reason to display before terminating the program.
\item[\textit{description}]
Specifies any description to the reason.
\end{description}
\section{ImageMagick Memory Allocation Methods}
\subsection{AcquireMemory}
Method AcquireMemory returns a pointer to a block of at least size bytes suitably aligned for any use.
\smallskip
{\em void \*AcquireMemory (const size\_t size) }
\smallskip
\begin{description}
\item[\textit{memory}]
Method AcquireMemory returns a pointer to a block of at least size bytes suitably aligned for any use.
\item[\textit{size}]
Specifies the size of the memory to return.
\end{description}
\subsection{LiberateMemory}
Method LiberateMemory frees memory that has already been allocated.
\smallskip
{\em void LiberateMemory (void \*\*memory) }
\smallskip
\begin{description}
\item[\textit{span}]
Specifies the pointer to a block memory to free for reuse.
\end{description}
\subsection{ReacquireMemory}
Method ReacquireMemory changes the size of the memory and returns a pointer to the (possibly moved) block. The contents will be unchanged up to the lesser of the new and old sizes.
\smallskip
{\em void ReacquireMemory (void \*\*memory, const size\_t size) }
\smallskip
\begin{description}
\item[\textit{memory}]
Method ReacquireMemory returns a pointer to a block of at least size bytes suitably aligned for any use.
\item[\textit{size}]
Specifies the size of the memory to return.
\end{description}
\section{ImageMagick Progress Monitor Methods}
\subsection{MagickMonitor}
Method MagickMonitor calls the monitor handler methods with a text string that describes the task and a measure of completion.
\smallskip
{\em void MagickMonitor (const char \*text, const off\_t quantum, const off\_t span) }
\smallskip
\begin{description}
\item[\textit{quantum}]
Specifies the quantum position within the span which represents how much progress has been made in completing a task.
\item[\textit{span}]
Specifies the span relative to completing a task.
\end{description}
\subsection{SetMonitorHandler}
Method SetMonitorHandler sets the monitor handler to the specified method and returns the previous monitor handler.
\smallskip
{\em MonitorHandler SetMonitorHandler (MonitorHandler handler) }
\smallskip
\begin{description}
\item[\textit{handler}]
Specifies a pointer to a method to handle monitors.
\end{description}
\section{Methods to Interactively Animate an Image Sequence}
\subsection{XAnimateBackgroundImage}
Method XAnimateBackgroundImage animates an image sequence in the background of a window.
\smallskip
{\em void XAnimateBackgroundImage (Display \*display, XResourceInfo \*resource\_info, Image \*image) }
\smallskip
\begin{description}
\item[\textit{display}]
Specifies a connection to an X server returned from XOpenDisplay.
\item[\textit{resource\_info}]
Specifies a pointer to a X11 XResourceInfo structure.
\item[\textit{image}]
Specifies a pointer to a Image structure returned from ReadImage.
\end{description}
\subsection{XAnimateImage}
Method XAnimateImages displays an image via X11.
\smallskip
{\em Image \*XAnimateImages(Display \*display,XResourceInfo \*resource\_info,
char \*\*argv,const int argc,Image \*image)}
\smallskip
\begin{description}
\item[\textit{display}]
Specifies a connection to an X server returned from XOpenDisplay.
\item[\textit{resource\_info}]
Specifies a pointer to a X11 XResourceInfo structure.
\item[\textit{argv}]
Specifies the application's argument list.
\item[\textit{argc}]
Specifies the number of arguments.
\item[\textit{image}]
Specifies a pointer to a Image structure returned from ReadImage.
\end{description}
\section{Methods to Interactively Display and Edit an Image}
\subsection{XDisplayBackgroundImage}
Method XDisplayBackgroundImage displays an image in the background of a window.
\smallskip
{\em unsigned int XDisplayBackgroundImage (Display \*display, XResourceInfo \*resource\_info, Image \*image) }
\smallskip
\begin{description}
\item[\textit{status}]
Method XDisplayBackgroundImage returns True if the designated window is the root window.
\item[\textit{display}]
Specifies a connection to an X server returned from XOpenDisplay.
\item[\textit{resource\_info}]
Specifies a pointer to a X11 XResourceInfo structure.
\item[\textit{image}]
Specifies a pointer to a Image structure returned from ReadImage.
\end{description}
\subsection{XDisplayImage}
Method XDisplayImage displays an image via X11. A new image is created and returned if the user interactively transforms the displayed image.
\smallskip
{\em Image \*XDisplayImage (Display \*display, XResourceInfo \*resource\_info, char \*\*argv, int argc, Image \*\*image, unsigned long \*state) }
\smallskip
\begin{description}
\item[\textit{nexus}]
Method XDisplayImage returns an image when the user chooses 'Open Image' from the command menu or picks a tile from the image directory. Otherwise a null image is returned.
\item[\textit{display}]
Specifies a connection to an X server returned from XOpenDisplay.
\item[\textit{resource\_info}]
Specifies a pointer to a X11 XResourceInfo structure.
\item[\textit{argv}]
Specifies the application's argument list.
\item[\textit{argc}]
Specifies the number of arguments.
\item[\textit{image}]
Specifies an address to an address of an Image structure returned from ReadImage.
\end{description}
\section{ImageMagick Cache Views Methods}
\subsection{CloseCacheView}
Method CloseCacheView closes the specified view returned by a previous call to OpenCacheView().
\smallskip
{\em void CloseCacheView (ViewInfo \*view) }
\smallskip
\begin{description}
\item[\textit{view}]
The address of a structure of type ViewInfo.
\end{description}
\subsection{GetCacheView}
Method GetCacheView gets pixels from the in-memory or disk pixel cache as defined by the geometry parameters. A pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.
\smallskip
{\em PixelPacket \*GetCacheView (ViewInfo \*view, const int x, const int y, const unsigned int columns, const unsigned int rows) }
\smallskip
\begin{description}
\item[\textit{pixels}]
Method GetCacheView returns a null pointer if an error occurs, otherwise a pointer to the view pixels.
\item[\textit{view}]
The address of a structure of type ViewInfo.
\item[\textit{x,y,columns,rows}]
These values define the perimeter of a region of pixels.
\end{description}
\subsection{GetCacheViewIndexes}
Method GetCacheViewIndexes returns the colormap indexes associated with the specified view.
\smallskip
{\em IndexPacket \*GetCacheViewIndexes (const ViewInfo \*view) }
\smallskip
\begin{description}
\item[\textit{indexes}]
Method GetCacheViewIndexes returns the colormap indexes associated with the specified view.
\item[\textit{view}]
The address of a structure of type ViewInfo.
\end{description}
\subsection{GetCacheViewPixels}
Method GetCacheViewPixels returns the pixels associated with the specified specified view.
\smallskip
{\em PixelPacket \*GetCacheViewPixels (const ViewInfo \*view) }
\smallskip
\begin{description}
\item[\textit{pixels}]
Method GetCacheViewPixels returns the pixels associated with the specified view.
\item[\textit{view}]
The address of a structure of type ViewInfo.
\end{description}
\subsection{OpenCacheView}
Method OpenCacheView opens a view into the pixel cache.
\smallskip
{\em ViewInfo \*OpenCacheView (Image \*image) }
\smallskip
\begin{description}
\item[\textit{image}]
The address of a structure of type Image.
\end{description}
\subsection{SetCacheView}
Method SetCacheView gets pixels from the in-memory or disk pixel cache as defined by the geometry parameters. A pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.
\smallskip
{\em PixelPacket \*SetCacheView (ViewInfo \*view, const int x, const int y, const unsigned int columns, const unsigned int rows) }
\smallskip
\begin{description}
\item[\textit{pixels}]
Method SetCacheView returns a null pointer if an error occurs, otherwise a pointer to the view pixels.
\item[\textit{view}]
The address of a structure of type ViewInfo.
\item[\textit{x,y,columns,rows}]
These values define the perimeter of a region of pixels.
\end{description}
\subsection{SyncCacheView}
Method SyncCacheView saves the view pixels to the in-memory or disk cache. The method returns True if the pixel region is synced, otherwise False.
\smallskip
{\em unsigned int SyncCacheView (ViewInfo \*view) }
\smallskip
\begin{description}
\item[\textit{status}]
Method SyncCacheView returns True if the view pixels are transferred to the in-memory or disk cache otherwise False.
\item[\textit{view}]
The address of a structure of type ViewInfo.
\end{description}
|