# Resampling Image in ITK.

**URL:** <https://discourse.itk.org/t/resampling-image-in-itk/369>\
**Category:** Uncategorized\
**Tags:** discourse\
**Created:** [October 30, 2017, 6:23pm UTC](https://discourse.itk.org/t/resampling-image-in-itk/369 "2017-10-30T18:23:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![srbn.ghosh89](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/3ec8ea/32.png) [@srbn.ghosh89](https://discourse.itk.org/u/srbn.ghosh89)\
**Post date:** [October 30, 2017, 6:23pm UTC](https://discourse.itk.org/t/resampling-image-in-itk/369/1 "2017-10-30T18:23:14Z")

</div>

I am trying to do a resampling on my PNG image series. I am using this ITK code…  
[https://itk.org/Wiki/ITK/Examples/ImageProcessing/Upsampling](https://itk.org/Wiki/ITK/Examples/ImageProcessing/Upsampling)

My original Image size is 512 x 546. X-range is -512 to -1 (delta 511 )and Y range is -546 to -1 (delta 545 )  
I am giving 240 X 240 as new image dimension. Using this dimensions it calculates the spacing is 2.00 .  
But after resampling I can see that though the dimension is changed in 240 x 240 but the X-range is -180 to -329(delta 509 ) and Y range is -180 to -363 (delta 543 ). I mean the total image is still as bigger as the original one. Could you please help me out how to fix this problem I mean how to change the X range and Y range like -180 to 60 and -180 to 60.

Thanks in adcance

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [October 30, 2017, 6:40pm UTC](https://discourse.itk.org/t/resampling-image-in-itk/369/2 "2017-10-30T18:40:25Z")

</div>

What you might try is manually setting the spacing to 1.0 in the example you mentioned. A more general approach is to transform you image by a matrix which does scaling by 0.5 in both dimensions, based on this [example](https://itk.org/ITKExamples/src/Core/Transform/ApplyAffineTransformFromHomogeneousMatrixAndResample/Documentation.html).
