• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2
3
4
5<!doctype html>
6<html lang="en">
7<head>
8  <meta charset="utf-8"  />
9  <meta name="viewport" content="width=device-width, initial-scale=1"  />
10  <title>ImageMagick - MagickCore, C API: Resize an Image</title>
11  <meta name="application-name" content="ImageMagick" />
12  <meta name="description" content="Use ImageMagick® to create, edit, compose, and convert digital images. Resize an image, crop it, change its shades and colors, add captions, and more." />
13  <meta name="application-url" content="https://imagemagick.org" />
14  <meta name="generator" content="PHP" />
15  <meta name="keywords" content="magickcore, c, api:, resize, an, image, image processing software" />
16  <meta name="rating" content="GENERAL" />
17  <meta name="robots" content="INDEX, FOLLOW" />
18  <meta name="generator" content="ImageMagick Studio LLC" />
19  <meta name="author" content="ImageMagick Studio LLC" />
20  <meta name="revisit-after" content="2 DAYS" />
21  <meta name="resource-type" content="document" />
22  <meta name="copyright" content="Copyright (c) 1999-2020 ImageMagick Studio LLC" />
23  <meta name="distribution" content="Global" />
24  <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" />
25  <meta property='og:url' content='../../' />
26  <meta property='og:title' content='ImageMagick' />
27  <meta property='og:image' content='../../../images/logo.png' />
28  <meta property='og:type' content='website' />
29  <meta property='og:site_name' content='ImageMagick' />
30  <meta property='og:description' content="Create, Edit, Compose, or Convert Digital Images" />
31  <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
32  <link href="resize.html" rel="canonical" />
33  <link href="../../../images/wand.png" rel="icon" />
34  <link href="../../../images/wand.ico" rel="shortcut icon" />
35  <link href="../../assets/magick.css" rel="stylesheet" />
36</head>
37<body>
38  <nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
39  <div class="container-fluid">
40    <a class="navbar-brand" href="../../"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../../../images/wand.ico"/></a>
41    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#magick-navbars" aria-controls="magick-navbars" aria-expanded="false" aria-label="Toggle navigation">
42      <span class="navbar-toggler-icon"></span>
43    </button>
44
45    <div class="collapse navbar-collapse" id="magick-navbars">
46      <ul class="navbar-nav me-auto mb-2 mb-md-0">
47        <li class="nav-item">
48          <a class="nav-link " href="../../www/index.html">Home</a>
49        </li>
50        <li class="nav-item">
51          <a class="nav-link " href="../../www/download.html">Download</a>
52        </li>
53        <li class="nav-item">
54          <a class="nav-link " href="../../www/command-line-tools.html">Tools</a>
55        </li>
56        <li class="nav-item">
57          <a class="nav-link " href="../../www/command-line-processing.html">CLI</a>
58        </li>
59        <li class="nav-item">
60          <a class="nav-link " href="../../www/develop.html">Develop</a>
61        </li>
62        <li class="nav-item">
63          <a class="nav-link" target="_blank" href="https://github.com/ImageMagick/ImageMagick/discussions">Community</a>
64        </li>
65        <li class="nav-item">
66          <iframe src="https://github.com/sponsors/ImageMagick/button" title="Sponsor ImageMagick" height="35" width="107" style="border: 0;"></iframe>
67        </li>
68      </ul>
69      <form class="d-flex form-inline" action="https://imagemagick.org/script/search.php">
70        <input class="form-control me-2" type="text" name="q" placeholder="Search" aria-label="Search">
71        <button class="btn btn-outline-success" type="submit" name="sa">Search</button>
72      </form>
73    </div>
74  </div>
75  </nav>
76
77  <div class="container">
78    <script async="async" src="https://localhost/pagead/js/adsbygoogle.js"></script>
79    <ins class="adsbygoogle"
80      style="display:block"
81      data-ad-client="ca-pub-3129977114552745"
82      data-ad-slot="6345125851"
83      data-full-width-responsive="true"
84      data-ad-format="horizontal"></ins>
85    <script>
86      (adsbygoogle = window.adsbygoogle || []).push({});
87    </script>
88
89  </div>
90
91  <main class="container">
92  <div class="magick-template">
93<div class="magick-header">
94<p class="text-center"><a href="resize.html#AdaptiveResizeImage">AdaptiveResizeImage</a> &#8226; <a href="resize.html#InterpolativeResizeImage">InterpolativeResizeImage</a> &#8226; <a href="resize.html#LiquidRescaleImage">LiquidRescaleImage</a> &#8226; <a href="resize.html#MagnifyImage">MagnifyImage</a> &#8226; <a href="resize.html#MinifyImage">MinifyImage</a> &#8226; <a href="resize.html#ResampleImage">ResampleImage</a> &#8226; <a href="resize.html#ResizeImage">ResizeImage</a> &#8226; <a href="resize.html#SampleImage">SampleImage</a> &#8226; <a href="resize.html#ScaleImage">ScaleImage</a> &#8226; <a href="resize.html#ThumbnailImage">ThumbnailImage</a></p>
95
96<h2><a href="../../api/MagickCore/resize_8c.html" id="AdaptiveResizeImage">AdaptiveResizeImage</a></h2>
97
98<p>AdaptiveResizeImage() adaptively resize image with pixel resampling.</p>
99
100<p>This is shortcut function for a fast interpolative resize using mesh interpolation.  It works well for small resizes of less than +/- 50 of the original image size.  For larger resizing on images a full filtered and slower resize function should be used instead.</p>
101
102<p>The format of the AdaptiveResizeImage method is:</p>
103
104<pre class="text">
105Image *AdaptiveResizeImage(const Image *image,const size_t columns,
106  const size_t rows,ExceptionInfo *exception)
107</pre>
108
109<p>A description of each parameter follows:</p>
110
111<dd>
112</dd>
113
114<dd> </dd>
115<dl class="dl-horizontal">
116<dt>image</dt>
117<dd>the image. </dd>
118
119<dd> </dd>
120<dt>columns</dt>
121<dd>the number of columns in the resized image. </dd>
122
123<dd> </dd>
124<dt>rows</dt>
125<dd>the number of rows in the resized image. </dd>
126
127<dd> </dd>
128<dt>exception</dt>
129<dd>return any errors or warnings in this structure. </dd>
130
131<dd>  </dd>
132</dl>
133<h2><a href="../../api/MagickCore/resize_8c.html" id="InterpolativeResizeImage">InterpolativeResizeImage</a></h2>
134
135<p>InterpolativeResizeImage() resizes an image using the specified interpolation method.</p>
136
137<p>The format of the InterpolativeResizeImage method is:</p>
138
139<pre class="text">
140Image *InterpolativeResizeImage(const Image *image,const size_t columns,
141  const size_t rows,const PixelInterpolateMethod method,
142  ExceptionInfo *exception)
143</pre>
144
145<p>A description of each parameter follows:</p>
146
147<dd>
148</dd>
149
150<dd> </dd>
151<dl class="dl-horizontal">
152<dt>image</dt>
153<dd>the image. </dd>
154
155<dd> </dd>
156<dt>columns</dt>
157<dd>the number of columns in the resized image. </dd>
158
159<dd> </dd>
160<dt>rows</dt>
161<dd>the number of rows in the resized image. </dd>
162
163<dd> </dd>
164<dt>method</dt>
165<dd>the pixel interpolation method. </dd>
166
167<dd> </dd>
168<dt>exception</dt>
169<dd>return any errors or warnings in this structure. </dd>
170
171<dd>  </dd>
172</dl>
173<h2><a href="../../api/MagickCore/resize_8c.html" id="LiquidRescaleImage">LiquidRescaleImage</a></h2>
174
175<p>LiquidRescaleImage() rescales image with seam carving.</p>
176
177<p>The format of the LiquidRescaleImage method is:</p>
178
179<pre class="text">
180Image *LiquidRescaleImage(const Image *image,const size_t columns,
181  const size_t rows,const double delta_x,const double rigidity,
182  ExceptionInfo *exception)
183</pre>
184
185<p>A description of each parameter follows:</p>
186
187<dd>
188</dd>
189
190<dd> </dd>
191<dl class="dl-horizontal">
192<dt>image</dt>
193<dd>the image. </dd>
194
195<dd> </dd>
196<dt>columns</dt>
197<dd>the number of columns in the rescaled image. </dd>
198
199<dd> </dd>
200<dt>rows</dt>
201<dd>the number of rows in the rescaled image. </dd>
202
203<dd> </dd>
204<dt>delta_x</dt>
205<dd>maximum seam transversal step (0 means straight seams). </dd>
206
207<dd> </dd>
208<dt>rigidity</dt>
209<dd>introduce a bias for non-straight seams (typically 0). </dd>
210
211<dd> </dd>
212<dt>exception</dt>
213<dd>return any errors or warnings in this structure. </dd>
214
215<dd>  </dd>
216</dl>
217<h2><a href="../../api/MagickCore/resize_8c.html" id="MagnifyImage">MagnifyImage</a></h2>
218
219<p>MagnifyImage() doubles the size of the image with a pixel art scaling algorithm.</p>
220
221<p>The format of the MagnifyImage method is:</p>
222
223<pre class="text">
224Image *MagnifyImage(const Image *image,ExceptionInfo *exception)
225</pre>
226
227<p>A description of each parameter follows:</p>
228
229<dd>
230</dd>
231
232<dd> </dd>
233<dl class="dl-horizontal">
234<dt>image</dt>
235<dd>the image. </dd>
236
237<dd> </dd>
238<dt>exception</dt>
239<dd>return any errors or warnings in this structure. </dd>
240
241<dd>  </dd>
242</dl>
243<h2><a href="../../api/MagickCore/resize_8c.html" id="MinifyImage">MinifyImage</a></h2>
244
245<p>MinifyImage() is a convenience method that scales an image proportionally to half its size.</p>
246
247<p>The format of the MinifyImage method is:</p>
248
249<pre class="text">
250Image *MinifyImage(const Image *image,ExceptionInfo *exception)
251</pre>
252
253<p>A description of each parameter follows:</p>
254
255<dd>
256</dd>
257
258<dd> </dd>
259<dl class="dl-horizontal">
260<dt>image</dt>
261<dd>the image. </dd>
262
263<dd> </dd>
264<dt>exception</dt>
265<dd>return any errors or warnings in this structure. </dd>
266
267<dd>  </dd>
268</dl>
269<h2><a href="../../api/MagickCore/resize_8c.html" id="ResampleImage">ResampleImage</a></h2>
270
271<p>ResampleImage() resize image in terms of its pixel size, so that when displayed at the given resolution it will be the same size in terms of real world units as the original image at the original resolution.</p>
272
273<p>The format of the ResampleImage method is:</p>
274
275<pre class="text">
276Image *ResampleImage(Image *image,const double x_resolution,
277  const double y_resolution,const FilterType filter,
278  ExceptionInfo *exception)
279</pre>
280
281<p>A description of each parameter follows:</p>
282
283<dd>
284</dd>
285
286<dd> </dd>
287<dl class="dl-horizontal">
288<dt>image</dt>
289<dd>the image to be resized to fit the given resolution. </dd>
290
291<dd> </dd>
292<dt>x_resolution</dt>
293<dd>the new image x resolution. </dd>
294
295<dd> </dd>
296<dt>y_resolution</dt>
297<dd>the new image y resolution. </dd>
298
299<dd> </dd>
300<dt>filter</dt>
301<dd>Image filter to use. </dd>
302
303<dd> </dd>
304<dt>exception</dt>
305<dd>return any errors or warnings in this structure. </dd>
306
307<dd>  </dd>
308</dl>
309<h2><a href="../../api/MagickCore/resize_8c.html" id="ResizeImage">ResizeImage</a></h2>
310
311<p>ResizeImage() scales an image to the desired dimensions, using the given filter (see AcquireFilterInfo()).</p>
312
313<p>If an undefined filter is given the filter defaults to Mitchell for a colormapped image, a image with a matte channel, or if the image is enlarged.  Otherwise the filter defaults to a Lanczos.</p>
314
315<p>ResizeImage() was inspired by Paul Heckbert's "zoom" program.</p>
316
317<p>The format of the ResizeImage method is:</p>
318
319<pre class="text">
320Image *ResizeImage(Image *image,const size_t columns,const size_t rows,
321  const FilterType filter,ExceptionInfo *exception)
322</pre>
323
324<p>A description of each parameter follows:</p>
325
326<dd>
327</dd>
328
329<dd> </dd>
330<dl class="dl-horizontal">
331<dt>image</dt>
332<dd>the image. </dd>
333
334<dd> </dd>
335<dt>columns</dt>
336<dd>the number of columns in the scaled image. </dd>
337
338<dd> </dd>
339<dt>rows</dt>
340<dd>the number of rows in the scaled image. </dd>
341
342<dd> </dd>
343<dt>filter</dt>
344<dd>Image filter to use. </dd>
345
346<dd> </dd>
347<dt>exception</dt>
348<dd>return any errors or warnings in this structure. </dd>
349
350<dd>  </dd>
351</dl>
352<h2><a href="../../api/MagickCore/resize_8c.html" id="SampleImage">SampleImage</a></h2>
353
354<p>SampleImage() scales an image to the desired dimensions with pixel sampling.  Unlike other scaling methods, this method does not introduce any additional color into the scaled image.</p>
355
356<p>The format of the SampleImage method is:</p>
357
358<pre class="text">
359Image *SampleImage(const Image *image,const size_t columns,
360  const size_t rows,ExceptionInfo *exception)
361</pre>
362
363<p>A description of each parameter follows:</p>
364
365<dd>
366</dd>
367
368<dd> </dd>
369<dl class="dl-horizontal">
370<dt>image</dt>
371<dd>the image. </dd>
372
373<dd> </dd>
374<dt>columns</dt>
375<dd>the number of columns in the sampled image. </dd>
376
377<dd> </dd>
378<dt>rows</dt>
379<dd>the number of rows in the sampled image. </dd>
380
381<dd> </dd>
382<dt>exception</dt>
383<dd>return any errors or warnings in this structure. </dd>
384
385<dd>  </dd>
386</dl>
387<h2><a href="../../api/MagickCore/resize_8c.html" id="ScaleImage">ScaleImage</a></h2>
388
389<p>ScaleImage() changes the size of an image to the given dimensions.</p>
390
391<p>The format of the ScaleImage method is:</p>
392
393<pre class="text">
394Image *ScaleImage(const Image *image,const size_t columns,
395  const size_t rows,ExceptionInfo *exception)
396</pre>
397
398<p>A description of each parameter follows:</p>
399
400<dd>
401</dd>
402
403<dd> </dd>
404<dl class="dl-horizontal">
405<dt>image</dt>
406<dd>the image. </dd>
407
408<dd> </dd>
409<dt>columns</dt>
410<dd>the number of columns in the scaled image. </dd>
411
412<dd> </dd>
413<dt>rows</dt>
414<dd>the number of rows in the scaled image. </dd>
415
416<dd> </dd>
417<dt>exception</dt>
418<dd>return any errors or warnings in this structure. </dd>
419
420<dd>  </dd>
421</dl>
422<h2><a href="../../api/MagickCore/resize_8c.html" id="ThumbnailImage">ThumbnailImage</a></h2>
423
424<p>ThumbnailImage() changes the size of an image to the given dimensions and removes any associated profiles.  The goal is to produce small low cost thumbnail images suited for display on the Web.</p>
425
426<p>The format of the ThumbnailImage method is:</p>
427
428<pre class="text">
429Image *ThumbnailImage(const Image *image,const size_t columns,
430  const size_t rows,ExceptionInfo *exception)
431</pre>
432
433<p>A description of each parameter follows:</p>
434
435<dd>
436</dd>
437
438<dd> </dd>
439<dl class="dl-horizontal">
440<dt>image</dt>
441<dd>the image. </dd>
442
443<dd> </dd>
444<dt>columns</dt>
445<dd>the number of columns in the scaled image. </dd>
446
447<dd> </dd>
448<dt>rows</dt>
449<dd>the number of rows in the scaled image. </dd>
450
451<dd> </dd>
452<dt>exception</dt>
453<dd>return any errors or warnings in this structure. </dd>
454
455<dd>  </dd>
456</dl>
457</div>
458  </div>
459  </main><!-- /.container -->
460  <footer class="magick-footer">
461    <div class="container-fluid">
462      <a href="../../www/security-policy.html">Security</a> •
463      <a href="../../www/news.html">News</a>
464
465      <a href="resize.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../../../images/wand.ico"/></a>
466
467      <a href="../../www/links.html">Related</a> •
468      <a href="../../www/sitemap.html">Sitemap</a>
469   <br/>
470     <a href="../../www/support.html">Sponsor</a> •
471     <a href="../../www/cite.html">Cite</a> •
472     <a href="http://pgp.mit.edu/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a> •
473     <a href="../../www/contact.html">Contact Us</a>
474   <br/>
475     <a href="https://github.com/imagemagick/imagemagick" target="_blank" rel="noopener" aria-label="GitHub"><svg xmlns="http://www.w3.org/2000/svg" class="navbar-nav-svg" viewBox="0 0 512 499.36" width="2%" height="2%" role="img" focusable="false"><title>GitHub</title><path fill="currentColor" fill-rule="evenodd" d="M256 0C114.64 0 0 114.61 0 256c0 113.09 73.34 209 175.08 242.9 12.8 2.35 17.47-5.56 17.47-12.34 0-6.08-.22-22.18-.35-43.54-71.2 15.49-86.2-34.34-86.2-34.34-11.64-29.57-28.42-37.45-28.42-37.45-23.27-15.84 1.73-15.55 1.73-15.55 25.69 1.81 39.21 26.38 39.21 26.38 22.84 39.12 59.92 27.82 74.5 21.27 2.33-16.54 8.94-27.82 16.25-34.22-56.84-6.43-116.6-28.43-116.6-126.49 0-27.95 10-50.8 26.35-68.69-2.63-6.48-11.42-32.5 2.51-67.75 0 0 21.49-6.88 70.4 26.24a242.65 242.65 0 0 1 128.18 0c48.87-33.13 70.33-26.24 70.33-26.24 14 35.25 5.18 61.27 2.55 67.75 16.41 17.9 26.31 40.75 26.31 68.69 0 98.35-59.85 120-116.88 126.32 9.19 7.9 17.38 23.53 17.38 47.41 0 34.22-.31 61.83-.31 70.23 0 6.85 4.61 14.81 17.6 12.31C438.72 464.97 512 369.08 512 256.02 512 114.62 397.37 0 256 0z"/></svg></a> •
476     <a href="https://twitter.com/imagemagick" target="_blank" rel="noopener" aria-label="Twitter"><svg xmlns="http://www.w3.org/2000/svg" class="navbar-nav-svg" viewBox="0 0 512 416.32" width="2%" height="2%" role="img" focusable="false"><title>Twitter</title><path fill="currentColor" d="M160.83 416.32c193.2 0 298.92-160.22 298.92-298.92 0-4.51 0-9-.2-13.52A214 214 0 0 0 512 49.38a212.93 212.93 0 0 1-60.44 16.6 105.7 105.7 0 0 0 46.3-58.19 209 209 0 0 1-66.79 25.37 105.09 105.09 0 0 0-181.73 71.91 116.12 116.12 0 0 0 2.66 24c-87.28-4.3-164.73-46.3-216.56-109.82A105.48 105.48 0 0 0 68 159.6a106.27 106.27 0 0 1-47.53-13.11v1.43a105.28 105.28 0 0 0 84.21 103.06 105.67 105.67 0 0 1-47.33 1.84 105.06 105.06 0 0 0 98.14 72.94A210.72 210.72 0 0 1 25 370.84a202.17 202.17 0 0 1-25-1.43 298.85 298.85 0 0 0 160.83 46.92"/></svg></a>
477    <br/>
478    <small>© 1999-2021 ImageMagick Studio LLC</small>
479    </div>
480  </footer>
481
482  <!-- Javascript assets -->
483  <script src="../../assets/magick.js" ></script>
484  </body>
485</html>
486