comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » how do I create an image file from an object graphics window?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: how do I create an image file from an object graphics window? [message #40212 is a reply to message #40101] Tue, 27 July 2004 10:17 Go to previous messageGo to previous message
stef is currently offline  stef
Messages: 6
Registered: April 2004
Junior Member
Hello Holger
The following code snippets might help you. The input argument is the
object graphic window object. Depending on the chosen file ending it
creates a JPEG, PNG or TIFF image from the object window. If you want
higher quality (e.g. for printing, change the dimensions arguments to
a higher value)

Also, below are the procedure I use to copy the image to the
clipboard, one is
for BMP, the other for Vector output. (Can be easily copied into MS
Word or Powerpoint)

Hope this helps,
Stefan

PRO CV_Save_Image, window_o
filters = [['*.jpg', '*.png', '*.tif'], $
['JPG', 'PNG (lossless)', 'TIF']]
filename = DIALOG_PICKFILE(/WRITE, FILTER = filters,
/OVERWRITE_PROMPT, DEFAULT_EXTENSION='JPG')
print, filename
IF (filename) THEN BEGIN
image_o=OBJ_NEW('IDLgrImage')
image_o=window_o->Read()
image_o->GetProperty, DATA=image_data
extension=STRLOWCASE(STRMID(filename,STRLEN(filename)-4,4))
CASE extension OF
'.jpg': WRITE_JPEG, filename, image_data, TRUE=1
'.png': WRITE_PNG, filename, image_data
'.tif': WRITE_TIFF, filename, Reverse(image_data,3)
ELSE: ;do nothing
ENDCASE
Obj_Destroy, image_o
ENDIF
END

PRO CV_CopyClipboardBMP, window_o
window_o->GetProperty, GRAPHICS_TREE=view_o
window_o->GetProperty, DIMENSIONS=dimensions

clipboard_o= OBJ_NEW('IDLgrClipboard', QUALITY = 2,
DIMENSIONS=dimensions)
clipboard_o->Draw, view_o
Obj_Destroy, clipboard_o
END

PRO CV_CopyClipboardVector, window_o
window_o->GetProperty, GRAPHICS_TREE=view_o
window_o->GetProperty, DIMENSIONS=dimensions

clipboard_o= OBJ_NEW('IDLgrClipboard', QUALITY = 2,
DIMENSIONS=dimensions)
clipboard_o->Draw, view_o, /VECTOR
Obj_Destroy, clipboard_o
END



holgi0251@lycos.de (Holger B.) wrote in message news:<2c8cff70.0407222221.1f90f37d@posting.google.com>...
> Hi,
>
> I want to save the RGB-image displayed in an object graphics window
> (IDLgrWindow) in a TIFF or JPEG file. When I use TVRD to copy the
> image from the window, the resulting image is empty. My impression is,
> that TVRD does not work with object graphics.
> My question: how do I create an image file from an object graphics
> window?
>
> Thanks,
> Holger
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Translate characters/string size to data/normal coordinates?
Next Topic: IDL program

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:07:51 PDT 2025

Total time taken to generate the page: 0.00388 seconds