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
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="en" name="language">
<title>Magick::Image Class</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link media="screen" href="../docutils-articles.css" type="text/css" rel="stylesheet">
</head>
<body>
<div class="banner">
<img src="../images/gm-107x76.png" alt="GraphicMagick logo" width="107" height="76" />
<span class="title">GraphicsMagick</span>
<form action="http://www.google.com/search">
<input type="hidden" name="domains" value="www.graphicsmagick.org" />
<input type="hidden" name="sitesearch" value="www.graphicsmagick.org" />
<span class="nowrap"><input type="text" name="q" size="25" maxlength="255" /> <input type="submit" name="sa" value="Search" /></span>
</form>
</div>
<div class="navmenu">
<ul>
<li><a href="../index.html">Home</a></li>
<li><a href="../project.html">Project</a></li>
<li><a href="../download.html">Download</a></li>
<li><a href="../README.html">Install</a></li>
<li><a href="../Hg.html">Source</a></li>
<li><a href="../NEWS.html">News</a> </li>
<li><a href="../utilities.html">Utilities</a></li>
<li><a href="../programming.html">Programming</a></li>
<li><a href="../reference.html">Reference</a></li>
</ul>
</div>
<main id="magick-image-class">
<h1 class="title">Magick::Image Class</h1>
<!-- -*- mode: rst -*- -->
<!-- This text is in reStucturedText format, so it may look a bit odd. -->
<!-- See http://docutils.sourceforge.net/rst.html for details. -->
<div class="contents topic" id="contents">
<p class="topic-title">Contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#introduction" id="id9">Introduction</a></p></li>
<li><p><a class="reference internal" href="#blobs" id="id10">BLOBs</a></p></li>
<li><p><a class="reference internal" href="#construct-an-image" id="id11">Construct An Image</a></p></li>
<li><p><a class="reference internal" href="#read-or-write-an-image" id="id12">Read Or Write An Image</a></p></li>
<li><p><a class="reference internal" href="#manipulate-an-image" id="id13">Manipulate An Image</a></p></li>
<li><p><a class="reference internal" href="#set-get-image-attributes" id="id14">Set/Get Image Attributes</a></p></li>
<li><p><a class="reference internal" href="#low-level-image-pixel-access" id="id15">Low-Level Image Pixel Access</a></p></li>
<li><p><a class="reference internal" href="#explicit-logging-configuration-and-callbacks" id="id16">Explicit Logging Configuration And Callbacks</a></p></li>
</ul>
</div>
<section id="introduction">
<h1><a class="toc-backref" href="#id9">Introduction</a></h1>
<p>Image is the primary object in Magick++ and represents a single image
frame (see <a class="reference external" href="ImageDesign.html">image design</a>). The <a class="reference external" href="STL.html">STL</a> interface must be used to
operate on image sequences or images (e.g. of format GIF, TIFF, MIFF,
Postscript, & MNG) which are comprized of multiple image
frames. Individual frames of a multi-frame image may be requested by
adding array-style notation to the end of the file name
(e.g. "animation.gif[3]" retrieves the fourth frame of a GIF
animation. Various image manipulation operations may be applied to
the image. Attributes may be set on the image to influence the
operation of the manipulation operations. The <a class="reference external" href="Pixels.html">Pixels</a> class provides
low-level access to image pixels. As a convenience, including
<Magick++.h> is sufficient in order to use the complete Magick++
API. The Magick++ API is enclosed within the Magick namespace so you
must either add the prefix " Magick:: " to each class/enumeration name
or add the statement " using namespace Magick;" after including the
Magick++.h header.</p>
<p>The InitializeMagick() function <em>MUST</em> be invoked before constructing
any Magick++ objects. This used to be optional, but now it is
absolutely required. This function initalizes semaphores and
configuration information necessary for the software to work
correctly. Failing to invoke InitializeMagick() will lead to a
program crash or thrown assertion. If the program resides in the same
directory as the GraphicsMagick files, then argv[0] may be passed as
an argument so that GraphicsMagick knows where its files reside,
otherwise NULL may be passed and GraphicsMagick will try to use other
means (if necessary). Even if an argument is passed, GraphicsMagick
may use more reliable location information gleaned from the operating
system, depending on build configuration.</p>
<p>The preferred way to allocate Image objects is via automatic
allocation (on the stack). There is no concern that allocating Image
objects on the stack will excessively enlarge the stack since Magick++
allocates all large data objects (such as the actual image data) from
the heap. Use of automatic allocation is preferred over explicit
allocation (via new) since it is much less error prone and allows use
of C++ scoping rules to avoid memory leaks. Use of automatic
allocation allows Magick++ objects to be assigned and copied just like
the C++ intrinsic data types (e.g. 'int '), leading to clear and easy
to read code. Use of automatic allocation leads to naturally
exception-safe code since if an exception is thrown, the object is
automatically deallocated once the stack unwinds past the scope of the
allocation (not the case for objects allocated via new ).</p>
<p>Image is very easy to use. For example, here is a the source to a
program which reads an image, crops it, and writes it to a new file
(the exception handling is optional but strongly recommended):</p>
<pre class="literal-block">#include <Magick++.h>
#include <cstdlib>
#include <iostream>
using namespace std;
using namespace Magick;
int main(int argc,char **argv)
{
// Initialize/Deinitialize GraphicsMagick (scope based).
// Can pass NULL if argv is not available.
InitializeMagickSentinel sentinel(*argv);
// Construct the image object. Seperating image construction from the
// the read operation ensures that a failure to read the image file
// doesn't render the image object useless.
Image image;
try {
// Determine if Warning exceptions are thrown.
// Use is optional. Set to true to block Warning exceptions.
image.quiet( false );
// Read a file into image object
image.read( "girl.gif" );
// Crop the image to specified size (width, height, xOffset, yOffset)
image.crop( Geometry(100,100, 100, 100) );
// Write the image to a file
image.write( "x.gif" );
}
catch( Exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}</pre>
<p>Note that if InitializeMagickSentinel() is used, then the
implementation is automatically de-initialized (avoiding the
appearance of possible "leaks") due to a return from main(), or if an
uncaught exception causes the program to exit. If mechanisms such as
exit() are used, then use InitializeMagick(*argv) and DestroyMagick().</p>
<p>The following is the source to a program which illustrates the use of
Magick++'s efficient reference-counted assignment and copy-constructor
operations which minimize use of memory and eliminate unncessary copy
operations (allowing Image objects to be efficiently assigned, and
copied into containers). The program accomplishes the following:</p>
<ol class="arabic simple">
<li><p>Read master image.</p></li>
<li><p>Assign master image to second image.</p></li>
<li><p>Zoom second image to the size 640x480.</p></li>
<li><p>Assign master image to a third image.</p></li>
<li><p>Zoom third image to the size 800x600.</p></li>
<li><p>Write the second image to a file.</p></li>
<li><p>Write the third image to a file.</p></li>
</ol>
<pre class="literal-block">#include <Magick++.h>
#include <cstdlib>
#include <iostream>
using namespace std;
using namespace Magick;
int main(int argc,char **argv)
{
// Initialize/Deinitialize GraphicsMagick (scope based).
InitializeMagickSentinel sentinel(*argv);
Image master("horse.jpg");
Image second = master;
second.zoom("640x480");
Image third = master;
third.zoom("800x600");
second.write("horse640x480.jpg");
third.write("horse800x600.jpg");
return EXIT_SUCCESS;
}</pre>
<p>During the entire operation, a maximum of three images exist in memory
and the image data is never copied.</p>
<p>The following is the source for another simple program which creates a
100 by 100 pixel white image with a red pixel in the center and writes
it to a file:</p>
<pre class="literal-block">#include <Magick++.h>
#include <cstdlib>
using namespace std;
using namespace Magick;
int main(int argc,char **argv)
{
InitializeMagick(*argv);
Image image( "100x100", "white" );
image.pixelColor( 49, 49, "red" );
image.write( "red_pixel.png" );
DestroyMagick();
return EXIT_SUCCESS;
}</pre>
<p>If you wanted to change the color image to grayscale, you could add
the lines:</p>
<pre class="literal-block">image.quantizeColorSpace( GRAYColorspace );
image.quantizeColors( 256 );
image.quantize( );</pre>
<p>or, more simply:</p>
<pre class="literal-block">image.type( GrayscaleType );</pre>
<p>prior to writing the image.</p>
</section>
<section id="blobs">
<h1><a class="toc-backref" href="#id10">BLOBs</a></h1>
<p>While encoded images (e.g. JPEG) are most often written-to and
read-from a disk file, encoded images may also reside in
memory. Encoded images in memory are known as BLOBs (Binary Large
OBjects) and may be represented using the <a class="reference external" href="Blob.html">Blob</a> class. The encoded
image may be initially placed in memory by reading it directly from a
file, reading the image from a database, memory-mapped from a disk
file, or could be written to memory by Magick++. Once the encoded
image has been placed within a <a class="reference external" href="Blob.html">Blob</a>, it may be read into a Magick++
Image via a constructor or read() . Likewise, a Magick++ image may be
written to a <a class="reference external" href="Blob.html">Blob</a> via write().</p>
<p>An example of using Image to write to a <a class="reference external" href="Blob.html">Blob</a> follows:</p>
<pre class="literal-block">#include <Magick++.h>
#include <cstdlib>
using namespace std;
using namespace Magick;
int main(int argc,char **argv)
{
InitializeMagickSentinel sentinel(*argv);
// Read GIF file from disk
Image image( "giraffe.gif" );
// Write to BLOB in JPEG format
Blob blob;
image.magick( "JPEG" ) // Set JPEG output format
image.write( &blob );
[ Use BLOB data (in JPEG format) here ]
return EXIT_SUCCESS;
}</pre>
<p>likewise, to read an image from a <a class="reference external" href="Blob.html">Blob</a>, you could use one of the
following examples:</p>
<p>[ Entry condition for the following examples is that data is pointer
to encoded image data and length represents the size of the data ]</p>
<pre class="literal-block">Blob blob( data, length );
Image image( blob );</pre>
<p>or</p>
<pre class="literal-block">Blob blob( data, length );
Image image;
image.read( blob);</pre>
<p>Some images do not contain their size or format so the size and format
must be specified in advance:</p>
<pre class="literal-block">Blob blob( data, length );
Image image;
image.size( "640x480")
image.magick( "RGBA" );
image.read( blob);</pre>
</section>
<section id="construct-an-image">
<h1><a class="toc-backref" href="#id11">Construct An Image</a></h1>
<p>An Image may be constructed in a number of ways. It may be constructed
from a file, a URL, or an encoded image (e.g. JPEG) contained in an
in-memory <a class="reference external" href="Blob.html">Blob</a> . The following Image constructors and assignment
operators are available:</p>
<p>Construct from image file or image specification:</p>
<pre class="literal-block">Image( const std::string &imageSpec_ )</pre>
<p>Construct a blank image canvas of specified size and <a class="reference external" href="Color.html">color</a>:</p>
<pre class="literal-block">Image( const Geometry &size_, const Color &color_ )</pre>
<p>Construct Image from in-memory <a class="reference external" href="Blob.html">Blob</a>:</p>
<pre class="literal-block">Image ( const Blob &blob_ )</pre>
<p>Construct Image of specified size from in-memory <a class="reference external" href="Blob.html">Blob</a>:</p>
<pre class="literal-block">Image ( const Blob &blob_, const Geometry &size_ )</pre>
<p>Construct Image of specified size and depth from in-memory <a class="reference external" href="Blob.html">Blob</a>:</p>
<pre class="literal-block">Image ( const Blob &blob_, const Geometry &size,
const unsigned int depth )</pre>
<p>Construct Image of specified size, depth, and format from in-memory <a class="reference external" href="Blob.html">Blob</a>:</p>
<pre class="literal-block">Image ( const Blob &blob_, const Geometry &size,
const unsigned int depth_,
const std::string &magick_ )</pre>
<p>Construct Image of specified size, and format from in-memory <a class="reference external" href="Blob.html">Blob</a>:</p>
<pre class="literal-block">Image ( const Blob &blob_, const Geometry &size,
const std::string &magick_ )</pre>
<p>Construct an image based on an array of raw pixels, of specified type
and mapping, in memory:</p>
<pre class="literal-block">Image ( const unsigned int width_,
const unsigned int height_,
const std::string &map_,
const StorageType type_,
const void *pixels_ )</pre>
<p>Default constructor:</p>
<pre class="literal-block">Image( void )</pre>
<p>Copy constructor:</p>
<pre class="literal-block">Image ( const Image & image_ )</pre>
<p>Assignment operator:</p>
<pre class="literal-block">Image& operator= ( const Image &image_ )</pre>
</section>
<section id="read-or-write-an-image">
<h1><a class="toc-backref" href="#id12">Read Or Write An Image</a></h1>
<div class="contents local topic" id="id1">
<ul class="simple">
<li><p><a class="reference internal" href="#ping" id="id17">ping</a></p></li>
<li><p><a class="reference internal" href="#read" id="id18">read</a></p></li>
<li><p><a class="reference internal" href="#write" id="id19">write</a></p></li>
</ul>
</div>
<section id="ping">
<h2><a class="toc-backref" href="#id17">ping</a></h2>
<p>Ping is similar to <a class="reference internal" href="#read">read</a> except only enough of the image is read to
determine the image columns, rows, and filesize. Access the
columns(), rows(), and fileSize() attributes after invoking ping.
Other attributes may also be available. The image pixels are not
valid after calling ping:</p>
<pre class="literal-block">void ping ( const std::string &imageSpec_ )</pre>
<p>Ping is similar to read except only enough of the image is read
to determine the image columns, rows, and filesize. Access the
columns(), rows(), and fileSize() attributes after invoking
ping. The image pixels are not valid after calling ping:</p>
<pre class="literal-block">void ping ( const Blob &blob_ )</pre>
</section>
<section id="read">
<h2><a class="toc-backref" href="#id18">read</a></h2>
<p>Read single image frame into current object. Use <a class="reference internal" href="#ping">ping</a> instead if you
want to obtain the basic attributes of the image without reading the
whole file/blob:</p>
<pre class="literal-block">void read ( const std::string &imageSpec_ )</pre>
<p>Read single image frame of specified size into current object:</p>
<pre class="literal-block">void read ( const Geometry &size_,
const std::string &imageSpec_ )</pre>
<p>Read single image frame from in-memory <a class="reference external" href="Blob.html">Blob</a>:</p>
<pre class="literal-block">void read ( const Blob &blob_ )</pre>
<p>Read single image frame of specified size from in-memory <a class="reference external" href="Blob.html">Blob</a>:</p>
<pre class="literal-block">void read ( const Blob &blob_,
const Geometry &size_ )</pre>
<p>Read single image frame of specified size and depth from in-memory
<a class="reference external" href="Blob.html">Blob</a>:</p>
<pre class="literal-block">void read ( const Blob &blob_,
const Geometry &size_,
const unsigned int depth_ )</pre>
<p>Read single image frame of specified size, depth, and format from
in-memory <a class="reference external" href="Blob.html">Blob</a>:</p>
<pre class="literal-block">void read ( const Blob &blob_,
const Geometry &size_,
const unsigned int depth_,
const std::string &magick_ )</pre>
<p>Read single image frame of specified size, and format from in-memory
<a class="reference external" href="Blob.html">Blob</a>:</p>
<pre class="literal-block">void read ( const Blob &blob_,
const Geometry &size_,
const std::string &magick_ )</pre>
<p>Read single image frame from an array of raw pixels, with
specified storage type (ConstituteImage), e.g.
<span class="docutils literal">image.read( 640, 480, "RGB", 0, pixels )</span>:</p>
<pre class="literal-block">void read ( const unsigned int width_,
const unsigned int height_,
const std::string &map_,
const StorageType type_,
const void *pixels_ )</pre>
</section>
<section id="write">
<h2><a class="toc-backref" href="#id19">write</a></h2>
<p>Write single image frame to a file:</p>
<pre class="literal-block">void write ( const std::string &imageSpec_ )</pre>
<p>Write single image frame to in-memory <a class="reference external" href="Blob.html">Blob</a>, with optional format and
adjoin parameters:</p>
<pre class="literal-block">void write ( Blob *blob_ )
void write ( Blob *blob_,
const std::string &magick_ )
void write ( Blob *blob_,
const std::string &magick_,
const unsigned int depth_ )</pre>
<p>Write single image frame to an array of pixels with storage type
specified by user (DispatchImage), e.g. <span class="docutils literal">image.write( 0, 0, 640, 1, "RGB", 0, pixels )</span>:</p>
<pre class="literal-block">void write ( const int x_,
const int y_,
const unsigned int columns_,
const unsigned int rows_,
const std::string& map_,
const StorageType type_,
void *pixels_ )</pre>
</section>
</section>
<section id="manipulate-an-image">
<h1><a class="toc-backref" href="#id13">Manipulate An Image</a></h1>
<p>Image supports access to all the single-image (versus image-list)
manipulation operations provided by the GraphicsMagick library. If you
must process a multi-image file (such as an animation), the <a class="reference external" href="STL.html">STL</a>
interface , which provides a multi-image abstraction on top of Image,
must be used.</p>
<p>Image manipulation methods are very easy to use. For example:</p>
<pre class="literal-block">Image image;
image.read("myImage.tiff");
image.addNoise(GaussianNoise);
image.write("myImage.tiff");</pre>
<p>adds gaussian noise to the image file "myImage.tiff".</p>
<p>The following image manipulation methods are available:</p>
<div class="contents local topic" id="id2">
<ul class="simple">
<li><p><a class="reference internal" href="#adaptivethreshold" id="id20">adaptiveThreshold</a></p></li>
<li><p><a class="reference internal" href="#addnoise" id="id21">addNoise</a></p></li>
<li><p><a class="reference internal" href="#addnoisechannel" id="id22">addNoiseChannel</a></p></li>
<li><p><a class="reference internal" href="#affinetransform" id="id23">affineTransform</a></p></li>
<li><p><a class="reference internal" href="#annotate" id="id24">annotate</a></p></li>
<li><p><a class="reference internal" href="#autoorient" id="id25">autoOrient</a></p></li>
<li><p><a class="reference internal" href="#blur" id="id26">blur</a></p></li>
<li><p><a class="reference internal" href="#blurchannel" id="id27">blurChannel</a></p></li>
<li><p><a class="reference internal" href="#border" id="id28">border</a></p></li>
<li><p><a class="reference internal" href="#cdl" id="id29">cdl</a></p></li>
<li><p><a class="reference internal" href="#channel" id="id30">channel</a></p></li>
<li><p><a class="reference internal" href="#channeldepth" id="id31">channelDepth</a></p></li>
<li><p><a class="reference internal" href="#charcoal" id="id32">charcoal</a></p></li>
<li><p><a class="reference internal" href="#chop" id="id33">chop</a></p></li>
<li><p><a class="reference internal" href="#colorize" id="id34">colorize</a></p></li>
<li><p><a class="reference internal" href="#colormatrix" id="id35">colorMatrix</a></p></li>
<li><p><a class="reference internal" href="#comment" id="id36">comment</a></p></li>
<li><p><a class="reference internal" href="#compare" id="id37">compare</a></p></li>
<li><p><a class="reference internal" href="#composite" id="id38">composite</a></p></li>
<li><p><a class="reference internal" href="#contrast" id="id39">contrast</a></p></li>
<li><p><a class="reference internal" href="#convolve" id="id40">convolve</a></p></li>
<li><p><a class="reference internal" href="#crop" id="id41">crop</a></p></li>
<li><p><a class="reference internal" href="#cyclecolormap" id="id42">cycleColormap</a></p></li>
<li><p><a class="reference internal" href="#despeckle" id="id43">despeckle</a></p></li>
<li><p><a class="reference internal" href="#display" id="id44">display</a></p></li>
<li><p><a class="reference internal" href="#draw" id="id45">draw</a></p></li>
<li><p><a class="reference internal" href="#edge" id="id46">edge</a></p></li>
<li><p><a class="reference internal" href="#emboss" id="id47">emboss</a></p></li>
<li><p><a class="reference internal" href="#enhance" id="id48">enhance</a></p></li>
<li><p><a class="reference internal" href="#equalize" id="id49">equalize</a></p></li>
<li><p><a class="reference internal" href="#erase" id="id50">erase</a></p></li>
<li><p><a class="reference internal" href="#extent" id="id51">extent</a></p></li>
<li><p><a class="reference internal" href="#flip" id="id52">flip</a></p></li>
<li><p><a class="reference internal" href="#floodfillcolor" id="id53">floodFillColor</a></p></li>
<li><p><a class="reference internal" href="#floodfillopacity" id="id54">floodFillOpacity</a></p></li>
<li><p><a class="reference internal" href="#floodfilltexture" id="id55">floodFillTexture</a></p></li>
<li><p><a class="reference internal" href="#flop" id="id56">flop</a></p></li>
<li><p><a class="reference internal" href="#frame" id="id57">frame</a></p></li>
<li><p><a class="reference internal" href="#gamma" id="id58">gamma</a></p></li>
<li><p><a class="reference internal" href="#gaussianblur" id="id59">gaussianBlur</a></p></li>
<li><p><a class="reference internal" href="#gaussianblurchannel" id="id60">gaussianBlurChannel</a></p></li>
<li><p><a class="reference internal" href="#implode" id="id61">implode</a></p></li>
<li><p><a class="reference internal" href="#haldclut" id="id62">haldClut</a></p></li>
<li><p><a class="reference internal" href="#label" id="id63">label</a></p></li>
<li><p><a class="reference internal" href="#level" id="id64">level</a></p></li>
<li><p><a class="reference internal" href="#levelchannel" id="id65">levelChannel</a></p></li>
<li><p><a class="reference internal" href="#magnify" id="id66">magnify</a></p></li>
<li><p><a class="reference internal" href="#map" id="id67">map</a></p></li>
<li><p><a class="reference internal" href="#mattefloodfill" id="id68">matteFloodfill</a></p></li>
<li><p><a class="reference internal" href="#medianfilter" id="id69">medianFilter</a></p></li>
<li><p><a class="reference internal" href="#minify" id="id70">minify</a></p></li>
<li><p><a class="reference internal" href="#modifyimage" id="id71">modifyImage</a></p></li>
<li><p><a class="reference internal" href="#modulate" id="id72">modulate</a></p></li>
<li><p><a class="reference internal" href="#motionblur" id="id73">motionBlur</a></p></li>
<li><p><a class="reference internal" href="#negate" id="id74">negate</a></p></li>
<li><p><a class="reference internal" href="#normalize" id="id75">normalize</a></p></li>
<li><p><a class="reference internal" href="#oilpaint" id="id76">oilPaint</a></p></li>
<li><p><a class="reference internal" href="#opacity" id="id77">opacity</a></p></li>
<li><p><a class="reference internal" href="#opaque" id="id78">opaque</a></p></li>
<li><p><a class="reference internal" href="#quantize" id="id79">quantize</a></p></li>
<li><p><a class="reference internal" href="#quantumoperator" id="id80">quantumOperator</a></p></li>
<li><p><a class="reference internal" href="#process" id="id81">process</a></p></li>
<li><p><a class="reference internal" href="#raise" id="id82">raise</a></p></li>
<li><p><a class="reference internal" href="#randomthreshold" id="id83">randomThreshold</a></p></li>
<li><p><a class="reference internal" href="#randomthresholdchannel" id="id84">randomThresholdChannel</a></p></li>
<li><p><a class="reference internal" href="#reducenoise" id="id85">reduceNoise</a></p></li>
<li><p><a class="reference internal" href="#resize" id="id86">resize</a></p></li>
<li><p><a class="reference internal" href="#roll" id="id87">roll</a></p></li>
<li><p><a class="reference internal" href="#rotate" id="id88">rotate</a></p></li>
<li><p><a class="reference internal" href="#sample" id="id89">sample</a></p></li>
<li><p><a class="reference internal" href="#scale" id="id90">scale</a></p></li>
<li><p><a class="reference internal" href="#thumbnail" id="id91">thumbnail</a></p></li>
<li><p><a class="reference internal" href="#segment" id="id92">segment</a></p></li>
<li><p><a class="reference internal" href="#shade" id="id93">shade</a></p></li>
<li><p><a class="reference internal" href="#sharpen" id="id94">sharpen</a></p></li>
<li><p><a class="reference internal" href="#sharpenchannel" id="id95">sharpenChannel</a></p></li>
<li><p><a class="reference internal" href="#shave" id="id96">shave</a></p></li>
<li><p><a class="reference internal" href="#shear" id="id97">shear</a></p></li>
<li><p><a class="reference internal" href="#solarize" id="id98">solarize</a></p></li>
<li><p><a class="reference internal" href="#spread" id="id99">spread</a></p></li>
<li><p><a class="reference internal" href="#stegano" id="id100">stegano</a></p></li>
<li><p><a class="reference internal" href="#stereo" id="id101">stereo</a></p></li>
<li><p><a class="reference internal" href="#strip" id="id102">strip</a></p></li>
<li><p><a class="reference internal" href="#swirl" id="id103">swirl</a></p></li>
<li><p><a class="reference internal" href="#texture" id="id104">texture</a></p></li>
<li><p><a class="reference internal" href="#threshold" id="id105">threshold</a></p></li>
<li><p><a class="reference internal" href="#transform" id="id106">transform</a></p></li>
<li><p><a class="reference internal" href="#transparent" id="id107">transparent</a></p></li>
<li><p><a class="reference internal" href="#trim" id="id108">trim</a></p></li>
<li><p><a class="reference internal" href="#type" id="id109">type</a></p></li>
<li><p><a class="reference internal" href="#unsharpmask" id="id110">unsharpmask</a></p></li>
<li><p><a class="reference internal" href="#unsharpmaskchannel" id="id111">unsharpmaskChannel</a></p></li>
<li><p><a class="reference internal" href="#wave" id="id112">wave</a></p></li>
<li><p><a class="reference internal" href="#zoom" id="id113">zoom</a></p></li>
</ul>
</div>
<section id="adaptivethreshold">
<h2><a class="toc-backref" href="#id20">adaptiveThreshold</a></h2>
<p>Apply adaptive thresholding to the image (see
<a class="reference external" href="http://homepages.inf.ed.ac.uk/rbf/HIPR2/adpthrsh.htm">http://homepages.inf.ed.ac.uk/rbf/HIPR2/adpthrsh.htm</a>). Adaptive
thresholding is useful if the ideal threshold level is not known in
advance, or if the illumination gradient is not constant across the
image. Adaptive thresholding works by evaulating the mean (average) of
a pixel region (size specified by width and height) and using the mean
as the thresholding value. In order to remove residual noise from the
background, the threshold may be adjusted by subtracting a constant
offset (default zero) from the mean to compute the threshold:</p>
<pre class="literal-block">void adaptiveThreshold ( const unsigned int width,
const unsigned int height,
const double offset = 0.0 )</pre>
</section>
<section id="addnoise">
<h2><a class="toc-backref" href="#id21">addNoise</a></h2>
<p>Add noise to image with the specified noise type:</p>
<pre class="literal-block">void addNoise ( const NoiseType noiseType_ )</pre>
</section>
<section id="addnoisechannel">
<h2><a class="toc-backref" href="#id22">addNoiseChannel</a></h2>
<p>Add noise to an image channel with the specified noise type. The
<cite>channel</cite> parameter specifies the channel to add noise to. The
<cite>noiseType</cite> parameter specifies the type of noise:</p>
<pre class="literal-block">void addNoiseChannel ( const ChannelType channel_,
const NoiseType noiseType_)</pre>
</section>
<section id="affinetransform">
<h2><a class="toc-backref" href="#id23">affineTransform</a></h2>
<p>Transform image by specified affine (or free transform) matrix:</p>
<pre class="literal-block">void affineTransform ( const DrawableAffine &affine )</pre>
</section>
<section id="annotate">
<h2><a class="toc-backref" href="#id24">annotate</a></h2>
<p>Annotate image (draw text on image)</p>
<p>Gravity effects text placement in bounding area according to these
rules:</p>
<dl class="simple">
<dt>NorthWestGravity</dt>
<dd><p>text bottom-left corner placed at top-left</p>
</dd>
<dt>NorthGravity</dt>
<dd><p>text bottom-center placed at top-center</p>
</dd>
<dt>NorthEastGravity</dt>
<dd><p>text bottom-right corner placed at top-right</p>
</dd>
<dt>WestGravity</dt>
<dd><p>text left-center placed at left-center</p>
</dd>
<dt>CenterGravity</dt>
<dd><p>text center placed at center</p>
</dd>
<dt>EastGravity</dt>
<dd><p>text right-center placed at right-center</p>
</dd>
<dt>SouthWestGravity</dt>
<dd><p>text top-left placed at bottom-left</p>
</dd>
<dt>SouthGravity</dt>
<dd><p>text top-center placed at bottom-center</p>
</dd>
<dt>SouthEastGravity</dt>
<dd><p>text top-right placed at bottom-right</p>
</dd>
</dl>
<p>Annotate using specified text, and placement location:</p>
<pre class="literal-block">void annotate ( const std::string &text_,
const Geometry &location_ )</pre>
<p>Annotate using specified text, bounding area, and placement gravity:</p>
<pre class="literal-block">void annotate ( const std::string &text_,
const Geometry &boundingArea_,
const GravityType gravity_ )</pre>
<p>Annotate with text using specified text, bounding area, placement
gravity, and rotation:</p>
<pre class="literal-block">void annotate ( const std::string &text_,
const Geometry &boundingArea_,
const GravityType gravity_,
const double degrees_ )</pre>
<p>Annotate with text (bounding area is entire image) and placement
gravity:</p>
<pre class="literal-block">void annotate ( const std::string &text_,
const GravityType gravity_ )</pre>
</section>
<section id="autoorient">
<h2><a class="toc-backref" href="#id25">autoOrient</a></h2>
<p>Automatically orient image to be right-side up based on its current
orientation attribute. This allows the image to be viewed correctly
when the orientation attribute is not available, or is not respected:</p>
<pre class="literal-block">void autoOrient( void )</pre>
</section>
<section id="blur">
<h2><a class="toc-backref" href="#id26">blur</a></h2>
<p>Blur an image with the specified blur factor.</p>
<p>The <cite>radius</cite> parameter specifies the radius of the Gaussian, in
pixels, not counting the center pixel. The <cite>sigma</cite> parameter
specifies the standard deviation of the Laplacian, in pixels:</p>
<pre class="literal-block">void blur ( const double radius_ = 0.0,
const double sigma_ = 1.0 )</pre>
</section>
<section id="blurchannel">
<h2><a class="toc-backref" href="#id27">blurChannel</a></h2>
<p>Blur an image channel with the specified blur factor.</p>
<p>The <cite>channel</cite> parameter specifies the channel to modify. The <cite>radius</cite>
parameter specifies the radius of the Gaussian, in pixels, not
counting the center pixel. The <cite>sigma</cite> parameter specifies the
standard deviation of the Laplacian, in pixels:</p>
<pre class="literal-block">void blurChannel ( const ChannelType channel_,
const double radius_ = 0.0,
const double sigma_ = 1.0 )</pre>
</section>
<section id="border">
<h2><a class="toc-backref" href="#id28">border</a></h2>
<p>Border image (add border to image). The <a class="reference external" href="Color.html">color</a> of the border is
specified by the borderColor attribute:</p>
<pre class="literal-block">void border ( const Geometry &geometry_
= borderGeometryDefault )</pre>
</section>
<section id="cdl">
<h2><a class="toc-backref" href="#id29">cdl</a></h2>
<p>Bake in the ASC-CDL, which is a convention for the for the exchange of
basic primary color grading information between for the exchange of
basic primary color grading information between equipment and software
from different manufacturers. It is a useful transform for other
purposes as well:</p>
<blockquote>
<p>void cdl ( const std::string &cdl_ )</p>
</blockquote>
<p>See <a class="reference external" href="../api/cdl.html#cdlimage">CdlImage</a> for more details on the ASC-CDL.</p>
</section>
<section id="channel">
<h2><a class="toc-backref" href="#id30">channel</a></h2>
<p>Extract channel from image. Use this option to extract a particular
channel from the image. MatteChannel for example, is useful for
extracting the opacity values from an image:</p>
<pre class="literal-block">void channel ( const ChannelType channel_ )</pre>
</section>
<section id="channeldepth">
<h2><a class="toc-backref" href="#id31">channelDepth</a></h2>
<p>Set or obtain modulus channel depth:</p>
<pre class="literal-block">void channelDepth ( const ChannelType channel_,
const unsigned int depth_ )
unsigned int channelDepth ( const ChannelType channel_ )</pre>
</section>
<section id="charcoal">
<h2><a class="toc-backref" href="#id32">charcoal</a></h2>
<p>Charcoal effect image (looks like charcoal sketch).</p>
<p>The <cite>radius</cite> parameter specifies the radius of the Gaussian, in
pixels, not counting the center pixel. The <cite>sigma</cite> parameter
specifies the standard deviation of the Laplacian, in pixels:</p>
<pre class="literal-block">void charcoal ( const double radius_ = 0.0,
const double sigma_ = 1.0 )</pre>
</section>
<section id="chop">
<h2><a class="toc-backref" href="#id33">chop</a></h2>
<p>Chop image (remove vertical or horizontal subregion of image):</p>
<pre class="literal-block">void chop ( const Geometry &geometry_ )</pre>
</section>
<section id="colorize">
<h2><a class="toc-backref" href="#id34">colorize</a></h2>
<p>Colorize image with pen <a class="reference external" href="Color.html">color</a>, using specified percent opacity for
red, green, and blue quantums:</p>
<pre class="literal-block">void colorize ( const unsigned int opacityRed_,
const unsigned int opacityGreen_,
const unsigned int opacityBlue_,
const Color &penColor_ )</pre>
<p>Colorize image with pen <a class="reference external" href="Color.html">color</a>, using specified percent opacity:</p>
<pre class="literal-block">void colorize ( const unsigned int opacity_,
const Color &penColor_ )</pre>
</section>
<section id="colormatrix">
<h2><a class="toc-backref" href="#id35">colorMatrix</a></h2>
<p>Apply a color matrix to the image channels. The user supplied matrix
may be of order 1 to 5 (1x1 through 5x5):</p>
<pre class="literal-block">void colorMatrix (const unsigned int order_,
const double *color_matrix_)</pre>
<p>See <a class="reference external" href="../api/fx.html#colormatriximage">ColorMatrixImage</a> for more details.</p>
</section>
<section id="comment">
<h2><a class="toc-backref" href="#id36">comment</a></h2>
<p>Comment image (add comment string to image). By default, each image is
commented with its file name. Use this method to assign a specific
comment to the image. Optionally you can include the image filename,
type, width, height, or other image attributes by embedding <a class="reference external" href="FormatCharacters.html">special
format characters</a>:</p>
<pre class="literal-block">void comment ( const std::string &comment_ )</pre>
</section>
<section id="compare">
<h2><a class="toc-backref" href="#id37">compare</a></h2>
<p>Compare current image with another image. Sets meanErrorPerPixel,
normalizedMaxError, and normalizedMeanError in the current
image. False is returned if the images are identical. An ErrorOption
exception is thrown if the reference image columns, rows, colorspace,
or matte differ from the current image:</p>
<pre class="literal-block">bool compare ( const Image &reference_ )</pre>
</section>
<section id="composite">
<h2><a class="toc-backref" href="#id38">composite</a></h2>
<p>Compose an image onto another at specified x and y offset and using a
specified algorithm:</p>
<pre class="literal-block">void composite ( const Image &compositeImage_,
const int xOffset_,
const int yOffset_,
const CompositeOperator compose_
= InCompositeOp )
void composite ( const Image &compositeImage_,
const Geometry &offset_,
const CompositeOperator compose_
= InCompositeOp )
void composite ( const Image &compositeImage_,
const GravityType gravity_,
const CompositeOperator compose_
= InCompositeOp )</pre>
</section>
<section id="contrast">
<h2><a class="toc-backref" href="#id39">contrast</a></h2>
<p>Contrast image (enhance intensity differences in image):</p>
<pre class="literal-block">void contrast ( const unsigned int sharpen_ )</pre>
</section>
<section id="convolve">
<h2><a class="toc-backref" href="#id40">convolve</a></h2>
<p>Convolve image. Applies a user-specified convolution to the image.
The <cite>order</cite> parameter represents the number of columns and rows in the
filter kernel while <cite>kernel</cite> is a two-dimensional array of doubles
representing the convolution kernel to apply:</p>
<pre class="literal-block">void convolve ( const unsigned int order_,
const double *kernel_ )</pre>
</section>
<section id="crop">
<h2><a class="toc-backref" href="#id41">crop</a></h2>
<p>Crop image (return subregion of original image):</p>
<pre class="literal-block">void crop ( const Geometry &geometry_ )</pre>
</section>
<section id="cyclecolormap">
<h2><a class="toc-backref" href="#id42">cycleColormap</a></h2>
<p>Cycle (rotate) image colormap:</p>
<pre class="literal-block">void cycleColormap ( const int amount_ )</pre>
</section>
<section id="despeckle">
<h2><a class="toc-backref" href="#id43">despeckle</a></h2>
<p>Despeckle image (reduce speckle noise):</p>
<pre class="literal-block">void despeckle ( void )</pre>
</section>
<section id="display">
<h2><a class="toc-backref" href="#id44">display</a></h2>
<p>Display image on screen. Caution: if an image format is is not
compatible with the display visual (e.g. JPEG on a colormapped
display) then the original image will be altered. Use a copy of the
original if this is a problem:</p>
<blockquote>
<p>void display ( void )</p>
</blockquote>
</section>
<section id="draw">
<h2><a class="toc-backref" href="#id45">draw</a></h2>
<p>Draw shape or text on image using a single <a class="reference external" href="Drawable.html">drawable</a> object:</p>
<pre class="literal-block">void draw ( const Drawable &drawable_ );</pre>
<p>Draw shapes or text on image using a set of <a class="reference external" href="Drawable.html">Drawable</a> objects
contained in an <a class="reference external" href="STL.html">STL</a> list. Use of this method improves drawing
performance and allows batching draw objects together in a list for
repeated use:</p>
<pre class="literal-block">void draw ( const std::list<Magick::Drawable> &drawable_ );</pre>
</section>
<section id="edge">
<h2><a class="toc-backref" href="#id46">edge</a></h2>
<p>Edge image (hilight edges in image). The radius is the radius of the
pixel neighborhood.. Specify a radius of zero for automatic radius
selection:</p>
<pre class="literal-block">void edge ( const double radius_ = 0.0 )</pre>
</section>
<section id="emboss">
<h2><a class="toc-backref" href="#id47">emboss</a></h2>
<p>Emboss image (hilight edges with 3D effect). The <cite>radius</cite> parameter
specifies the radius of the Gaussian, in pixels, not counting the
center pixel. The <cite>sigma</cite> parameter specifies the standard deviation
of the Laplacian, in pixels:</p>
<pre class="literal-block">void emboss ( const double radius_ = 0.0,
const double sigma_ = 1.0)</pre>
</section>
<section id="enhance">
<h2><a class="toc-backref" href="#id48">enhance</a></h2>
<p>Enhance image (minimize noise):</p>
<pre class="literal-block">void enhance ( void );</pre>
</section>
<section id="equalize">
<h2><a class="toc-backref" href="#id49">equalize</a></h2>
<p>Equalize image (histogram equalization):</p>
<pre class="literal-block">void equalize ( void )</pre>
</section>
<section id="erase">
<h2><a class="toc-backref" href="#id50">erase</a></h2>
<p>Set all image pixels to the current background color:</p>
<pre class="literal-block">void erase ( void )</pre>
</section>
<section id="extent">
<h2><a class="toc-backref" href="#id51">extent</a></h2>
<p>Create an image canvas using background color sized according to
geometry and composite existing image on it, with image placement
controlled by gravity. Parameters are obtained from existing image
properties if they are not specified via a method
parameter. Parameters which are supported by image properties (gravity
and backgroundColor) update those image properties as a side-effect:</p>
<pre class="literal-block">void extent ( const Geometry &geometry_ )
void extent ( const Geometry &geometry_,
const GravityType &gravity_ )
void extent ( const Geometry &geometry_,
const Color &backgroundColor_ )
void extent ( const Geometry &geometry_,
const Color &backgroundColor_,
const GravityType &gravity_ );</pre>
</section>
<section id="flip">
<h2><a class="toc-backref" href="#id52">flip</a></h2>
<p>Flip image (reflect each scanline in the vertical direction):</p>
<pre class="literal-block">void flip ( void )</pre>
</section>
<section id="floodfillcolor">
<h2><a class="toc-backref" href="#id53">floodFillColor</a></h2>
<p>Flood-fill <a class="reference external" href="Color.html">color</a> across pixels that match the <a class="reference external" href="Color.html">color</a> of the target
pixel and are neighbors of the target pixel. Uses current fuzz
setting when determining <a class="reference external" href="Color.html">color</a> match:</p>
<pre class="literal-block">void floodFillColor( const unsigned int x_,
const unsigned int y_,
const Color &fillColor_ )
void floodFillColor( const Geometry &point_,
const Color &fillColor_ )</pre>
<p>Flood-fill <a class="reference external" href="Color.html">color</a> across pixels starting at target-pixel and stopping
at pixels matching specified border <a class="reference external" href="Color.html">color</a>. Uses current fuzz setting
when determining <a class="reference external" href="Color.html">color</a> match:</p>
<pre class="literal-block">void floodFillColor( const unsigned int x_,
const unsigned int y_,
const Color &fillColor_,
const Color &borderColor_ )
void floodFillColor( const Geometry &point_,
const Color &fillColor_,
const Color &borderColor_ )</pre>
</section>
<section id="floodfillopacity">
<h2><a class="toc-backref" href="#id54">floodFillOpacity</a></h2>
<p>Flood-fill pixels matching <a class="reference external" href="Color.html">color</a> (within fuzz factor) of target
pixel(x,y) with replacement opacity value using method:</p>
<pre class="literal-block">void floodFillOpacity ( const unsigned int x_,
const unsigned int y_,
const unsigned int opacity_,
const PaintMethod method_ )</pre>
</section>
<section id="floodfilltexture">
<h2><a class="toc-backref" href="#id55">floodFillTexture</a></h2>
<p>Flood-fill texture across pixels that match the <a class="reference external" href="Color.html">color</a> of the
target pixel and are neighbors of the target pixel.
Uses current fuzz setting when determining <a class="reference external" href="Color.html">color</a> match:</p>
<pre class="literal-block">void floodFillTexture( const unsigned int x_,
const unsigned int y_,
const Image &texture_ )
void floodFillTexture( const Geometry &point_,
const Image &texture_ )</pre>
<p>Flood-fill texture across pixels starting at target-pixel and
stopping at pixels matching specified border <a class="reference external" href="Color.html">color</a>.
Uses current fuzz setting when determining <a class="reference external" href="Color.html">color</a> match:</p>
<pre class="literal-block">void floodFillTexture( const unsigned int x_,
const unsigned int y_,
const Image &texture_,
const Color &borderColor_ )
void floodFillTexture( const Geometry &point_,
const Image &texture_,
const Color &borderColor_ )</pre>
</section>
<section id="flop">
<h2><a class="toc-backref" href="#id56">flop</a></h2>
<p>Flop image (reflect each scanline in the horizontal direction):</p>
<pre class="literal-block">void flop ( void );</pre>
</section>
<section id="frame">
<h2><a class="toc-backref" href="#id57">frame</a></h2>
<p>Draw a decorative frame around the image:</p>
<pre class="literal-block">void frame ( const Geometry &geometry_ = frameGeometryDefault )
void frame ( const unsigned int width_,
const unsigned int height_,
const int innerBevel_ = 6,
const int outerBevel_ = 6 )</pre>
</section>
<section id="gamma">
<h2><a class="toc-backref" href="#id58">gamma</a></h2>
<p>Gamma correct the image or individual image channels:</p>
<pre class="literal-block">void gamma ( const double gamma_ )
void gamma ( const double gammaRed_,
const double gammaGreen_,
const double gammaBlue_ )</pre>
</section>
<section id="gaussianblur">
<h2><a class="toc-backref" href="#id59">gaussianBlur</a></h2>
<p>Gaussian blur image. The number of neighbor pixels to be included in
the convolution mask is specified by <cite>width</cite>. The standard deviation
of the gaussian bell curve is specified by <cite>sigma</cite>:</p>
<pre class="literal-block">void gaussianBlur ( const double width_, const double sigma_ )</pre>
</section>
<section id="gaussianblurchannel">
<h2><a class="toc-backref" href="#id60">gaussianBlurChannel</a></h2>
<p>Gaussian blur image channel. The number of neighbor pixels to be
included in the convolution mask is specified by <cite>width</cite>. The
standard deviation of the gaussian bell curve is specified by
<cite>sigma</cite>:</p>
<pre class="literal-block">void gaussianBlurChannel ( const ChannelType channel_,
const double width_,
const double sigma_ )</pre>
</section>
<section id="implode">
<h2><a class="toc-backref" href="#id61">implode</a></h2>
<p>Implode image (special effect):</p>
<pre class="literal-block">void implode ( const double factor_ )</pre>
</section>
<section id="haldclut">
<h2><a class="toc-backref" href="#id62">haldClut</a></h2>
<p>Apply a color lookup table (Hald CLUT) to the image:</p>
<pre class="literal-block">void haldClut ( const Image &clutImage_ )</pre>
<p>See <a class="reference external" href="../api/hclut.html#haldclutimage">HaldClutImage</a> for more details.</p>
</section>
<section id="label">
<h2><a class="toc-backref" href="#id63">label</a></h2>
<p>Assign a label to an image. Use this option to assign a specific label
to the image. Optionally you can include the image filename, type,
width, height, or scene number in the label by embedding <a class="reference external" href="FormatCharacters.html">special
format characters</a>. If the first character of string is @, the image
label is read from a file titled by the remaining characters in the
string. When converting to Postscript, use this option to specify a
header string to print above the image:</p>
<pre class="literal-block">void label ( const std::string &label_ )</pre>
</section>
<section id="level">
<h2><a class="toc-backref" href="#id64">level</a></h2>
<p>Level image to increase image contrast, and/or adjust image
gamma. Adjust the levels of the image by scaling the colors falling
between specified white and black points to the full available quantum
range. The parameters provided represent the black, mid (gamma), and
white points. The black point specifies the darkest color in the
image. Colors darker than the black point are set to zero. Mid point
(gamma) specifies a gamma correction to apply to the image. White
point specifies the lightest color in the image. Colors brighter than
the white point are set to the maximum quantum value. The black and
white point have the valid range 0 to MaxRGB while mid (gamma) has a
useful range of 0 to ten:</p>
<pre class="literal-block">void level ( const double black_point,
const double white_point,
const double mid_point=1.0 )</pre>
</section>
<section id="levelchannel">
<h2><a class="toc-backref" href="#id65">levelChannel</a></h2>
<p>Level image channel to increase image contrast, and/or adjust image
gamma. Adjust the levels of the image channel by scaling the colors
falling between specified white and black points to the full available
quantum range. The parameters provided represent the black, mid
(gamma), and white points. The black point specifies the darkest
color in the image. Colors darker than the black point are set to
zero. Mid point (gamma) specifies a gamma correction to apply to the
image. White point specifies the lightest color in the image. Colors
brighter than the white point are set to the maximum quantum
value. The black and white point have the valid range 0 to MaxRGB
while mid (gamma) has a useful range of 0 to ten:</p>
<pre class="literal-block">void levelChannel ( const ChannelType channel,
const double black_point,
const double white_point,
const double mid_point=1.0 )</pre>
</section>
<section id="magnify">
<h2><a class="toc-backref" href="#id66">magnify</a></h2>
<p>Magnify image by integral size (double the dimensions):</p>
<pre class="literal-block">void magnify ( void )</pre>
</section>
<section id="map">
<h2><a class="toc-backref" href="#id67">map</a></h2>
<p>Remap image colors with closest color from a reference image. Set
<cite>dither</cite> to true in to apply Floyd/Steinberg error diffusion to the
image. By default, color reduction chooses an optimal set of colors
that best represent the original image. Alternatively, you can choose
a particular set of colors from an image file with this option:</p>
<pre class="literal-block">void map ( const Image &mapImage_ ,
const bool dither_ = false )</pre>
</section>
<section id="mattefloodfill">
<h2><a class="toc-backref" href="#id68">matteFloodfill</a></h2>
<p>Floodfill designated area with a replacement opacity value:</p>
<pre class="literal-block">void matteFloodfill ( const Color &target_ ,
const unsigned int opacity_,
const int x_, const int y_,
const PaintMethod method_ )</pre>
</section>
<section id="medianfilter">
<h2><a class="toc-backref" href="#id69">medianFilter</a></h2>
<p>Filter image by replacing each pixel component with the median color
in a circular neighborhood:</p>
<pre class="literal-block">void medianFilter ( const double radius_ = 0.0 )</pre>
</section>
<section id="minify">
<h2><a class="toc-backref" href="#id70">minify</a></h2>
<p>Reduce image by integral (half) size:</p>
<pre class="literal-block">void minify ( void )</pre>
</section>
<section id="modifyimage">
<h2><a class="toc-backref" href="#id71">modifyImage</a></h2>
<p>Prepare to update image (copy if reference > 1). Normally Magick++'s
implicit reference counting takes care of all instance management. In
the rare case that the automatic instance management does not work,
use this method to assure that there is only one reference to the
image to be modified. It should be used in the cases where a
GraphicsMagick C function is used directly on an image which may have
multiple references:</p>
<pre class="literal-block">void modifyImage ( void )</pre>
</section>
<section id="modulate">
<h2><a class="toc-backref" href="#id72">modulate</a></h2>
<p>Modulate percent hue, saturation, and brightness of an image.
Modulation of saturation and brightness is as a ratio of the current
value (1.0 for no change). Modulation of hue is an absolute rotation
of -180 degrees to +180 degrees from the current position
corresponding to an argument range of 0 to 2.0 (1.0 for no change):</p>
<pre class="literal-block">void modulate ( const double brightness_,
const double saturation_,
const double hue_ )</pre>
</section>
<section id="motionblur">
<h2><a class="toc-backref" href="#id73">motionBlur</a></h2>
<p>Motion blur image with specified blur factor. The <cite>radius</cite> parameter
specifies the radius of the Gaussian, in pixels, not counting the
center pixel. The <cite>sigma</cite> parameter specifies the standard
deviation of the Laplacian, in pixels. The <cite>angle</cite> parameter
specifies the angle the object appears to be comming from (zero
degrees is from the right):</p>
<pre class="literal-block">void motionBlur ( const double radius_,
const double sigma_,
const double angle_ )</pre>
</section>
<section id="negate">
<h2><a class="toc-backref" href="#id74">negate</a></h2>
<p>Negate colors in image. Set <cite>grayscale</cite> to only negate grayscale
values in image:</p>
<pre class="literal-block">void negate ( const bool grayscale_ = false )</pre>
</section>
<section id="normalize">
<h2><a class="toc-backref" href="#id75">normalize</a></h2>
<p>Normalize image (increase contrast by normalizing the pixel values to
span the full range of color values):</p>
<pre class="literal-block">void normalize ( void )</pre>
</section>
<section id="oilpaint">
<h2><a class="toc-backref" href="#id76">oilPaint</a></h2>
<p>Oilpaint image (image looks like an oil painting):</p>
<pre class="literal-block">void oilPaint ( const double radius_ = 3.0 )</pre>
</section>
<section id="opacity">
<h2><a class="toc-backref" href="#id77">opacity</a></h2>
<p>Set or attenuate the opacity channel in the image. If the image pixels
are opaque then they are set to the specified opacity value, otherwise
they are blended with the supplied opacity value. The value of
<cite>opacity</cite> ranges from 0 (completely opaque) to MaxRGB. The defines
<cite>OpaqueOpacity</cite> and <cite>TransparentOpacity</cite> are available to specify
completely opaque or completely transparent, respectively:</p>
<pre class="literal-block">void opacity ( const unsigned int opacity_ )</pre>
</section>
<section id="opaque">
<h2><a class="toc-backref" href="#id78">opaque</a></h2>
<p>Change <a class="reference external" href="Color.html">color</a> of specified opaque pixel to specified pen <a class="reference external" href="Color.html">color</a>:</p>
<pre class="literal-block">void opaque ( const Color &opaqueColor_,
const Color &penColor_ )</pre>
</section>
<section id="quantize">
<h2><a class="toc-backref" href="#id79">quantize</a></h2>
<p>Quantize image (reduce number of colors). Set <cite>measureError</cite> to true
in order to calculate error attributes:</p>
<pre class="literal-block">void quantize ( const bool measureError_ = false )</pre>
</section>
<section id="quantumoperator">
<h2><a class="toc-backref" href="#id80">quantumOperator</a></h2>
<p>Apply an arithmetic or bitwise operator to the image pixel quantums:</p>
<pre class="literal-block">void quantumOperator ( const ChannelType channel_,
const QuantumOperator operator_,
double rvalue_)
void quantumOperator ( const int x_,const int y_,
const unsigned int columns_,
const unsigned int rows_,
const ChannelType channel_,
const QuantumOperator operator_,
const double rvalue_)</pre>
</section>
<section id="process">
<h2><a class="toc-backref" href="#id81">process</a></h2>
<p>Execute a named process module using an argc/argv syntax similar to
that accepted by a C 'main' routine. An exception is thrown if the
requested process module doesn't exist, fails to load, or fails during
execution:</p>
<pre class="literal-block">void process ( std::string name_,
const int argc_,
char **argv_ )</pre>
</section>
<section id="raise">
<h2><a class="toc-backref" href="#id82">raise</a></h2>
<p>Raise image (lighten or darken the edges of an image to give a 3-D
raised or lowered effect):</p>
<pre class="literal-block">void raise ( const Geometry &geometry_ = "6x6+0+0",
const bool raisedFlag_ = false )</pre>
</section>
<section id="randomthreshold">
<h2><a class="toc-backref" href="#id83">randomThreshold</a></h2>
<p>Random threshold image.</p>
<p>Changes the value of individual pixels based on the intensity
of each pixel compared to a random threshold. The result is a
low-contrast, two color image. The <cite>thresholds</cite> argument is a
geometry containing LOWxHIGH thresholds. If the string
contains 2x2, 3x3, or 4x4, then an ordered dither of order 2,
3, or 4 will be performed instead. If a <cite>channel</cite> argument is
specified then only the specified channel is altered. This is
a very fast alternative to 'quantize' based dithering:</p>
<pre class="literal-block">void randomThreshold( const Geometry &thresholds_ )</pre>
</section>
<section id="randomthresholdchannel">
<h2><a class="toc-backref" href="#id84">randomThresholdChannel</a></h2>
<p>Random threshold image channel.</p>
<p>Changes the value of individual pixels based on the intensity of each
pixel compared to a random threshold. The result is a low-contrast,
two color image. The <cite>thresholds</cite> argument is a geometry containing
LOWxHIGH thresholds. If the string contains 2x2, 3x3, or 4x4, then an
ordered dither of order 2, 3, or 4 will be performed instead. If a
<cite>channel</cite> argument is specified then only the specified channel is
altered. This is a very fast alternative to 'quantize' based
dithering:</p>
<pre class="literal-block">void randomThresholdChannel( const Geometry &thresholds_,
const ChannelType channel_ )</pre>
</section>
<section id="reducenoise">
<h2><a class="toc-backref" href="#id85">reduceNoise</a></h2>
<p>Reduce noise in image using a noise peak elimination filter:</p>
<pre class="literal-block">void reduceNoise ( void )
void reduceNoise ( const double order_ )</pre>
</section>
<section id="resize">
<h2><a class="toc-backref" href="#id86">resize</a></h2>
<p>Resize image, specifying geometry, filter, and blur (blur > 1.0 is
more blurry and < 1.0 is sharper):</p>
<pre class="literal-block">void resize ( const Geometry &geometry_,
const FilterTypes filterType_,
const double blur_ )</pre>
<p>Resize image, specifying geometry and filter, with blur using Image
default:</p>
<pre class="literal-block">void resize ( const Geometry &geometry_,
const FilterTypes filterType_ )</pre>
<p>Resize image, specifying only geometry, with filter and blur obtained
from Image default. Provides the same result as the <cite>zoom</cite> method:</p>
<pre class="literal-block">void resize ( const Geometry &geometry_ );</pre>
</section>
<section id="roll">
<h2><a class="toc-backref" href="#id87">roll</a></h2>
<p>Roll image (rolls image vertically and horizontally) by specified
number of columnms and rows):</p>
<pre class="literal-block">void roll ( const Geometry &roll_ )
void roll ( const unsigned int columns_,
const unsigned int rows_ )</pre>
</section>
<section id="rotate">
<h2><a class="toc-backref" href="#id88">rotate</a></h2>
<p>Rotate image counter-clockwise by specified number of degrees:</p>
<pre class="literal-block">void rotate ( const double degrees_ )</pre>
</section>
<section id="sample">
<h2><a class="toc-backref" href="#id89">sample</a></h2>
<p>Resize image by using pixel sampling algorithm:</p>
<pre class="literal-block">void sample ( const Geometry &geometry_ )</pre>
</section>
<section id="scale">
<h2><a class="toc-backref" href="#id90">scale</a></h2>
<p>Resize image by using simple ratio algorithm which provides good
quality:</p>
<pre class="literal-block">void scale ( const Geometry &geometry_ )</pre>
</section>
<section id="thumbnail">
<h2><a class="toc-backref" href="#id91">thumbnail</a></h2>
<p>Resize image using several algorithms to make smaller images very
quickly. This is very useful to create thumbnails from large images
but usually works well for any image resizing purpose:</p>
<pre class="literal-block">void thumbnail ( const Geometry &geometry_ );</pre>
</section>
<section id="segment">
<h2><a class="toc-backref" href="#id92">segment</a></h2>
<p>Segment (coalesce similar image components) by analyzing the
histograms of the color components and identifying units that are
homogeneous with the fuzzy c-means technique. A histogram is built
for the image. This histogram is filtered to reduce noise and a
second derivative of the histogram plot is built and used to identify
potential cluster colors (peaks in the histogram). The cluster colors
are then validated by scanning through all of the pixels to see how
many pixels fall within each cluster. Some candidate cluster colors
may not match any of the image pixels at all and should be discarded.
Specify <cite>clusterThreshold</cite>, as the number of pixels matching a cluster
color in order for the cluster to be considered
valid. <cite>SmoothingThreshold</cite> 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:</p>
<pre class="literal-block">void segment ( const double clusterThreshold_ = 1.0,
const double smoothingThreshold_ = 1.5 )</pre>
</section>
<section id="shade">
<h2><a class="toc-backref" href="#id93">shade</a></h2>
<p>Shade image using distant light source. Specify <cite>azimuth</cite> and
<cite>elevation</cite> as the position of the light source. By default, the
shading results as a grayscale image.. Set <cite>colorShading</cite> to true to
shade the red, green, and blue components of the image:</p>
<pre class="literal-block">void shade ( const double azimuth_ = 30,
const double elevation_ = 30,
const bool colorShading_ = false )</pre>
</section>
<section id="sharpen">
<h2><a class="toc-backref" href="#id94">sharpen</a></h2>
<p>Sharpen pixels in image. The <cite>radius</cite> parameter specifies the radius
of the Gaussian, in pixels, not counting the center pixel. The
<cite>sigma</cite> parameter specifies the standard deviation of the Laplacian,
in pixels:</p>
<pre class="literal-block">void sharpen ( const double radius_ = 0.0,
const double sigma_ = 1.0 )</pre>
</section>
<section id="sharpenchannel">
<h2><a class="toc-backref" href="#id95">sharpenChannel</a></h2>
<p>Sharpen pixels in image channel. The <cite>radius</cite> parameter specifies the
radius of the Gaussian, in pixels, not counting the center pixel. The
<cite>sigma</cite> parameter specifies the standard deviation of the Laplacian,
in pixels:</p>
<pre class="literal-block">void sharpenChannel ( const ChannelType channel_,
const double radius_ = 0.0,
const double sigma_ = 1.0 )</pre>
</section>
<section id="shave">
<h2><a class="toc-backref" href="#id96">shave</a></h2>
<p>Shave pixels from image edges:</p>
<pre class="literal-block">void shave ( const Geometry &geometry_ )</pre>
</section>
<section id="shear">
<h2><a class="toc-backref" href="#id97">shear</a></h2>
<p>Shear image (create parallelogram by sliding image by X or Y
axis). 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 degrees is measured relative to the Y axis, and
similarly, for Y direction shears y degrees is measured relative to
the X axis. Empty triangles left over from shearing the image are
filled with the <a class="reference external" href="Color.html">color</a> defined as borderColor:</p>
<pre class="literal-block">void shear ( const double xShearAngle_,
const double yShearAngle_ )</pre>
</section>
<section id="solarize">
<h2><a class="toc-backref" href="#id98">solarize</a></h2>
<p>Solarize image (similar to effect seen when exposing a photographic
film to light during the development process):</p>
<pre class="literal-block">void solarize ( const double factor_ = 50.0 )</pre>
</section>
<section id="spread">
<h2><a class="toc-backref" href="#id99">spread</a></h2>
<p>Spread pixels randomly within image by specified ammount:</p>
<pre class="literal-block">void spread ( const unsigned int amount_ = 3 )</pre>
</section>
<section id="stegano">
<h2><a class="toc-backref" href="#id100">stegano</a></h2>
<p>Add a digital watermark to the image (based on second image):</p>
<pre class="literal-block">void stegano ( const Image &watermark_ )</pre>
</section>
<section id="stereo">
<h2><a class="toc-backref" href="#id101">stereo</a></h2>
<p>Create an image which appears in stereo when viewed with red-blue
glasses (Red image on left, blue on right):</p>
<pre class="literal-block">void stereo ( const Image &rightImage_ )</pre>
</section>
<section id="strip">
<h2><a class="toc-backref" href="#id102">strip</a></h2>
<p>Remove all profiles and text attributes from the image.</p>
<blockquote>
<p>void strip ( void );</p>
</blockquote>
</section>
<section id="swirl">
<h2><a class="toc-backref" href="#id103">swirl</a></h2>
<p>Swirl image (image pixels are rotated by degrees):</p>
<pre class="literal-block">void swirl ( const double degrees_ )</pre>
</section>
<section id="texture">
<h2><a class="toc-backref" href="#id104">texture</a></h2>
<p>Channel a texture on pixels matching image background <a class="reference external" href="Color.html">color</a>:</p>
<pre class="literal-block">void texture ( const Image &texture_ )</pre>
</section>
<section id="threshold">
<h2><a class="toc-backref" href="#id105">threshold</a></h2>
<p>Threshold image channels (below threshold becomes black, above
threshold becomes white). The range of the threshold parameter is 0
to MaxRGB:</p>
<pre class="literal-block">void threshold ( const double threshold_ )</pre>
</section>
<section id="transform">
<h2><a class="toc-backref" href="#id106">transform</a></h2>
<p>Transform image based on image and crop geometries. Crop geometry is
optional:</p>
<pre class="literal-block">void transform ( const Geometry &imageGeometry_ )
void transform ( const Geometry &imageGeometry_,
const Geometry &cropGeometry_ )</pre>
</section>
<section id="transparent">
<h2><a class="toc-backref" href="#id107">transparent</a></h2>
<p>Add matte channel to image, setting pixels matching <a class="reference external" href="Color.html">color</a> to
transparent:</p>
<pre class="literal-block">void transparent ( const Color &color_ )</pre>
</section>
<section id="trim">
<h2><a class="toc-backref" href="#id108">trim</a></h2>
<p>Trim edges that are the background <a class="reference external" href="Color.html">color</a> from the image:</p>
<pre class="literal-block">void trim ( void )</pre>
</section>
<section id="type">
<h2><a class="toc-backref" href="#id109">type</a></h2>
<p>Convert the image representation to the specified type or retrieve the
current image type. If the image is reduced to an inferior type, then
image information may be lost (e.g. color changed to grayscale).</p>
<p>Available enumerations for the <cite>type</cite> parameter:</p>
<blockquote>
<dl class="simple">
<dt>BilevelType</dt>
<dd><p>black/white</p>
</dd>
<dt>GrayscaleType</dt>
<dd><p>grayscale</p>
</dd>
<dt>GrayscaleMatteType</dt>
<dd><p>grayscale with alpha (opacity) channel</p>
</dd>
<dt>PaletteType</dt>
<dd><p>colormapped</p>
</dd>
<dt>PaletteMatteType</dt>
<dd><p>colormapped with transparency</p>
</dd>
<dt>TrueColorType</dt>
<dd><p>true (full) color</p>
</dd>
<dt>TrueColorMatteType</dt>
<dd><p>true (full) color with alpha (opacity) channel</p>
</dd>
<dt>ColorSeparationType</dt>
<dd><p>Cyan, magenta, yellow, and black</p>
</dd>
<dt>ColorSeparationMatteType</dt>
<dd><p>Cyan, magenta, yellow, and black with alpha (opacity) channel</p>
</dd>
<dt>OptimizeType</dt>
<dd><p>Optimize the image type to best represent the existing pixels</p>
</dd>
</dl>
</blockquote>
<pre class="literal-block">void type ( const ImageType type_ )
ImageType type ( void ) const</pre>
</section>
<section id="unsharpmask">
<h2><a class="toc-backref" href="#id110">unsharpmask</a></h2>
<p>Replace image with a sharpened version of the original image using the
unsharp mask algorithm.</p>
<blockquote>
<dl class="simple">
<dt><cite>radius</cite></dt>
<dd><p>the radius of the Gaussian, in pixels, not counting the
center pixel.</p>
</dd>
<dt><cite>sigma</cite></dt>
<dd><p>the standard deviation of the Gaussian, in pixels.</p>
</dd>
<dt><cite>amount</cite></dt>
<dd><p>the percentage of the difference between the original and
the blur image that is added back into the original.</p>
</dd>
<dt><cite>threshold</cite></dt>
<dd><p>the threshold in pixels needed to apply the diffence amount.</p>
</dd>
</dl>
</blockquote>
<pre class="literal-block">void unsharpmask ( const double radius_,
const double sigma_,
const double amount_,
const double threshold_ )</pre>
</section>
<section id="unsharpmaskchannel">
<h2><a class="toc-backref" href="#id111">unsharpmaskChannel</a></h2>
<p>Replace image channel with a sharpened version of the original image
using the unsharp mask algorithm.</p>
<blockquote>
<dl class="simple">
<dt><cite>channel</cite></dt>
<dd><p>image channel to modify.</p>
</dd>
<dt><cite>radius</cite></dt>
<dd><p>the radius of the Gaussian, in pixels, not counting the
center pixel.</p>
</dd>
<dt><cite>sigma</cite></dt>
<dd><p>the standard deviation of the Gaussian, in pixels.</p>
</dd>
<dt><cite>amount</cite></dt>
<dd><p>the percentage of the difference between the original and
the blur image that is added back into the original.</p>
</dd>
<dt><cite>threshold</cite></dt>
<dd><p>the threshold in pixels needed to apply the diffence amount.</p>
</dd>
</dl>
</blockquote>
<pre class="literal-block">void unsharpmaskChannel ( const ChannelType channel_,
const double radius_,
const double sigma_,
const double amount_,
const double threshold_ );</pre>
</section>
<section id="wave">
<h2><a class="toc-backref" href="#id112">wave</a></h2>
<p>Map image pixels to a sine wave:</p>
<pre class="literal-block">void wave ( const double amplitude_ = 25.0,
const double wavelength_ = 150.0 )</pre>
</section>
<section id="zoom">
<h2><a class="toc-backref" href="#id113">zoom</a></h2>
<p>Zoom (resize) image to specified size:</p>
<pre class="literal-block">void zoom ( const Geometry &geometry_ )</pre>
</section>
</section>
<section id="set-get-image-attributes">
<h1><a class="toc-backref" href="#id14">Set/Get Image Attributes</a></h1>
<p>Image attributes are set and obtained via methods in Image. Except for
methods which accept pointer arguments (e.g. chromaBluePrimary) all
methods return attributes by value.</p>
<p>Image attributes are easily used. For example, to set the resolution
of the TIFF file "file.tiff" to 150 dots-per-inch (DPI) in both the
horizontal and vertical directions, you can use the following example
code:</p>
<pre class="literal-block">string filename("file.tiff");
Image image;
image.read(filename);
image.resolutionUnits(PixelsPerInchResolution);
image.density(Geometry(150,150)); // could also use image.density("150x150")
image.write(filename)</pre>
<p>The following image attribute methods are available:</p>
<div class="contents local topic" id="id3">
<ul class="simple">
<li><p><a class="reference internal" href="#adjoin" id="id114">adjoin</a></p></li>
<li><p><a class="reference internal" href="#antialias" id="id115">antiAlias</a></p></li>
<li><p><a class="reference internal" href="#animationdelay" id="id116">animationDelay</a></p></li>
<li><p><a class="reference internal" href="#animationiterations" id="id117">animationIterations</a></p></li>
<li><p><a class="reference internal" href="#attribute" id="id118">attribute</a></p></li>
<li><p><a class="reference internal" href="#backgroundcolor" id="id119">backgroundColor</a></p></li>
<li><p><a class="reference internal" href="#backgroundtexture" id="id120">backgroundTexture</a></p></li>
<li><p><a class="reference internal" href="#basecolumns" id="id121">baseColumns</a></p></li>
<li><p><a class="reference internal" href="#basefilename" id="id122">baseFilename</a></p></li>
<li><p><a class="reference internal" href="#baserows" id="id123">baseRows</a></p></li>
<li><p><a class="reference internal" href="#bordercolor" id="id124">borderColor</a></p></li>
<li><p><a class="reference internal" href="#boundingbox" id="id125">boundingBox</a></p></li>
<li><p><a class="reference internal" href="#boxcolor" id="id126">boxColor</a></p></li>
<li><p><a class="reference internal" href="#cachethreshold" id="id127">cacheThreshold</a></p></li>
<li><p><a class="reference internal" href="#chromablueprimary" id="id128">chromaBluePrimary</a></p></li>
<li><p><a class="reference internal" href="#chromagreenprimary" id="id129">chromaGreenPrimary</a></p></li>
<li><p><a class="reference internal" href="#chromaredprimary" id="id130">chromaRedPrimary</a></p></li>
<li><p><a class="reference internal" href="#chromawhitepoint" id="id131">chromaWhitePoint</a></p></li>
<li><p><a class="reference internal" href="#classtype" id="id132">classType</a></p></li>
<li><p><a class="reference internal" href="#clipmask" id="id133">clipMask</a></p></li>
<li><p><a class="reference internal" href="#colorfuzz" id="id134">colorFuzz</a></p></li>
<li><p><a class="reference internal" href="#colormap" id="id135">colorMap</a></p></li>
<li><p><a class="reference internal" href="#colormapsize" id="id136">colorMapSize</a></p></li>
<li><p><a class="reference internal" href="#colorspace" id="id137">colorSpace</a></p></li>
<li><p><a class="reference internal" href="#columns" id="id138">columns</a></p></li>
<li><p><a class="reference internal" href="#id4" id="id139">comment</a></p></li>
<li><p><a class="reference internal" href="#compose" id="id140">compose</a></p></li>
<li><p><a class="reference internal" href="#compresstype" id="id141">compressType</a></p></li>
<li><p><a class="reference internal" href="#debug" id="id142">debug</a></p></li>
<li><p><a class="reference internal" href="#definevalue" id="id143">defineValue</a></p></li>
<li><p><a class="reference internal" href="#defineset" id="id144">defineSet</a></p></li>
<li><p><a class="reference internal" href="#density" id="id145">density</a></p></li>
<li><p><a class="reference internal" href="#depth" id="id146">depth</a></p></li>
<li><p><a class="reference internal" href="#directory" id="id147">directory</a></p></li>
<li><p><a class="reference internal" href="#endian" id="id148">endian</a></p></li>
<li><p><a class="reference internal" href="#filename" id="id149">fileName</a></p></li>
<li><p><a class="reference internal" href="#filesize" id="id150">fileSize</a></p></li>
<li><p><a class="reference internal" href="#fillcolor" id="id151">fillColor</a></p></li>
<li><p><a class="reference internal" href="#fillpattern" id="id152">fillPattern</a></p></li>
<li><p><a class="reference internal" href="#fillrule" id="id153">fillRule</a></p></li>
<li><p><a class="reference internal" href="#filtertype" id="id154">filterType</a></p></li>
<li><p><a class="reference internal" href="#font" id="id155">font</a></p></li>
<li><p><a class="reference internal" href="#fontpointsize" id="id156">fontPointsize</a></p></li>
<li><p><a class="reference internal" href="#fonttypemetrics" id="id157">fontTypeMetrics</a></p></li>
<li><p><a class="reference internal" href="#format" id="id158">format</a></p></li>
<li><p><a class="reference internal" href="#formatexpression" id="id159">formatExpression</a></p></li>
<li><p><a class="reference internal" href="#formatexpressionref" id="id160">formatExpressionRef</a></p></li>
<li><p><a class="reference internal" href="#id5" id="id161">gamma</a></p></li>
<li><p><a class="reference internal" href="#id6" id="id162">geometry</a></p></li>
<li><p><a class="reference internal" href="#gifdisposemethod" id="id163">gifDisposeMethod</a></p></li>
<li><p><a class="reference internal" href="#icccolorprofile" id="id164">iccColorProfile</a></p></li>
<li><p><a class="reference internal" href="#interlacetype" id="id165">interlaceType</a></p></li>
<li><p><a class="reference internal" href="#iptcprofile" id="id166">iptcProfile</a></p></li>
<li><p><a class="reference internal" href="#isvalid" id="id167">isValid</a></p></li>
<li><p><a class="reference internal" href="#id7" id="id168">label</a></p></li>
<li><p><a class="reference internal" href="#linewidth" id="id169">lineWidth</a></p></li>
<li><p><a class="reference internal" href="#magick" id="id170">magick</a></p></li>
<li><p><a class="reference internal" href="#matte" id="id171">matte</a></p></li>
<li><p><a class="reference internal" href="#mattecolor" id="id172">matteColor</a></p></li>
<li><p><a class="reference internal" href="#meanerrorperpixel" id="id173">meanErrorPerPixel</a></p></li>
<li><p><a class="reference internal" href="#modulusdepth" id="id174">modulusDepth</a></p></li>
<li><p><a class="reference internal" href="#monochrome" id="id175">monochrome</a></p></li>
<li><p><a class="reference internal" href="#montagegeometry" id="id176">montageGeometry</a></p></li>
<li><p><a class="reference internal" href="#normalizedmaxerror" id="id177">normalizedMaxError</a></p></li>
<li><p><a class="reference internal" href="#normalizedmeanerror" id="id178">normalizedMeanError</a></p></li>
<li><p><a class="reference internal" href="#orientation" id="id179">orientation</a></p></li>
<li><p><a class="reference internal" href="#page" id="id180">page</a></p></li>
<li><p><a class="reference internal" href="#pixelcolor" id="id181">pixelColor</a></p></li>
<li><p><a class="reference internal" href="#profile" id="id182">profile</a></p></li>
<li><p><a class="reference internal" href="#quality" id="id183">quality</a></p></li>
<li><p><a class="reference internal" href="#quantizecolors" id="id184">quantizeColors</a></p></li>
<li><p><a class="reference internal" href="#quantizecolorspace" id="id185">quantizeColorSpace</a></p></li>
<li><p><a class="reference internal" href="#quantizedither" id="id186">quantizeDither</a></p></li>
<li><p><a class="reference internal" href="#quantizetreedepth" id="id187">quantizeTreeDepth</a></p></li>
<li><p><a class="reference internal" href="#quiet" id="id188">quiet</a></p></li>
<li><p><a class="reference internal" href="#renderingintent" id="id189">renderingIntent</a></p></li>
<li><p><a class="reference internal" href="#repage" id="id190">repage</a></p></li>
<li><p><a class="reference internal" href="#resolutionunits" id="id191">resolutionUnits</a></p></li>
<li><p><a class="reference internal" href="#rows" id="id192">rows</a></p></li>
<li><p><a class="reference internal" href="#scene" id="id193">scene</a></p></li>
<li><p><a class="reference internal" href="#signature" id="id194">signature</a></p></li>
<li><p><a class="reference internal" href="#size" id="id195">size</a></p></li>
<li><p><a class="reference internal" href="#statistics" id="id196">statistics</a></p></li>
<li><p><a class="reference internal" href="#strokeantialias" id="id197">strokeAntiAlias</a></p></li>
<li><p><a class="reference internal" href="#strokecolor" id="id198">strokeColor</a></p></li>
<li><p><a class="reference internal" href="#strokedasharray" id="id199">strokeDashArray</a></p></li>
<li><p><a class="reference internal" href="#strokedashoffset" id="id200">strokeDashOffset</a></p></li>
<li><p><a class="reference internal" href="#strokelinecap" id="id201">strokeLineCap</a></p></li>
<li><p><a class="reference internal" href="#strokelinejoin" id="id202">strokeLineJoin</a></p></li>
<li><p><a class="reference internal" href="#strokemiterlimit" id="id203">strokeMiterLimit</a></p></li>
<li><p><a class="reference internal" href="#strokepattern" id="id204">strokePattern</a></p></li>
<li><p><a class="reference internal" href="#strokewidth" id="id205">strokeWidth</a></p></li>
<li><p><a class="reference internal" href="#subimage" id="id206">subImage</a></p></li>
<li><p><a class="reference internal" href="#subrange" id="id207">subRange</a></p></li>
<li><p><a class="reference internal" href="#textencoding" id="id208">textEncoding</a></p></li>
<li><p><a class="reference internal" href="#tilename" id="id209">tileName</a></p></li>
<li><p><a class="reference internal" href="#totalcolors" id="id210">totalColors</a></p></li>
<li><p><a class="reference internal" href="#transformorigin" id="id211">transformOrigin</a></p></li>
<li><p><a class="reference internal" href="#transformrotation" id="id212">transformRotation</a></p></li>
<li><p><a class="reference internal" href="#transformreset" id="id213">transformReset</a></p></li>
<li><p><a class="reference internal" href="#transformscale" id="id214">transformScale</a></p></li>
<li><p><a class="reference internal" href="#transformskewx" id="id215">transformSkewX</a></p></li>
<li><p><a class="reference internal" href="#transformskewy" id="id216">transformSkewY</a></p></li>
<li><p><a class="reference internal" href="#verbose" id="id217">verbose</a></p></li>
<li><p><a class="reference internal" href="#view" id="id218">view</a></p></li>
<li><p><a class="reference internal" href="#x11display" id="id219">x11Display</a></p></li>
<li><p><a class="reference internal" href="#xresolution" id="id220">xResolution</a></p></li>
<li><p><a class="reference internal" href="#yresolution" id="id221">yResolution</a></p></li>
</ul>
</div>
<section id="adjoin">
<h2><a class="toc-backref" href="#id114">adjoin</a></h2>
<p>Join images into a single multi-image file:</p>
<pre class="literal-block">void adjoin ( const bool flag_ )
bool adjoin ( void ) const</pre>
</section>
<section id="antialias">
<h2><a class="toc-backref" href="#id115">antiAlias</a></h2>
<p>Control antialiasing of rendered Postscript and Postscript or TrueType
fonts. Enabled by default:</p>
<pre class="literal-block">void antiAlias( const bool flag_ )
bool antiAlias( void )</pre>
</section>
<section id="animationdelay">
<h2><a class="toc-backref" href="#id116">animationDelay</a></h2>
<p>Time in 1/100ths of a second (0 to 65535) which must expire before
displaying the next image in an animated sequence. This option is
useful for regulating the animation of a sequence of GIF images within
Netscape:</p>
<pre class="literal-block">void animationDelay ( const unsigned int delay_ )
unsigned int animationDelay ( void ) const</pre>
</section>
<section id="animationiterations">
<h2><a class="toc-backref" href="#id117">animationIterations</a></h2>
<p>Number of iterations to loop an animation (e.g. Netscape loop
extension) for:</p>
<pre class="literal-block">void animationIterations ( const unsigned int iterations_ )
unsigned int animationIterations ( void ) const</pre>
</section>
<section id="attribute">
<h2><a class="toc-backref" href="#id118">attribute</a></h2>
<p>Access or update an arbitrary named image attribute. Any number of
named attributes may be attached to the image. For example, the image
comment is a named image attribute with the name "comment". If the
named attribute already exists, the provided text is appended to the
existing attribute text. Pass NULL to remove an existing text
attribute, or to restart the text attribute from scratch.</p>
<p>EXIF tags are attached to the image as named attributes. Use the
syntax "EXIF:<tag>" to request an EXIF tag similar to
"EXIF:DateTime":</p>
<pre class="literal-block">void attribute ( const std::string name_,
const char * value_ );
void attribute ( const std::string name_,
const std::string value_ )
std::string attribute ( const std::string name_ )</pre>
</section>
<section id="backgroundcolor">
<h2><a class="toc-backref" href="#id119">backgroundColor</a></h2>
<p>Image background <a class="reference external" href="Color.html">color</a>:</p>
<pre class="literal-block">void backgroundColor ( const Color &color_ )
Color backgroundColor ( void ) const</pre>
</section>
<section id="backgroundtexture">
<h2><a class="toc-backref" href="#id120">backgroundTexture</a></h2>
<p>Image file name to use as the background texture. Does not modify
image pixels:</p>
<pre class="literal-block">void backgroundTexture (const std::string &backgroundTexture_ )
std::string backgroundTexture ( void ) const</pre>
</section>
<section id="basecolumns">
<h2><a class="toc-backref" href="#id121">baseColumns</a></h2>
<p>Base image width (before transformations):</p>
<pre class="literal-block">unsigned int baseColumns ( void ) const</pre>
</section>
<section id="basefilename">
<h2><a class="toc-backref" href="#id122">baseFilename</a></h2>
<p>Base image filename (before transformations):</p>
<pre class="literal-block">std::string baseFilename ( void ) const</pre>
</section>
<section id="baserows">
<h2><a class="toc-backref" href="#id123">baseRows</a></h2>
<p>Base image height (before transformations):</p>
<pre class="literal-block">unsigned int baseRows ( void ) const</pre>
</section>
<section id="bordercolor">
<h2><a class="toc-backref" href="#id124">borderColor</a></h2>
<p>Image border <a class="reference external" href="Color.html">color</a>:</p>
<pre class="literal-block">void borderColor ( const Color &color_ )
Color borderColor ( void ) const</pre>
</section>
<section id="boundingbox">
<h2><a class="toc-backref" href="#id125">boundingBox</a></h2>
<p>Return smallest bounding box enclosing non-border pixels. The
current fuzz value is used when discriminating between pixels.
This is the crop bounding box used by <span class="docutils literal">crop(Geometry(0,0))</span>:</p>
<pre class="literal-block">Geometry boundingBox ( void ) const</pre>
</section>
<section id="boxcolor">
<h2><a class="toc-backref" href="#id126">boxColor</a></h2>
<p>Base <a class="reference external" href="Color.html">color</a> that annotation text is rendered on (default none):</p>
<pre class="literal-block">void boxColor ( const Color &boxColor_ )
Color boxColor ( void ) const</pre>
</section>
<section id="cachethreshold">
<h2><a class="toc-backref" href="#id127">cacheThreshold</a></h2>
<p>Pixel cache threshold in megabytes. Once this memory threshold is
exceeded, all subsequent pixels cache operations are to/from disk.
This setting is shared by all Image objects:</p>
<pre class="literal-block">static void cacheThreshold ( const unsigned int threshold_ )</pre>
</section>
<section id="chromablueprimary">
<h2><a class="toc-backref" href="#id128">chromaBluePrimary</a></h2>
<p>Chromaticity blue primary point (e.g. x=0.15, y=0.06):</p>
<pre class="literal-block">void chromaBluePrimary ( const double x_, const double y_ )
void chromaBluePrimary ( double *x_, double *y_ ) const</pre>
</section>
<section id="chromagreenprimary">
<h2><a class="toc-backref" href="#id129">chromaGreenPrimary</a></h2>
<p>Chromaticity green primary point (e.g. x=0.3, y=0.6):</p>
<pre class="literal-block">void chromaGreenPrimary ( const double x_, const double y_ )
void chromaGreenPrimary ( double *x_, double *y_ ) const</pre>
</section>
<section id="chromaredprimary">
<h2><a class="toc-backref" href="#id130">chromaRedPrimary</a></h2>
<p>Chromaticity red primary point (e.g. x=0.64, y=0.33):</p>
<pre class="literal-block">void chromaRedPrimary ( const double x_, const double y_ )
void chromaRedPrimary ( double *x_, double *y_ ) const</pre>
</section>
<section id="chromawhitepoint">
<h2><a class="toc-backref" href="#id131">chromaWhitePoint</a></h2>
<p>Chromaticity white point (e.g. x=0.3127, y=0.329):</p>
<pre class="literal-block">void chromaWhitePoint ( const double x_, const double y_ )
void chromaWhitePoint ( double *x_, double *y_ ) const</pre>
</section>
<section id="classtype">
<h2><a class="toc-backref" href="#id132">classType</a></h2>
<p>Image class (DirectClass or PseudoClass). NOTE: setting a DirectClass
image to PseudoClass will result in the loss of color information if
the number of colors in the image is greater than the maximum palette
size (either 256 or 65536 entries depending on the value of
QuantumDepth when ImageMagick was built):</p>
<pre class="literal-block">void classType ( const ClassType class_ )
ClassType classType ( void ) const</pre>
</section>
<section id="clipmask">
<h2><a class="toc-backref" href="#id133">clipMask</a></h2>
<p>Associate a clip mask image with the current image. The clip mask
image must have the same dimensions as the current image or an
exception is thrown. Clipping occurs wherever pixels are transparent
in the clip mask image. Clipping Pass an invalid image to unset an
existing clip mask:</p>
<pre class="literal-block">void clipMask ( const Image & clipMask_ )
Image clipMask ( void ) const</pre>
</section>
<section id="colorfuzz">
<h2><a class="toc-backref" href="#id134">colorFuzz</a></h2>
<p>Colors within this distance are considered equal. A number of
algorithms search for a target color. By default the color must be
exact. Use this option to match colors that are close to the target
color in RGB space:</p>
<pre class="literal-block">void colorFuzz ( const double fuzz_ )
double colorFuzz ( void ) const</pre>
</section>
<section id="colormap">
<h2><a class="toc-backref" href="#id135">colorMap</a></h2>
<p><a class="reference external" href="Color.html">Color</a> at colormap position <cite>index</cite>:</p>
<pre class="literal-block">void colorMap ( const unsigned int index_,
const Color &color_ )
Color colorMap ( const unsigned int index_ ) const</pre>
</section>
<section id="colormapsize">
<h2><a class="toc-backref" href="#id136">colorMapSize</a></h2>
<p>Number of entries in the colormap. Setting the colormap size may
extend or truncate the colormap. The maximum number of supported
entries is specified by the MaxColormapSize constant, and is dependent
on the value of QuantumDepth when GraphicsMagick is compiled. An
exception is thrown if more entries are requested than may be
supported. Care should be taken when truncating the colormap to ensure
that the image colormap indexes reference valid colormap entries:</p>
<pre class="literal-block">void colorMapSize ( const unsigned int entries_ )
unsigned int colorMapSize ( void )</pre>
</section>
<section id="colorspace">
<h2><a class="toc-backref" href="#id137">colorSpace</a></h2>
<p>The colorspace (e.g. CMYK) used to represent the image pixel colors:</p>
<pre class="literal-block">void colorSpace( const ColorspaceType colorSpace_ )
ColorspaceType colorSpace ( void ) const</pre>
</section>
<section id="columns">
<h2><a class="toc-backref" href="#id138">columns</a></h2>
<p>Image width:</p>
<pre class="literal-block">unsigned int columns ( void ) const</pre>
</section>
<section id="id4">
<h2><a class="toc-backref" href="#id139">comment</a></h2>
<p>Image comment:</p>
<pre class="literal-block">std::string comment ( void ) const</pre>
</section>
<section id="compose">
<h2><a class="toc-backref" href="#id140">compose</a></h2>
<p>Composition operator to be used when composition is implicitly
used (such as for image flattening):</p>
<pre class="literal-block">void compose (const CompositeOperator compose_)
CompositeOperator compose ( void ) const</pre>
</section>
<section id="compresstype">
<h2><a class="toc-backref" href="#id141">compressType</a></h2>
<p>Image compresion type. The default is the compression type of the
input image file:</p>
<pre class="literal-block">void compressType ( const CompressionType compressType_ )
CompressionType compressType ( void ) const</pre>
</section>
<section id="debug">
<h2><a class="toc-backref" href="#id142">debug</a></h2>
<p>Enable printing of debug messages from GraphicsMagick as it executes:</p>
<pre class="literal-block">void debug ( const bool flag_ )
bool debug ( void ) const</pre>
</section>
<section id="definevalue">
<h2><a class="toc-backref" href="#id143">defineValue</a></h2>
<p>Set or obtain a definition string to applied when encoding or decoding
the specified format. The meanings of the definitions are format
specific. The format is designated by the <cite>magick</cite> argument, the
format-specific key is designated by <cite>key</cite>, and the associated value
is specified by <cite>value</cite>. See the defineSet() method if the key must be
removed entirely:</p>
<pre class="literal-block">void defineValue ( const std::string &magick_,
const std::string &key_,
const std::string &value_ )
std::string defineValue ( const std::string &magick_,
const std::string &key_ ) const</pre>
</section>
<section id="defineset">
<h2><a class="toc-backref" href="#id144">defineSet</a></h2>
<p>Set or obtain a definition flag to applied when encoding or decoding
the specified format. Similar to the defineValue() method except that
passing the <cite>flag</cite> value 'true' creates a value-less define with that
format and key. Passing the <cite>flag</cite> value 'false' removes any existing
matching definition. The method returns 'true' if a matching key
exists, and 'false' if no matching key exists:</p>
<pre class="literal-block">void defineSet ( const std::string &magick_,
const std::string &key_,
bool flag_ )
bool defineSet ( const std::string &magick_,
const std::string &key_ ) const</pre>
</section>
<section id="density">
<h2><a class="toc-backref" href="#id145">density</a></h2>
<p>Vertical and horizontal resolution in pixels of the image. This option
specifies an image density when decoding a Postscript or Portable
Document page. Often used with <cite>psPageSize</cite>:</p>
<pre class="literal-block">void density ( const Geometry &geomery_ )
Geometry density ( void ) const</pre>
<p>Please note that the 'density' method suffers from a design problem in
that the Geometry object only supports integer dimensions, but the
underlying image resolution is a floating point value. This results
in rounding off the value. Please see the xResolution() and
yResolution() methods for a way to set and get the resolution in
floating point.</p>
<p>The resolution units may be obtained via the resolutionUnits() method.</p>
</section>
<section id="depth">
<h2><a class="toc-backref" href="#id146">depth</a></h2>
<p>Image depth (bits allocated to red/green/blue components). Used to
specify the bit depth when reading or writing raw images or when the
output format supports multiple depths. Defaults to the quantum depth
that GraphicsMagick is compiled with:</p>
<pre class="literal-block">void depth ( const unsigned int depth_ )
unsigned int depth ( void ) const</pre>
</section>
<section id="directory">
<h2><a class="toc-backref" href="#id147">directory</a></h2>
<p>Tile names from within an image montage:</p>
<pre class="literal-block">std::string directory ( void ) const</pre>
</section>
<section id="endian">
<h2><a class="toc-backref" href="#id148">endian</a></h2>
<p>Endianness (<cite>LSBEndian</cite> like Intel, <cite>MSBEndian</cite> like SPARC, or
<cite>NativeEndian</cite> for what this computer uses) for image formats which
support endian-specific options:</p>
<pre class="literal-block">void endian ( const EndianType endian_ )
EndianType endian ( void ) const</pre>
</section>
<section id="filename">
<h2><a class="toc-backref" href="#id149">fileName</a></h2>
<p>Image file name:</p>
<pre class="literal-block">void fileName ( const std::string &fileName_ )
std::string fileName ( void ) const</pre>
</section>
<section id="filesize">
<h2><a class="toc-backref" href="#id150">fileSize</a></h2>
<p>Number of bytes of the image on disk:</p>
<pre class="literal-block">off_t fileSize ( void ) const</pre>
</section>
<section id="fillcolor">
<h2><a class="toc-backref" href="#id151">fillColor</a></h2>
<p><a class="reference external" href="Color.html">Color</a> to use when filling drawn objects:</p>
<pre class="literal-block">void fillColor ( const Color &fillColor_ )
Color fillColor ( void ) const</pre>
</section>
<section id="fillpattern">
<h2><a class="toc-backref" href="#id152">fillPattern</a></h2>
<p>Pattern to use while filling drawn objects:</p>
<pre class="literal-block">void fillPattern ( const Image &fillPattern_ )
Image fillPattern ( void ) const</pre>
</section>
<section id="fillrule">
<h2><a class="toc-backref" href="#id153">fillRule</a></h2>
<p>Rule to use when filling drawn objects:</p>
<pre class="literal-block">void fillRule ( const FillRule &fillRule_ )
FillRule fillRule ( void ) const</pre>
</section>
<section id="filtertype">
<h2><a class="toc-backref" href="#id154">filterType</a></h2>
<p>Filter to use when resizing image. The reduction filter employed has a
sigificant effect on the time required to resize an image and the
resulting quality. The default filter is Lanczos which has been shown
to produce high quality results when reducing most images:</p>
<pre class="literal-block">void filterType ( const FilterTypes filterType_ )
FilterTypes filterType ( void ) const</pre>
</section>
<section id="font">
<h2><a class="toc-backref" href="#id155">font</a></h2>
<p>Text rendering font. If the font is a fully qualified X server font
name, the font is obtained from an X server. To use a TrueType font,
precede the TrueType filename with an @. Otherwise, specify a
Postscript font name (e.g. "helvetica").:</p>
<pre class="literal-block">void font ( const std::string &font_ )
std::string font ( void ) const</pre>
</section>
<section id="fontpointsize">
<h2><a class="toc-backref" href="#id156">fontPointsize</a></h2>
<p>Text rendering font point size:</p>
<pre class="literal-block">void fontPointsize ( const double pointSize_ )
double fontPointsize ( void ) const</pre>
</section>
<section id="fonttypemetrics">
<h2><a class="toc-backref" href="#id157">fontTypeMetrics</a></h2>
<p>Obtain font metrics (see <a class="reference external" href="TypeMetric.html">TypeMetric</a>) for text string given current
font, pointsize, and density settings. This information is necessary
in order to do fancy layout of text:</p>
<pre class="literal-block">void fontTypeMetrics( const std::string &text_,
TypeMetric *metrics )</pre>
</section>
<section id="format">
<h2><a class="toc-backref" href="#id158">format</a></h2>
<p>Long image format description:</p>
<pre class="literal-block">std::string format ( void ) const</pre>
</section>
<section id="formatexpression">
<h2><a class="toc-backref" href="#id159">formatExpression</a></h2>
<p>Format a string based on image properties similar to <cite>identify</cite>
<cite>-format</cite>. For example, the format expression "%wx%h" is converted to
a string containing image WIDTHxHEIGHT like "640x480":</p>
<pre class="literal-block">std::string formatExpression( const std::string expression )</pre>
<p>Please note that this method is not a const method (may modify the
Image object and will assure a reference count of one) and it <em>may</em>
throw an exception if there is an internal error.</p>
<p>The formatExpressionRef() method is preferred given that the argument
is passed by reference, but formatExpression() is in all editions of
Magick++.</p>
</section>
<section id="formatexpressionref">
<h2><a class="toc-backref" href="#id160">formatExpressionRef</a></h2>
<p>Format a string based on image properties similar to <cite>identify</cite>
<cite>-format</cite>. For example, the format expression "%wx%h" is converted to
a string containing image WIDTHxHEIGHT like "640x480":</p>
<pre class="literal-block">std::string formatExpression( const std::string &expression )</pre>
<p>Please note that this method is not a const method (may modify the
Image object and will assure a reference count of one) and it <em>may</em>
throw an exception if there is an internal error.</p>
</section>
<section id="id5">
<h2><a class="toc-backref" href="#id161">gamma</a></h2>
<p>Gamma level of the image. Gamma is a pow() function which converts
between the linear light representation and the representation for the
computer display. Most computer images are gamma corrected to 2.2
(1/0.4545) so that each step results in a visually linear step on a
computer or video display:</p>
<pre class="literal-block">double gamma ( void ) const</pre>
</section>
<section id="id6">
<h2><a class="toc-backref" href="#id162">geometry</a></h2>
<p>Preferred size of the image when encoding:</p>
<pre class="literal-block">Geometry geometry ( void ) const</pre>
</section>
<section id="gifdisposemethod">
<h2><a class="toc-backref" href="#id163">gifDisposeMethod</a></h2>
<p>GIF disposal method. This option (specific to the GIF file format) is
used to control how successive frames are rendered (how the preceding
frame is disposed of) when creating a GIF animation:</p>
<pre class="literal-block">void gifDisposeMethod ( const unsigned int disposeMethod_ )
unsigned int gifDisposeMethod ( void ) const</pre>
</section>
<section id="icccolorprofile">
<h2><a class="toc-backref" href="#id164">iccColorProfile</a></h2>
<p>ICC color profile. Supplied via a <a class="reference external" href="Blob.html">Blob</a> since Magick++/ and
GraphicsMagick do not currently support formating this data structure
directly.</p>
<p>If there is not already an ICC color profile, the profile is merely
attached to the image without transforming the pixels. If there is
already an ICC color profile (the source profile), the pixels are
translated according to the source and target profiles, and the
existing profile is replaced with the target profile.</p>
<p>Also see <a class="reference internal" href="#renderingintent">renderingIntent</a>, which allows specifying the rendering
intent if the profile is executed.</p>
<p>Specifications for ICC color profiles and their usage are available
from the International Color Consortium for the format of ICC color
profiles:</p>
<pre class="literal-block">void iccColorProfile( const Blob &colorProfile_ )
Blob iccColorProfile( void ) const</pre>
</section>
<section id="interlacetype">
<h2><a class="toc-backref" href="#id165">interlaceType</a></h2>
<p>The type of interlacing scheme (default <cite>NoInterlace</cite> ). This option
is used to specify the type of interlacing scheme for raw image
formats such as RGB or YUV. <cite>NoInterlace</cite> means do not interlace,
<cite>LineInterlace</cite> uses scanline interlacing, and <cite>PlaneInterlace</cite> uses
plane interlacing. <cite>PartitionInterlace</cite> is like <cite>PlaneInterlace</cite>
except the different planes are saved to individual files (e.g.
image.R, image.G, and image.B). Use <cite>LineInterlace</cite> or
<cite>PlaneInterlace</cite> to create an interlaced GIF or progressive JPEG
image:</p>
<pre class="literal-block">void interlaceType ( const InterlaceType interlace_ )
InterlaceType interlaceType ( void ) const</pre>
</section>
<section id="iptcprofile">
<h2><a class="toc-backref" href="#id166">iptcProfile</a></h2>
<p>IPTC profile. Supplied via a <a class="reference external" href="Blob.html">Blob</a> since Magick++ and GraphicsMagick do
not currently support formating this data structure
directly. Specifications are available from the International Press
Telecommunications Council for IPTC profiles:</p>
<pre class="literal-block">void iptcProfile( const Blob& iptcProfile_ )
Blob iptcProfile( void ) const</pre>
</section>
<section id="isvalid">
<h2><a class="toc-backref" href="#id167">isValid</a></h2>
<p>Does object contain valid image? Set to <cite>false</cite> in order to invalidate
the image. Images constructed via the default constructor are invalid
images and isValid() will return false:</p>
<pre class="literal-block">void isValid ( const bool isValid_ )
bool isValid ( void ) const</pre>
</section>
<section id="id7">
<h2><a class="toc-backref" href="#id168">label</a></h2>
<p>Image label:</p>
<pre class="literal-block">std::string label ( void ) const</pre>
</section>
<section id="linewidth">
<h2><a class="toc-backref" href="#id169">lineWidth</a></h2>
<p>Stroke width for drawing vector objects (default one)
This method is now deprecated. Please use strokeWidth instead:</p>
<pre class="literal-block">void lineWidth ( const double lineWidth_ )
double lineWidth ( void ) const</pre>
</section>
<section id="magick">
<h2><a class="toc-backref" href="#id170">magick</a></h2>
<p>File type magick identifier (.e.g "GIF"):</p>
<pre class="literal-block">void magick ( const std::string &magick_ )
std::string magick ( void ) const</pre>
</section>
<section id="matte">
<h2><a class="toc-backref" href="#id171">matte</a></h2>
<p>Image supports transparency (matte channel):</p>
<pre class="literal-block">void matte ( const bool matteFlag_ )
bool matte ( void ) const</pre>
</section>
<section id="mattecolor">
<h2><a class="toc-backref" href="#id172">matteColor</a></h2>
<p>Image matte (frame) <a class="reference external" href="Color.html">color</a>:</p>
<pre class="literal-block">void matteColor ( const Color &matteColor_ )
Color matteColor ( void ) const</pre>
</section>
<section id="meanerrorperpixel">
<h2><a class="toc-backref" href="#id173">meanErrorPerPixel</a></h2>
<p>The mean error per pixel computed when an image is color reduced. This
parameter is only valid if verbose is set to true and the image has
just been quantized:</p>
<pre class="literal-block">double meanErrorPerPixel ( void ) const</pre>
</section>
<section id="modulusdepth">
<h2><a class="toc-backref" href="#id174">modulusDepth</a></h2>
<p>Image modulus depth (minimum number of bits required to support
red/green/blue components without loss of accuracy). The pixel modulus
depth may be decreased by supplying a value which is less than the
current value, updating the pixels (reducing accuracy) to the new
depth. The pixel modulus depth can not be increased over the current
value using this method:</p>
<pre class="literal-block">void modulusDepth ( const unsigned int modulusDepth_ )
unsigned int modulusDepth ( void ) const</pre>
</section>
<section id="monochrome">
<h2><a class="toc-backref" href="#id175">monochrome</a></h2>
<p>Transform image to black and white while color reducing (quantizing):</p>
<pre class="literal-block">void monochrome ( const bool monochromeFlag_ )
bool monochrome ( void ) const</pre>
</section>
<section id="montagegeometry">
<h2><a class="toc-backref" href="#id176">montageGeometry</a></h2>
<p>Tile size and offset within an image montage. Only valid for montage
images:</p>
<pre class="literal-block">Geometry montageGeometry ( void ) const</pre>
</section>
<section id="normalizedmaxerror">
<h2><a class="toc-backref" href="#id177">normalizedMaxError</a></h2>
<p>The normalized max error per pixel computed when an image is color
reduced. This parameter is only valid if verbose is set to true and
the image has just been quantized:</p>
<pre class="literal-block">double normalizedMaxError ( void ) const</pre>
</section>
<section id="normalizedmeanerror">
<h2><a class="toc-backref" href="#id178">normalizedMeanError</a></h2>
<p>The normalized mean error per pixel computed when an image is color
reduced. This parameter is only valid if verbose is set to true and
the image has just been quantized:</p>
<pre class="literal-block">double normalizedMeanError ( void ) const</pre>
</section>
<section id="orientation">
<h2><a class="toc-backref" href="#id179">orientation</a></h2>
<p>Image orientation. Supported by some file formats such as DPX and
TIFF. Useful for turning the right way up:</p>
<pre class="literal-block">void orientation ( const OrientationType orientation_ )
OrientationType orientation ( void ) const</pre>
</section>
<section id="page">
<h2><a class="toc-backref" href="#id180">page</a></h2>
<p>Preferred size and location of an image canvas.</p>
<p>Use this option to specify the dimensions and position of the
Postscript page in dots per inch or a TEXT page in pixels. This option
is typically used in concert with density .</p>
<p>Page may also be used to position a GIF image (such as for a scene in
an animation):</p>
<pre class="literal-block">void page ( const Geometry &pageSize_ )
Geometry page ( void ) const</pre>
</section>
<section id="pixelcolor">
<h2><a class="toc-backref" href="#id181">pixelColor</a></h2>
<p>Get/set pixel <a class="reference external" href="Color.html">color</a> at location x & y:</p>
<pre class="literal-block">void pixelColor ( const unsigned int x_,
const unsigned int y_,
const Color &color_ )
Color pixelColor ( const unsigned int x_,
const unsigned int y_ ) const</pre>
</section>
<section id="profile">
<h2><a class="toc-backref" href="#id182">profile</a></h2>
<p>Add or remove a named profile to/from the image. Remove the
profile by passing an empty <a class="reference external" href="Blob.html">Blob</a> (e.g. Blob()). Valid names are
"*", "8BIM", "ICM", "IPTC", or a user/format-defined profile name:</p>
<pre class="literal-block">void profile( const std::string name_,
const Blob &colorProfile_ )</pre>
<p>Retrieve a named profile from the image. Valid names are:
"8BIM", "8BIMTEXT", "APP1", "APP1JPEG", "ICC", "ICM", & "IPTC"
or an existing user/format-defined profile name:</p>
<pre class="literal-block">Blob profile( const std::string name_ ) const</pre>
</section>
<section id="quality">
<h2><a class="toc-backref" href="#id183">quality</a></h2>
<p>JPEG/MIFF/PNG compression level (default 75):</p>
<pre class="literal-block">void quality ( const unsigned int quality_ )
unsigned int quality ( void ) const</pre>
</section>
<section id="quantizecolors">
<h2><a class="toc-backref" href="#id184">quantizeColors</a></h2>
<p>Maximum number of colors to quantize to:</p>
<pre class="literal-block">void quantizeColors ( const unsigned int colors_ )
unsigned int quantizeColors ( void ) const</pre>
</section>
<section id="quantizecolorspace">
<h2><a class="toc-backref" href="#id185">quantizeColorSpace</a></h2>
<p>Colorspace to quantize in (default RGB). Empirical evidence suggests
that distances in color spaces such as YUV or YIQ correspond to
perceptual color differences more closely than do distances in RGB
space. These color spaces may give better results when color reducing
an image:</p>
<pre class="literal-block">void quantizeColorSpace ( const ColorspaceType colorSpace_ )
ColorspaceType quantizeColorSpace ( void ) const</pre>
</section>
<section id="quantizedither">
<h2><a class="toc-backref" href="#id186">quantizeDither</a></h2>
<p>Apply Floyd/Steinberg error diffusion to the image. The basic strategy
of dithering is to trade intensity resolution for spatial resolution
by averaging the intensities of several neighboring pixels. Images
which suffer from severe contouring when reducing colors can be
improved with this option. The quantizeColors or monochrome option
must be set for this option to take effect:</p>
<pre class="literal-block">void quantizeDither ( const bool ditherFlag_ )
bool quantizeDither ( void ) const</pre>
</section>
<section id="quantizetreedepth">
<h2><a class="toc-backref" href="#id187">quantizeTreeDepth</a></h2>
<p>Depth of the quantization color classification tree. Values of 0 or 1
allow selection of the optimal tree depth for the color reduction
algorithm. Values between 2 and 8 may be used to manually adjust the
tree depth:</p>
<pre class="literal-block">void quantizeTreeDepth ( const unsigned int treeDepth_ )
unsigned int quantizeTreeDepth ( void ) const</pre>
</section>
<section id="quiet">
<h2><a class="toc-backref" href="#id188">quiet</a></h2>
<p>Determines if Warning exceptions will be thrown, or suppressed.
The default is that warnings will be thrown (i.e. false):</p>
<pre class="literal-block">void quiet ( const bool quiet_ );
bool quiet ( void ) const;</pre>
</section>
<section id="renderingintent">
<h2><a class="toc-backref" href="#id189">renderingIntent</a></h2>
<p>The type of rendering intent (used when applying an ICC color
profile using <a class="reference internal" href="#icccolorprofile">iccColorProfile</a>):</p>
<pre class="literal-block">void renderingIntent ( const RenderingIntent renderingIntent_ )
RenderingIntent renderingIntent ( void ) const</pre>
</section>
<section id="repage">
<h2><a class="toc-backref" href="#id190">repage</a></h2>
<p>Reset the image page canvas and position:</p>
<pre class="literal-block">void repage();</pre>
</section>
<section id="resolutionunits">
<h2><a class="toc-backref" href="#id191">resolutionUnits</a></h2>
<p>Units of image resolution:</p>
<pre class="literal-block">void resolutionUnits ( const ResolutionType resolutionUnits_ )
ResolutionType resolutionUnits ( void ) const</pre>
</section>
<section id="rows">
<h2><a class="toc-backref" href="#id192">rows</a></h2>
<p>The number of pixel rows in the image:</p>
<pre class="literal-block">unsigned int rows ( void ) const</pre>
</section>
<section id="scene">
<h2><a class="toc-backref" href="#id193">scene</a></h2>
<p>Image scene number:</p>
<pre class="literal-block">void scene ( const unsigned int scene_ )
unsigned int scene ( void ) const</pre>
</section>
<section id="signature">
<h2><a class="toc-backref" href="#id194">signature</a></h2>
<p>Image textual signature. Set <cite>force</cite> to true in order to re-calculate
the signature regardless of whether the image data has been modified:</p>
<pre class="literal-block">std::string signature ( const bool force_ = false ) const</pre>
</section>
<section id="size">
<h2><a class="toc-backref" href="#id195">size</a></h2>
<p>Width and height of a raw image (an image which does not support width
and height information). Size may also be used to affect the image
size read from a multi-resolution format (e.g. Photo CD, JBIG, or
JPEG:</p>
<pre class="literal-block">void size ( const Geometry &geometry_ )
Geometry size ( void ) const</pre>
</section>
<section id="statistics">
<h2><a class="toc-backref" href="#id196">statistics</a></h2>
<p>Obtain image statistics. Statistics are normalized to the range
of 0.0 to 1.0 and are output to the specified ImageStatistics
structure:</p>
<pre class="literal-block">void statistics ( ImageStatistics *statistics ) const</pre>
</section>
<section id="strokeantialias">
<h2><a class="toc-backref" href="#id197">strokeAntiAlias</a></h2>
<p>Enable/disable stroke anti-aliasing:</p>
<pre class="literal-block">void strokeAntiAlias( const bool flag_ )
bool strokeAntiAlias( void ) const</pre>
</section>
<section id="strokecolor">
<h2><a class="toc-backref" href="#id198">strokeColor</a></h2>
<p><a class="reference external" href="Color.html">Color</a> to use when drawing object outlines:</p>
<pre class="literal-block">void strokeColor ( const Color &strokeColor_ )
Color strokeColor ( void ) const</pre>
</section>
<section id="strokedasharray">
<h2><a class="toc-backref" href="#id199">strokeDashArray</a></h2>
<p>Specify the pattern of dashes and gaps used to stroke paths. The
strokeDashArray represents a zero-terminated array of numbers that
specify the lengths of alternating dashes and gaps in pixels. If an
odd number of values is provided, then the list of values is repeated
to yield an even number of values. A typical <cite>strokeDashArray</cite> array
might contain the members 5 3 2 0, where the zero value indicates the
end of the pattern array:</p>
<pre class="literal-block">void strokeDashArray ( const double* strokeDashArray_ )
const double* strokeDashArray ( void ) const</pre>
</section>
<section id="strokedashoffset">
<h2><a class="toc-backref" href="#id200">strokeDashOffset</a></h2>
<p>While drawing using a dash pattern, specify distance into the
dash pattern to start the dash (default 0):</p>
<pre class="literal-block">void strokeDashOffset ( const double strokeDashOffset_ )
double strokeDashOffset ( void ) const</pre>
</section>
<section id="strokelinecap">
<h2><a class="toc-backref" href="#id201">strokeLineCap</a></h2>
<p>Specify the shape to be used at the end of open subpaths when
they are stroked. Values of LineCap are UndefinedCap, ButtCap,
RoundCap, and SquareCap:</p>
<pre class="literal-block">void strokeLineCap ( const LineCap lineCap_ )
LineCap strokeLineCap ( void ) const</pre>
</section>
<section id="strokelinejoin">
<h2><a class="toc-backref" href="#id202">strokeLineJoin</a></h2>
<p>Specify the shape to be used at the corners of paths (or other
vector shapes) when they are stroked. Values of LineJoin are
UndefinedJoin, MiterJoin, RoundJoin, and BevelJoin:</p>
<pre class="literal-block">void strokeLineJoin ( const LineJoin lineJoin_ )
LineJoin strokeLineJoin ( void ) const</pre>
</section>
<section id="strokemiterlimit">
<h2><a class="toc-backref" href="#id203">strokeMiterLimit</a></h2>
<p>Specify miter limit. When two line segments meet at a sharp
angle and miter joins have been specified for 'lineJoin', it is
possible for the miter to extend far beyond the thickness of
the line stroking the path. The miterLimit' imposes a limit on
the ratio of the miter length to the 'lineWidth'. The default
value of this parameter is 4:</p>
<pre class="literal-block">void strokeMiterLimit ( const unsigned int miterLimit_ )
unsigned int strokeMiterLimit ( void ) const</pre>
</section>
<section id="strokepattern">
<h2><a class="toc-backref" href="#id204">strokePattern</a></h2>
<p>Pattern image to use while stroking object outlines:</p>
<pre class="literal-block">void strokePattern ( const Image &strokePattern_ )
Image strokePattern ( void ) const</pre>
</section>
<section id="strokewidth">
<h2><a class="toc-backref" href="#id205">strokeWidth</a></h2>
<p>Stroke width for drawing vector objects (default one):</p>
<pre class="literal-block">void strokeWidth ( const double strokeWidth_ )
double strokeWidth ( void ) const</pre>
</section>
<section id="subimage">
<h2><a class="toc-backref" href="#id206">subImage</a></h2>
<p>Subimage of an image sequence:</p>
<pre class="literal-block">void subImage ( const unsigned int subImage_ )
unsigned int subImage ( void ) const</pre>
</section>
<section id="subrange">
<h2><a class="toc-backref" href="#id207">subRange</a></h2>
<p>Number of images relative to the base image:</p>
<pre class="literal-block">void subRange ( const unsigned int subRange_ )
unsigned int subRange ( void ) const</pre>
</section>
<section id="textencoding">
<h2><a class="toc-backref" href="#id208">textEncoding</a></h2>
<p>Annotation text encoding (e.g. "UTF-16"):</p>
<pre class="literal-block">void textEncoding ( const std::string &encoding_ )
std::string textEncoding ( void ) const</pre>
</section>
<section id="tilename">
<h2><a class="toc-backref" href="#id209">tileName</a></h2>
<p>Tile name:</p>
<pre class="literal-block">void tileName ( const std::string &tileName_ )
std::string tileName ( void ) const</pre>
</section>
<section id="totalcolors">
<h2><a class="toc-backref" href="#id210">totalColors</a></h2>
<p>Number of colors in the image:</p>
<pre class="literal-block">unsigned long totalColors ( void )</pre>
</section>
<section id="transformorigin">
<h2><a class="toc-backref" href="#id211">transformOrigin</a></h2>
<p>Origin of coordinate system to use when annotating with text or drawing:</p>
<pre class="literal-block">void transformOrigin ( const double x_,const double y_ )</pre>
</section>
<section id="transformrotation">
<h2><a class="toc-backref" href="#id212">transformRotation</a></h2>
<p>Rotation to use when annotating with text or drawing:</p>
<pre class="literal-block">void transformRotation ( const double angle_ )</pre>
</section>
<section id="transformreset">
<h2><a class="toc-backref" href="#id213">transformReset</a></h2>
<p>Reset transformation parameters to default:</p>
<pre class="literal-block">void transformReset ( void )</pre>
</section>
<section id="transformscale">
<h2><a class="toc-backref" href="#id214">transformScale</a></h2>
<p>Scale to use when annotating with text or drawing:</p>
<pre class="literal-block">void transformScale ( const double sx_, const double sy_ )</pre>
</section>
<section id="transformskewx">
<h2><a class="toc-backref" href="#id215">transformSkewX</a></h2>
<p>Skew to use in X axis when annotating with text or drawing:</p>
<pre class="literal-block">void transformSkewX ( const double skewx_ )</pre>
</section>
<section id="transformskewy">
<h2><a class="toc-backref" href="#id216">transformSkewY</a></h2>
<p>Skew to use in Y axis when annotating with text or drawing:</p>
<pre class="literal-block">void transformSkewY ( const double skewy_ )</pre>
</section>
<section id="verbose">
<h2><a class="toc-backref" href="#id217">verbose</a></h2>
<p>Print detailed information about the image:</p>
<pre class="literal-block">void verbose ( const bool verboseFlag_ )
bool verbose ( void ) const</pre>
</section>
<section id="view">
<h2><a class="toc-backref" href="#id218">view</a></h2>
<p>FlashPix viewing parameters:</p>
<pre class="literal-block">void view ( const std::string &view_ )
std::string view ( void ) const</pre>
</section>
<section id="x11display">
<h2><a class="toc-backref" href="#id219">x11Display</a></h2>
<p>X11 display to display to, obtain fonts from, or to capture
image from:</p>
<pre class="literal-block">void x11Display ( const std::string &display_ )
std::string x11Display ( void ) const</pre>
</section>
<section id="xresolution">
<h2><a class="toc-backref" href="#id220">xResolution</a></h2>
<p>x resolution of the image:</p>
<pre class="literal-block">void xResolution ( const double x_resolution )
double xResolution ( void ) const</pre>
</section>
<section id="yresolution">
<h2><a class="toc-backref" href="#id221">yResolution</a></h2>
<p>y resolution of the image:</p>
<pre class="literal-block">void yResolution ( const double y_resolution )
double yResolution ( void ) const</pre>
</section>
</section>
<section id="low-level-image-pixel-access">
<h1><a class="toc-backref" href="#id15">Low-Level Image Pixel Access</a></h1>
<p>Image pixels (of type <a class="reference external" href="PixelPacket.html">PixelPacket</a> ) may be accessed directly via
the Image Pixel Cache . The image pixel cache is a rectangular window
into the actual image pixels (which may be in memory, memory-mapped
from a disk file, or entirely on disk). Two interfaces exist to access
the Image Pixel Cache. The interface described here (part of the Image
class) supports only one view at a time. See the <a class="reference external" href="Pixels.html">Pixels</a> class for a
more abstract interface which supports simultaneous pixel views (up to
the number of rows). As an analogy, the interface described here
relates to the <a class="reference external" href="Pixels.html">Pixels</a> class as stdio's gets() relates to
fgets(). The <a class="reference external" href="Pixels.html">Pixels</a> class provides the more general form of the
interface.</p>
<p>Obtain existing image pixels via getPixels(). Create a new pixel
region using setPixels().</p>
<p>In order to ensure that only the current generation of the image is
modified, the Image's modifyImage() method should be invoked to reduce
the reference count on the underlying image to one. If this is not
done, then it is possible for a previous generation of the image to be
modified due to the use of reference counting when copying or
constructing an Image.</p>
<p>Depending on the capabilities of the operating system, and the
relationship of the window to the image, the pixel cache may be a copy
of the pixels in the selected window, or it may be the actual image
pixels. In any case calling syncPixels() insures that the base image
is updated with the contents of the modified pixel cache. The method
readPixels() supports copying foreign pixel data formats into the
pixel cache according to the QuantumTypes. The method writePixels()
supports copying the pixels in the cache to a foreign pixel
representation according to the format specified by QuantumTypes.</p>
<p>The pixel region is effectively a small image in which the pixels may
be accessed, addressed, and updated, as shown in the following
example:</p>
<p><img alt="pixel_cache" src="Cache.png" /></p>
<pre class="literal-block">// Construct image based on an existing file
Image image("cow.png");
// Ensure that there are no other references to this image.
image.modifyImage();
// Set the image type to TrueColor DirectClass representation.
image.type(TrueColorType);
// Request pixel region with size 60x40, and top origin at 20x30
int columns = 60;
PixelPacket *pixel_cache = image.getPixels(20,30,columns,40);
// Set pixel at column 5, and row 10 in the pixel cache to red.
int column = 5;
int row = 10;
PixelPacket *pixel = pixel_cache+row*columns+column;
*pixel = Color("red");
// Save changes to underlying image .
image.syncPixels();
// Save updated image to file.
image.write("horse.png");</pre>
<p>The image cache supports the following methods:</p>
<div class="contents local topic" id="id8">
<ul class="simple">
<li><p><a class="reference internal" href="#getconstpixels" id="id222">getConstPixels</a></p></li>
<li><p><a class="reference internal" href="#getindexes" id="id223">getIndexes</a></p></li>
<li><p><a class="reference internal" href="#getconstindexes" id="id224">getConstIndexes</a></p></li>
<li><p><a class="reference internal" href="#getpixels" id="id225">getPixels</a></p></li>
<li><p><a class="reference internal" href="#setpixels" id="id226">setPixels</a></p></li>
<li><p><a class="reference internal" href="#syncpixels" id="id227">syncPixels</a></p></li>
<li><p><a class="reference internal" href="#readpixels" id="id228">readPixels</a></p></li>
<li><p><a class="reference internal" href="#writepixels" id="id229">writePixels</a></p></li>
</ul>
</div>
<section id="getconstpixels">
<h2><a class="toc-backref" href="#id222">getConstPixels</a></h2>
<p>Transfers read-only pixels (DirectClass PixelPackets, and IndexPackets
if applicable for the image type) from the image to the pixel cache as
defined by the specified region:</p>
<pre class="literal-block">const PixelPacket* getConstPixels ( const int x_, const int y_,
const unsigned int columns_,
const unsigned int rows_ ) const</pre>
</section>
<section id="getindexes">
<h2><a class="toc-backref" href="#id223">getIndexes</a></h2>
<p>Obtain mutable image pixel indexes (valid for PseudoClass images). The
selected region is defined by the prior getPixels(), getConstPixels(),
or setPixels() call:</p>
<pre class="literal-block">IndexPacket* getIndexes ( void )</pre>
</section>
<section id="getconstindexes">
<h2><a class="toc-backref" href="#id224">getConstIndexes</a></h2>
<p>Obtain immutable image pixel indexes (valid for PseudoClass
images). The selected region is defined by the prior getPixels(),
getConstPixels(), or setPixels() call:</p>
<pre class="literal-block">const IndexPacket* getConstIndexes ( void ) const</pre>
</section>
<section id="getpixels">
<h2><a class="toc-backref" href="#id225">getPixels</a></h2>
<p>Transfers pixels (DirectClass PixelPackets, and IndexPackets if
applicable for the image type) from the image to the pixel cache as
defined by the specified region. Modified pixels may be subsequently
transferred back to the image via syncPixels:</p>
<pre class="literal-block">PixelPacket* getPixels ( const int x_, const int y_,
const unsigned int columns_,
const unsigned int rows_ )</pre>
</section>
<section id="setpixels">
<h2><a class="toc-backref" href="#id226">setPixels</a></h2>
<p>Allocates a pixel cache region to store image pixels as defined by the
region rectangle. This area is subsequently transferred from the
pixel cache to the image via syncPixels:</p>
<pre class="literal-block">PixelPacket* setPixels ( const int x_, const int y_,
const unsigned int columns_,
const unsigned int rows_ )</pre>
</section>
<section id="syncpixels">
<h2><a class="toc-backref" href="#id227">syncPixels</a></h2>
<p>Transfers the image cache pixels to the image:</p>
<pre class="literal-block">void syncPixels ( void )</pre>
</section>
<section id="readpixels">
<h2><a class="toc-backref" href="#id228">readPixels</a></h2>
<p>Transfers one or more pixel components from a buffer or file into the
image pixel cache of an image. Used to support image decoders:</p>
<pre class="literal-block">void readPixels ( const QuantumType quantum_,
const unsigned char *source_ )</pre>
</section>
<section id="writepixels">
<h2><a class="toc-backref" href="#id229">writePixels</a></h2>
<p>Transfers one or more pixel components from the image pixel cache to a
buffer or file. Used to support image encoders:</p>
<pre class="literal-block">void writePixels ( const QuantumType quantum_,
unsigned char *destination_ )</pre>
</section>
</section>
<section id="explicit-logging-configuration-and-callbacks">
<h1><a class="toc-backref" href="#id16">Explicit Logging Configuration And Callbacks</a></h1>
<p>It is sometimes useful for a program to not have to depend on a
configuration file for configuring logging ("tracing"). One reason
for this is because until a logging configuration file has been found
and loaded, default logging parameters are used. Another reason is
that in some configurations, it is useful for each instance of a
program to use its own logging configuration. To make this possible,
the Magick++ library provides pass-through functions which allow
setting the logging defaults <em>before</em> InitializeMagick() is called.
Setting logging defaults after InitializeMagick() is called has no
purpose since they will not be used.</p>
<p>The following C++ pass-through functions are available"</p>
<section id="setlogdefaulteventtype">
<h2>SetLogDefaultEventType</h2>
<p>Specify default events which will result in a log event (comma-comma-separated list):</p>
<pre class="literal-block">void SetLogDefaultEventType(const std::string &events_)</pre>
</section>
<section id="setlogdefaultgenerations">
<h2>SetLogDefaultGenerations</h2>
<p>Specify default maximum log file generations before overwriting the first name:</p>
<pre class="literal-block">void SetLogDefaultGenerations(const unsigned int generations_)</pre>
</section>
<section id="setlogdefaultlimit">
<h2>SetLogDefaultLimit</h2>
<p>Specify default maximum number of logging events before creating a new log file:</p>
<pre class="literal-block">void SetLogDefaultLimit(const unsigned int limit_)</pre>
</section>
<section id="setlogdefaultfilename">
<h2>SetLogDefaultFileName</h2>
<p>Specify the file name, or file path, to be written to for each log event:</p>
<pre class="literal-block">void SetLogDefaultFileName(const std::string &filename_)</pre>
</section>
<section id="setlogdefaultformat">
<h2>SetLogDefaultFormat</h2>
<p>Specify default log format using the same special format characters used by "log.mgk":</p>
<pre class="literal-block">void SetLogDefaultFormat(const std::string &format_)</pre>
</section>
<section id="setlogdefaultlogmethod">
<h2>SetLogDefaultLogMethod</h2>
<p>Specify default C-language call-back function to be invoked for each log event:</p>
<pre class="literal-block">void SetLogDefaultLogMethod(const Magick::LogMethod method_)</pre>
<p>Note that it is hoped that better mechanisms will be provided in the future.</p>
</section>
<section id="setlogdefaultoutputtype">
<h2>SetLogDefaultOutputType</h2>
<p>Specify default logging output type/destination:</p>
<pre class="literal-block">void SetLogDefaultOutputType(const Magick::LogOutputType output_type_)</pre>
<p>Available LogOutputType enumerations are DisabledOutput,
UndefinedOutput, StdoutOutput, StderrOutput, XMLFileOutput,
TXTFileOutput, Win32DebugOutput, Win32EventlogOutput, and
MethodOutput.</p>
<p>Copyright © <a class="reference external" href="mailto:bfriesen%40simple.dallas.tx.us">Bob Friesenhahn</a> 1999 - 2024</p>
</section>
</section>
</main>
<hr class="docutils">
<div class="document">
<p><a href="../Copyright.html">Copyright</a> © GraphicsMagick Group 2002-2025<!--SPONSOR_LOGO--></p>
</div>
</main>
</body>
</html>
|