Scripting Resources for DigitalMicrograph™

banner

Dave Mitchell's DigitalMicrograph™ Scripting Website

Home | Scripts | Examples | Functions | Recent Updates | Tutorials | Resources | Publications | Consulting | Projects | Contact & Bio |PyJEM| Search

 

Function: Resize Image by Non-integer Factors.
Function
A function which will resize the x and y axes of a passed-in image by any non-integer factor.
Version
version:20181005, v1.0
Author
D. R. G. Mitchell
Acknowledgements
-
Comments
The scaling factor for each axis can be any non-integer value greater than zero. To rescale both axes by the same value - enter the requested x axis scaling factor as a negative value. You can use this script to resize an image to fit any particular target size. Using scaling factors between 0 and 1 will increase the size of the image. Obviously if the aspect ratio used for scaling differs to that of the original then geometric distortion will occur.
System Requirements
Tested on GMS 2.x but should be compatible with all versions of GMS.
Known Issues
This script uses the warp function which carries out bilinear interpolation. This resamples the image at discrete (interpolated) points. This is not the same as rebinning. The latter sums groups of pixels and then resamples them at integer spacings. Binning improves the signal to noise ratio. In contrast, the method used here will typically increase the signal to noise.
Supported
Yes
Included Files
Main script file.
Source Code
See the attached script