View Full Version : Insert gif logo into plot

10-27-2008, 05:02 AM
Is there any way I can insert the company logo (gif format) into the upper right hand corner of a plot? thanks in advance...

10-27-2008, 09:09 AM
Hi SpinMan,

Yes, you can do that...with the understanding that you're dealing with a couple of different concepts and details of the end result will help with providing you the best response.

A plot (PLOT, PLOTS, SURFACE, CONTOUR, etc.) does a lot of moves and draws, while the placement of a GIF is an image operation. While it's easy to combine the two you have to be careful that the image doesn't get laid on top of a key plot element.

And then you have to decide what to do with the combined entities. If a window on the screen is the end result, then you're done. If however you want these combined entities (plot + image) to get printed, or saved to a file for inclusion into a report, there are additional steps needed. Another option if you're using the PV-WAVE Home Window is a simple copy to the Clipboard of the entire graphics window content....

Bottom line is PV-WAVE can do this rather easily, and we're happy to provide examples if you let us know your final result expectations.

Cheers, Don B.

10-27-2008, 11:47 AM
Thanks for the quick reply. I managed to kluge up some code whereby I IMAGE_READ the file, extract the pixels, CONGRID them and TVSCL to the upper right corner. It's not pretty, but it works. I have to remember that all subsequent plot operations need NOERASE. I then figured out that I could add the logo after the plot, but it means running another PRO which I really don't want to do. I like the suggestion about copying the Home Window, but we're still in VMS-land and I need to do an IMAGE_GRAB and IMAGE_WRITE, which do programmatically anyway. Is there a cleaner way to do this?

10-27-2008, 12:18 PM
Hi Keith,

You have things figured out it seems, and aside from creating a few utility procedures, there isn't much else to offer WRT 'a cleaner way'.

My reference to 'utility' routines would be things you write to get this process down to a few simple commands. Something like:

get_logo, fname (reads the image file and resizes the image)
put_logo, xloc, yloc (does the IMAGE_DISPLAY/TV/TVSCL)
write_screen (does the IMAGE_GRAB and IMAGE_WRITE)

I started a simple file that adjusts the !P.Region to avoid overwriting any of the plotting, and certainly this could be used for some of the basis to complete the pseudo code concept above.

PRO plot_and_image
; get the company logo
fname = GETENV('VNI_DIR') + '\wave\data\vni_small_bw_inv.tif'
img = IMAGE_READ(fname)
logo = img('pixels')
; find the height and adjust the plotting area to make
; room for the image
winxsize = 640 & winysize = 512
logoxsize = img('width') & logoysize = img('height')
regypercent = 1.0 - ((FLOAT(winysize) / FLOAT(logoysize)) / FLOAT(winysize))
!P.Region = [0.0, 0.0, 1.0, regypercent-.03]
WINDOW, Xsize=winxsize, Ysize=winysize
TVSCL, logo, winxsize-logoxsize, winysize-logoysize
; reset the region
!P.Region = 0

Let us know if you have any other questions.

Oh.....and I loved your mention of VMS-land; long live OpenVMS!

Cheers, Don B.

10-29-2008, 03:48 AM
Thanks for the code. You've reminded me with the width and height entries that structures usually contain vital information that I don't have to work hard to get. All I have to do is look.