cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
ih
Super User (Alumni) ih
Super User (Alumni)

Send Image to Clipboard

How can I save an image to the clipboard such that it can be pasted into other programs, similar to Copy Graph in Graph Builder?

 

This saves the image as text:

img = Open("$Sample_Images/black rhino footprint.jpg", jpg);
Set Clipboard( img );

 

But I cannot paste this into an email, etc.

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Re: Send Image to Clipboard

This code is simpler; no new window required.

Names default to here( 1 );

//Get an image from "New image()", "<< Get Picture", etc:
img = New image("$Sample_Images/black rhino footprint.jpg");
pb = Picture Box( img );
pb << Copy Picture;

View solution in original post

3 REPLIES 3
Byron_JMP
Staff

Re: Send Image to Clipboard

It might be more straightforward to just save the graphic you want and then pick it back up with the other program

//run this again Abrasion.jmp from the sample data

obj=Distribution(
	Continuous Distribution(
		Column( :Abrasion ),
		PpK Capability Labeling( 1 ),
		Customize Summary Statistics( N Missing( 1 ), N Unique( 1 ) )
	)
);
r = obj << Report;
//three ways to get a picture
bb2 = r[border box (2)] <<Get Picture;
bb2 = r[border box (2)] <<Save Capture( "/Users/bywing/Downloads/eraseme.png",png);
bb2 = r[border box (2)] <<Save Picture( "/Users/bywing/Downloads/eraseme.png",png);

I'm interested in trying to get this idea of pasting an graphic to the clipboard and picking it up with something else.

 

I've used this expression to copy a data table to the clipboard:

main menu("Copy With Column Names")

I tried this approach to get the image, but it doesn't seem to work.

bb2 = r[border box (2)] << select;
current window()<<main menu ("Copy");

When I past this, I just get the evaluated expression, not the image.

 

 

JMP Systems Engineer, Health and Life Sciences (Pharma)
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Send Image to Clipboard

Your Get Picture and Save Picture messages reminded me of Copy Picture, which does work for a picture box.  Leveraging a picture box and copy picture gives the function below.  There must be a more straightforward way though...

Names default to here( 1 );

PicToClipboard = Function( {img},
	win = New Window("temp",
		pb = Picture Box( img )
	);

	pb << Copy Picture;

	win << Close Window();	
);


//Get an image from "New image()", "<< Get Picture", etc: img = New image("$Sample_Images/black rhino footprint.jpg");
//Save it to the clipboard PicToClipboard( img );
pmroz
Super User

Re: Send Image to Clipboard

This code is simpler; no new window required.

Names default to here( 1 );

//Get an image from "New image()", "<< Get Picture", etc:
img = New image("$Sample_Images/black rhino footprint.jpg");
pb = Picture Box( img );
pb << Copy Picture;