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
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="en" name="language">
<title>Magick::Geometry</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-geometry">
<h1 class="title">Magick::Geometry</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. -->
<p>Geometry provides a convenient means to specify a geometry
argument. The object may be initialized from a C string or C++ string
containing a geometry specification. It may also be initialized by
more efficient parameterized constructors.</p>
<section id="x11-geometry-specifications">
<h1>X11 Geometry Specifications</h1>
<p>X11 geometry specifications are in the form
"<width>x<height>{+-}<xoffset>{+-}<yoffset>" (where width, height,
xoffset, and yoffset are numbers) for specifying the size and
placement location for an object.</p>
<p>The width and height parts of the geometry specification are measured
in pixels. The xoffset and yoffset parts are also measured in pixels
and are used to specify the distance of the placement coordinate from
the left and top and edges of the image, respectively. Both types of
offsets are measured from the indicated edge of the object to the
corresponding edge of the image. The X offset may be specified in the
following ways:</p>
<table>
<colgroup>
<col style="width: 13%" />
<col style="width: 87%" />
</colgroup>
<tbody>
<tr><td><p>+xoffset</p></td>
<td><p>The left edge of the object is to be placed xoffset
pixels in from the left edge of the image.</p></td>
</tr>
<tr><td><p>-xoffset</p></td>
<td><p>The left edge of the object is to be placed outside the
image, xoffset pixels out from the left edge of the image.</p></td>
</tr>
</tbody>
</table>
<p>The Y offset has similar meanings:</p>
<table>
<colgroup>
<col style="width: 14%" />
<col style="width: 86%" />
</colgroup>
<tbody>
<tr><td><p>+yoffset</p></td>
<td><p>The top edge of the object is to be yoffset pixels below
the top edge of the image.</p></td>
</tr>
<tr><td><p>-yoffset</p></td>
<td><p>The top edge of the object is to be yoffset pixels above
the top edge of the image.</p></td>
</tr>
</tbody>
</table>
<p>Offsets must be given as pairs; in other words, in order to specify
either xoffset or yoffset both must be present.</p>
</section>
<section id="graphicsmagick-extensions-to-x11-geometry-specifications">
<h1>GraphicsMagick Extensions To X11 Geometry Specifications</h1>
<p>GraphicsMagick has added a number of qualifiers to the standard
geometry string for use when resizing images. The form of an extended
geometry string is
"<width>x<height>{+-}<xoffset>{+-}<yoffset>{%}{@}{!}{^}{<}{>}". Extended
geometry strings should only be used when resizing an image. Using an
extended geometry string for other applications may cause the API call
to fail. The available qualifiers are shown in the following table:</p>
<table>
<caption>GraphicsMagick Geometry Qualifiers</caption>
<colgroup>
<col style="width: 12%" />
<col style="width: 88%" />
</colgroup>
<thead>
<tr><th class="head"><p>Qualifier</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr><td><p>%</p></td>
<td><p>Interpret width and height as a percentage of the current size.</p></td>
</tr>
<tr><td><p>!</p></td>
<td><p>Resize to width and height exactly, loosing original aspect ratio.</p></td>
</tr>
<tr><td><p><</p></td>
<td><p>Resize only if the image is smaller than the geometry specification.</p></td>
</tr>
<tr><td><p>></p></td>
<td><p>Resize only if the image is greater than the geometry specification.</p></td>
</tr>
<tr><td><p>@</p></td>
<td><p>Resize such that width and height are a maximum area in total pixels.</p></td>
</tr>
<tr><td><p>^</p></td>
<td><p>Dimensions are treated as minimum rather than maximum values.</p></td>
</tr>
</tbody>
</table>
</section>
<section id="postscript-page-size-extension-to-geometry-specifications">
<h1>Postscript Page Size Extension To Geometry Specifications</h1>
<p>Any geometry string specification supplied to the Geometry constructor
is considered to be a Postscript page size nickname if the first
character is not numeric. The page size nickname is not case
sensitive. The Geometry constructor converts these page size
specifications into the equivalent numeric geometry string
specification (preserving any offset component) prior to conversion to
the internal object format. Postscript page size specifications are
short-hand for the pixel geometry required to fill a page of that
size. Since the 11x17 inch page size used in the US starts with a
digit, it is not supported as a Postscript page size
nickname. Instead, substitute the geometry specification "792x1224>"
when 11x17 output is desired.</p>
<table>
<caption>Postscript Page Size Nicknames</caption>
<colgroup>
<col style="width: 32%" />
<col style="width: 68%" />
</colgroup>
<thead>
<tr><th class="head"><p>Postscript Nickname</p></th>
<th class="head"><p>Equivalent Extended Geometry Specification</p></th>
</tr>
</thead>
<tbody>
<tr><td><p>A0</p></td>
<td><p>2384x3370></p></td>
</tr>
<tr><td><p>A1</p></td>
<td><p>1684x2384></p></td>
</tr>
<tr><td><p>A10</p></td>
<td><p>73x105></p></td>
</tr>
<tr><td><p>A2</p></td>
<td><p>1191x1684></p></td>
</tr>
<tr><td><p>A3</p></td>
<td><p>842x1191></p></td>
</tr>
<tr><td><p>A4</p></td>
<td><p>595x842></p></td>
</tr>
<tr><td><p>A4SMALL</p></td>
<td><p>595x842></p></td>
</tr>
<tr><td><p>A5</p></td>
<td><p>420x595></p></td>
</tr>
<tr><td><p>A6</p></td>
<td><p>297x420></p></td>
</tr>
<tr><td><p>A7</p></td>
<td><p>210x297></p></td>
</tr>
<tr><td><p>A8</p></td>
<td><p>148x210></p></td>
</tr>
<tr><td><p>A9</p></td>
<td><p>105x148></p></td>
</tr>
<tr><td><p>ARCHA</p></td>
<td><p>648x864></p></td>
</tr>
<tr><td><p>ARCHB</p></td>
<td><p>864x1296></p></td>
</tr>
<tr><td><p>ARCHC</p></td>
<td><p>1296x1728></p></td>
</tr>
<tr><td><p>ARCHD</p></td>
<td><p>1728x2592></p></td>
</tr>
<tr><td><p>ARCHE</p></td>
<td><p>2592x3456></p></td>
</tr>
<tr><td><p>B0</p></td>
<td><p>2920x4127></p></td>
</tr>
<tr><td><p>B1</p></td>
<td><p>2064x2920></p></td>
</tr>
<tr><td><p>B10</p></td>
<td><p>91x127></p></td>
</tr>
<tr><td><p>B2</p></td>
<td><p>1460x2064></p></td>
</tr>
<tr><td><p>B3</p></td>
<td><p>1032x1460></p></td>
</tr>
<tr><td><p>B4</p></td>
<td><p>729x1032></p></td>
</tr>
<tr><td><p>B5</p></td>
<td><p>516x729></p></td>
</tr>
<tr><td><p>B6</p></td>
<td><p>363x516></p></td>
</tr>
<tr><td><p>B7</p></td>
<td><p>258x363></p></td>
</tr>
<tr><td><p>B8</p></td>
<td><p>181x258></p></td>
</tr>
<tr><td><p>B9</p></td>
<td><p>127x181></p></td>
</tr>
<tr><td><p>C0</p></td>
<td><p>2599x3676></p></td>
</tr>
<tr><td><p>C1</p></td>
<td><p>1837x2599></p></td>
</tr>
<tr><td><p>C2</p></td>
<td><p>1298x1837></p></td>
</tr>
<tr><td><p>C3</p></td>
<td><p>918x1296></p></td>
</tr>
<tr><td><p>C4</p></td>
<td><p>649x918></p></td>
</tr>
<tr><td><p>C5</p></td>
<td><p>459x649></p></td>
</tr>
<tr><td><p>C6</p></td>
<td><p>323x459></p></td>
</tr>
<tr><td><p>C7</p></td>
<td><p>230x323></p></td>
</tr>
<tr><td><p>EXECUTIVE</p></td>
<td><p>540x720></p></td>
</tr>
<tr><td><p>FLSA</p></td>
<td><p>612x936></p></td>
</tr>
<tr><td><p>FLSE</p></td>
<td><p>612x936></p></td>
</tr>
<tr><td><p>FOLIO</p></td>
<td><p>612x936></p></td>
</tr>
<tr><td><p>HALFLETTER</p></td>
<td><p>396x612></p></td>
</tr>
<tr><td><p>ISOB0</p></td>
<td><p>2835x4008></p></td>
</tr>
<tr><td><p>ISOB1</p></td>
<td><p>2004x2835></p></td>
</tr>
<tr><td><p>ISOB10</p></td>
<td><p>88x125></p></td>
</tr>
<tr><td><p>ISOB2</p></td>
<td><p>1417x2004></p></td>
</tr>
<tr><td><p>ISOB3</p></td>
<td><p>1001x1417></p></td>
</tr>
<tr><td><p>ISOB4</p></td>
<td><p>709x1001></p></td>
</tr>
<tr><td><p>ISOB5</p></td>
<td><p>499x709></p></td>
</tr>
<tr><td><p>ISOB6</p></td>
<td><p>354x499></p></td>
</tr>
<tr><td><p>ISOB7</p></td>
<td><p>249x354></p></td>
</tr>
<tr><td><p>ISOB8</p></td>
<td><p>176x249></p></td>
</tr>
<tr><td><p>ISOB9</p></td>
<td><p>125x176></p></td>
</tr>
<tr><td><p>LEDGER</p></td>
<td><p>1224x792></p></td>
</tr>
<tr><td><p>LEGAL</p></td>
<td><p>612x1008></p></td>
</tr>
<tr><td><p>LETTER</p></td>
<td><p>612x792></p></td>
</tr>
<tr><td><p>LETTERSMALL</p></td>
<td><p>612x792></p></td>
</tr>
<tr><td><p>QUARTO</p></td>
<td><p>610x780></p></td>
</tr>
<tr><td><p>STATEMENT</p></td>
<td><p>396x612></p></td>
</tr>
<tr><td><p>TABLOID</p></td>
<td><p>792x1224></p></td>
</tr>
</tbody>
</table>
<p>The following is the definition of the Magick::Geometry class:</p>
<pre class="literal-block">class Geometry
{
public:
Geometry ( unsigned int width_,
unsigned int height_,
unsigned int xOff_ = 0,
unsigned int yOff_ = 0,
bool xNegative_ = false,
bool yNegative_ = false );
Geometry ( const std::string &geometry_ );
Geometry ( const char * geometry_ );
Geometry ( const Geometry &geometry_ );
Geometry ( );
~Geometry ( void );
// Width
void width ( unsigned int width_ );
unsigned int width ( void ) const;
// Height
void height ( unsigned int height_ );
unsigned int height ( void ) const;
// X offset from origin
void xOff ( unsigned int xOff_ );
unsigned int xOff ( void ) const;
// Y offset from origin
void yOff ( unsigned int yOff_ );
unsigned int yOff ( void ) const;
// Sign of X offset negative? (X origin at right)
void xNegative ( bool xNegative_ );
bool xNegative ( void ) const;
// Sign of Y offset negative? (Y origin at bottom)
void yNegative ( bool yNegative_ );
bool yNegative ( void ) const;
// Width and height are expressed as percentages
void percent ( bool percent_ );
bool percent ( void ) const;
// Resize without preserving aspect ratio (!)
void aspect ( bool aspect_ );
bool aspect ( void ) const;
// Resize if image is greater than size (>)
void greater ( bool greater_ );
bool greater ( void ) const;
// Resize if image is less than size (<)
void less ( bool less_ );
bool less ( void ) const;
// Resize image to fit total pixel area specified by dimensions (@).
void limitPixels ( bool limitPixels_ );
bool limitPixels ( void ) const;
// Dimensions are treated as minimum rather than maximum values (^)
void fillArea ( bool fillArea_ );
bool fillArea ( void ) const;
// Does object contain valid geometry?
void isValid ( bool isValid_ );
bool isValid ( void ) const;
// Set via geometry string
const Geometry& operator = ( const std::string &geometry_ );
const Geometry& operator = ( const char * geometry_ );
// Assignment operator
Geometry& operator= ( const Geometry& Geometry_ );
// Return geometry string
operator std::string() const;
};</pre>
<p>Copyright © Bob Friesenhahn 1999 - 2022</p>
</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>
|