cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
CitizenNo3
Level II

Copying full-size image from file to clipboard

Hello, 

 

As part of a report-making tool I'm pulling a series of images from a zip file into a grid for easy viewing. I have that working as intended, but I'd also like the ability to click on an image to view it at full-size and copy the full-size image to the clipboard (to paste into PPT, etc). I've found this other thread where someone had a similar issue and I've repurposed that script. However, I've noticed some undesirable behavior with the copy picture message. Even though the image properties in the image box say it is 451x451 px just like the original file, copying that image to the clipboard (via JSL or by right-click) results in a smaller image than if I copy the file location directly, and JMP also has added an uneven white boarder.

 

Is there any workaround to prevent the white boarder when copying from JMP? Or better yet, a way to directly read the file path and copy the full image to the clipboard? My experimentation and searching yielded no results. JMP may not be the ideal tool for this, but I'm already processing all the numerical data with JMP so it makes sense to use same script to open up the images. 

 

Thank you!

 

Image of PPT slide with two copied images ("tile" sample image) on a gray background. Left is from JMP, right is from the .jpg directly

copied image comparison.png

 

Sample code for testing

Names Default To Here( 1 );

New Window( "Test",
	//create mouse box to make image clickable
	mb = MouseBox(
		
		//load in image and shrink for easy viewing
		pb1 = Picture Box( Open( "$SAMPLE_IMAGES/tile.jpg", jpg ) ),
		pb1 << set height( 100 ),
		pb1 << set width( 100 ), 

		//on click behavior 
		<<setTrackEnable( 1 ),
		<<setTrack(
			Function( {this, clickpt},
				this << setCursor( "Finger" ) /* button-up tracking - use the hand */
			)
		),
		<<Set Click Enable( 1 ),
		<<Set Click(
			Function( {this, clickpt, event}, /*Is Alt Key(),Is Control Key(),Is Shift Key() should be captured on "Pressed" */
				{DEFAULT LOCAL},
				If( event == "Released" | event == "Canceled",
					this << setCursor( "Hand" ) /* switch back to hand immediately */
				,
					this << setCursor( "Finger" ) /* change cursor during drawing */
				);
				If( event == "Pressed",
					New Window( "Enhance!", 
						//open now window with full-size image
						pb2 = Picture Box( Open( "$SAMPLE_IMAGES/tile.jpg", jpg ) ),
						//copy image to clipboard
						pb2 << copy picture, 
						
					)
				);
			)
		)
	), 
);

 

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: Copying full-size image from file to clipboard

@CitizenNo3 - also see Merging/stitching images  for some related discussion

Craige

View solution in original post

3 REPLIES 3

Re: Copying full-size image from file to clipboard

If you don't want JMP's default white background color in your graph, go to the Preferences, select the Reports group on the left, and check the Transparent background option.
For size of grapgh, you can change seize by picture box, then copy clipboard.

Names Default To Here( 1 );

New Window( "Test",
	//create mouse box to make image clickable
	mb = MouseBox(
		
		//load in image and shrink for easy viewing
		pb1 = Picture Box( Open( "$SAMPLE_IMAGES/tile.jpg", jpg ) ),
		pb1 << set height( 100 ),
		pb1 << set width( 100 ), 

		//on click behavior 
		<<setTrackEnable( 1 ),
		<<setTrack(
			Function( {this, clickpt},
				this << setCursor( "Finger" ) /* button-up tracking - use the hand */
			)
		),
		<<Set Click Enable( 1 ),
		<<Set Click(
			Function( {this, clickpt, event}, /*Is Alt Key(),Is Control Key(),Is Shift Key() should be captured on "Pressed" */
				{DEFAULT LOCAL},
				If( event == "Released" | event == "Canceled",
					this << setCursor( "Hand" ) /* switch back to hand immediately */
				,
					this << setCursor( "Finger" ) /* change cursor during drawing */
				);
				If( event == "Pressed",
					New Window( "Enhance!", 
						//open now window with full-size image
						pb2 = Picture Box( Open( "$SAMPLE_IMAGES/tile.jpg", jpg ); ),
						//copy image to clipboard
						pb2 << Set Width( 750 );
						pb2 << Set Height( 750 );
						pb2 << copy picture, 
						
					)
				);
			)

 

 

Craige_Hales
Super User

Re: Copying full-size image from file to clipboard

@CitizenNo3 - also see Merging/stitching images  for some related discussion

Craige
CitizenNo3
Level II

Re: Copying full-size image from file to clipboard

Thanks Craige and yuichi_katsumur! I think that those threads linked by Craige do answer my question.

 

Conclusion: JMP's behavior when displaying or copying an image adds a small border and there isn't any real way around that, although it is possible to make that border area transparent by changing the background color in JMP's settings (this will also impact all background colors which might not be desired).

 

Workarounds:

  • Use Python to work with the images (I don't want users to need to install Python so this isn't a great option)
  • Save image to a drive location and let users view/copy from there (maybe will do this)
  • Display the filepath of image in selectable text so user can navigate to it if they need the full image (my current quick workaround)