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: Scale and Maximise Image
Function
Scales the image displayed size to a particular value, then maximises the image within that display.
Version
version:20091018, v1.0
Author
D. R. G. Mitchell
Acknowledgements
-
Comments
Performs a similar function to the image maximise button (centre of three buttons in the top right corner of each image). This is useful within scripts where you wish to change the image size, and ensure it is correclty displayed.
System Requirements
Should be compatible with all recent versions of DigitalMicrograph.
Known Issues
-
Supported
Yes
Included Files
Main script file.
Source Code

// a function which will take the passed in image , resize it proportionally on the defaultysize value

// passed in, and maximise the image within the window

// version:20091018, v1.0

// D. R. G. Mitchell, October 2009

// adminnospam@dmscripting.com (remove the nospam to make this email address work)

 

void setimageview(image imgtoset, number defaultsize)

{

number imgxsize, imgysize, scaledx

showimage(imgtoset)

getsize(imgtoset, imgxsize, imgysize)

 

scaledx=imgxsize*(defaultsize/imgysize)

setwindowsize(imgtoset, scaledx, defaultsize)

 

imagedocument imgdoc=getfrontimagedocument()

imagedocumentmaximizerectinview(imgdoc, 0,0,defaultsize, scaledx)

setzoom(imgtoset,defaultsize/imgysize)

updateimage(imgtoset)

}

 

 

image front:=getfrontimage()

setimageview(front, 400)