Code covered by the BSD License  

Highlights from
IMCLIPBOARD

5.0

5.0 | 5 ratings Rate this file 18 Downloads (last 30 days) File Size: 4.74 KB File ID: #28708

IMCLIPBOARD

by Jiro Doke

 

13 Sep 2010 (Updated 27 Sep 2010)

Copy and paste image data to and from system clipboard.

| Watch this File

File Information
Description

IMCLIPBOARD behaves very much like MATLAB's "CLIPBOARD" function, but it works on image data. You can paste image data from the clipboard to a MATLAB array, and copy MATLAB image data to the clipboard.

From HELP:

IMCLIPBOARD('copy', IMDATA) sets the clipboard content to the image represented by IMDATA. IMDATA must be MxN grayscale (double, uint8, uint16), MxN black and white (logical), MxNx3 true color (double, uint8, uint16)

IMCLIPBOARD('copy', X, MAP) sets the clipboard content to the image data represented by indexed image X with colormap MAP. X must be MxN matrix (double, uint8, uint16) and MAP must be Px3 (double).

IMDATA = IMCLIPBOARD('paste') returns the current image content in the clipboard as a true color image (MxNx3 uint8).

[X, MAP] = IMCLIPBOARD('paste') returns the current image content in the clipboard as an indexed color image.

IMCLIPBOARD('paste') displays the image in a new figure window.

[...] = IMCLIPBOARD('paste', FILENAME) saves the image as FILENAME. FILENAME must be a name to one of the following image formats: JPG, GIF, BMP, PNG, TIF.

Note: IMCLIPBOARD requires Java on all platforms.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
clipboardimage, clipboardpaste

MATLAB release MATLAB 7.11 (2010b)
Other requirements Requires Java
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
30 Sep 2010 Eric

It does what it says. However, when I call it from within a GUI, the next callback that is activated (by changing a number in a text box or clicking a button), does not execute. As an example, I get the following warning for my GUI called ProductViewer. I can generate a similar error by activating any control in the GUI.

Warning: Error occurred while evaluating listener callback.
> In graphics\private\clo at 83
  In cla at 29
  In newplot>ObserveAxesNextPlot at 125
  In newplot at 74
  In imagesc at 21
  In ProductViewer>PlotFrame at 629
  In ProductViewer>edit_row_min_Callback at 514
  In gui_mainfcn at 96
  In ProductViewer at 87
  In @(hObject,eventdata)ProductViewer('edit_row_min_Callback',hObject,eventdata,guidata(hObject))

30 Sep 2010 Eric  
30 Sep 2010 Eric

Whoops - the problem was with how I was calling it. It works great from within a GUI as well. I'm using it to copy an image of my GUI to the clipboard. This function gives a nicer image than print(gcbf, '-dmeta').

28 Nov 2011 K E

Matlab's default Figure > Copy option is vastly improved witht he following,
imclipboard('copy', export_fig('r', 190, 'format', 'png'));
This is useful for copying a figure into Outlook or Word.
[credit for this solution to by Oliver Woodford not me! http://mathworks.com/matlabcentral/answers/21962-export-figure-to-microsoft-outlook]

29 Nov 2011 owr  
20 Mar 2012 Will  
Please login to add a comment or rating.
Updates
15 Sep 2010

Updated copyright in Java code.

27 Sep 2010

License update

Tag Activity for this File
Tag Applied By Date/Time
clipboard Jiro Doke 15 Sep 2010 13:23:58
paste Jiro Doke 15 Sep 2010 13:23:59
copy Jiro Doke 15 Sep 2010 13:23:59
image Jiro Doke 15 Sep 2010 13:23:59

Contact us at files@mathworks.com