Hi,
How do I write a script to open 4 jpegs in JMP and then place them in a 2x2 window? I would like to specify the size of the window to be a certain size. Then I would like to save the window into a jpeg.
Any help is appriciated! Thanks!
Here is a simple example of one way to handle the question
Names Default To Here( 1 ); image1 = New Image( "$SAMPLE_IMAGES/windmap.png" ); image2 = New Image( "$SAMPLE_IMAGES/black rhino footprint.jpg" ); image3 = New Image( "$SAMPLE_IMAGES/tile.jpg" ); image4 = New Image( "$SAMPLE_IMAGES/pi.gif" ); nw = New Window( "Pictures", Outline Box( "The Pictures", Lineup Box( N Col( 2 ), image1, image2, image3, image4 ) ) ); theWholePicture = nw[Outline Box( 1 )] << get picture; theWholePicture << save image( "$TEMP/myPicture.jpg,", "jpg" ); nw << close window; theSavedImage = New Image( "$TEMP/myPicture.jpg," ); theNW = New Window( "Final Picture", theSavedImage );
You can set the images sizes by using
img << Set Size( {600, 600} );
See the Scripting Index for the messages that can be used with New Image
I would go with the Lineup box like Jim did show as I think it is the simplest option. One other option (more complicated) is to use Graph Box and add images to it
Names Default To Here(1); image1 = New Image("$SAMPLE_IMAGES/windmap.png"); image2 = New Image("$SAMPLE_IMAGES/black rhino footprint.jpg"); image3 = New Image("$SAMPLE_IMAGES/tile.jpg"); image4 = New Image("$SAMPLE_IMAGES/pi.gif"); nw = New Window("View Image", gb = Graph Box( FrameSize(500, 500), X Scale(0, 100), Y Scale(0, 100), SuppressAxes(1) ) ); fb = nw[FrameBox(1)]; fb << Add Image(image(image1), bounds(top(0), Left(0), bottom(50), Right(50))); fb << Add Image(image(image2), bounds(top(0), Left(50), bottom(50), Right(100))); fb << Add Image(image(image3), bounds(top(100), Left(0), bottom(50), Right(50))); fb << Add Image(image(image4), bounds(top(100), Left(50), bottom(50), Right(100))); img = fb << get picture; img << save image("$TEMP/pic.png", "png"); nw << close window;
At least one more technique can be found from this post Merging/stitching images