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

Home » Public Forums » archive » Convert string to image matrix (like xyouts)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Convert string to image matrix (like xyouts) [message #94391] Mon, 08 May 2017 11:31 Go to next message
heinz1357 is currently offline  heinz1357
Messages: 2
Registered: May 2017
Junior Member
Is there a method to generate an image from a string, i.e. a binary image that contains the string as printed text?

I'm currently generating a movie from several image frames (using IDLffVideoWrite), and would like to put additional information into the frames as text (such as dates).
Re: Convert string to image matrix (like xyouts) [message #94392 is a reply to message #94391] Mon, 08 May 2017 12:42 Go to previous messageGo to next message
Lajos Foldy is currently offline  Lajos Foldy
Messages: 176
Registered: December 2011
Senior Member
On Monday, May 8, 2017 at 8:31:20 PM UTC+2, hein...@googlemail.com wrote:
> Is there a method to generate an image from a string, i.e. a binary image that contains the string as printed text?
>
> I'm currently generating a movie from several image frames (using IDLffVideoWrite), and would like to put additional information into the frames as text (such as dates).

You can use xyouts with the Z device and read back the image with tvrd().

regards,
Lajos
Re: Convert string to image matrix (like xyouts) [message #94394 is a reply to message #94392] Tue, 09 May 2017 02:41 Go to previous messageGo to next message
heinz1357 is currently offline  heinz1357
Messages: 2
Registered: May 2017
Junior Member
Am Montag, 8. Mai 2017 21:42:51 UTC+2 schrieb fawltyl...@gmail.com:
> On Monday, May 8, 2017 at 8:31:20 PM UTC+2, hein...@googlemail.com wrote:
>> Is there a method to generate an image from a string, i.e. a binary image that contains the string as printed text?
>>
>> I'm currently generating a movie from several image frames (using IDLffVideoWrite), and would like to put additional information into the frames as text (such as dates).
>
> You can use xyouts with the Z device and read back the image with tvrd().
>
> regards,
> Lajos

Ok, thanks.

In case anyone wants to know, this is the solution:

result_arr = MAKE_ARRAY(image_size[0], image_size[1], /BYTE, VALUE=0)
old_device = !D.Name
SET_PLOT, 'Z', /COPY
DEVICE, SET_RESOLUTION=image_size
ERASE
TV, result_arr
xyouts, location[0], location[1], input_text, CHARSIZE=font_size, CHARTHICK=fontsize/2
result_arr=TVRD()
SET_PLOT, old_device, /COPY
return, result_arr
Re: Convert string to image matrix (like xyouts) [message #94399 is a reply to message #94394] Tue, 09 May 2017 04:52 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le mardi 9 mai 2017 11:41:12 UTC+2, hein...@googlemail.com a écrit :
> Am Montag, 8. Mai 2017 21:42:51 UTC+2 schrieb fawltyl...@gmail.com:
>> On Monday, May 8, 2017 at 8:31:20 PM UTC+2, hein...@googlemail.com wrote:
>>> Is there a method to generate an image from a string, i.e. a binary image that contains the string as printed text?
>>>
>>> I'm currently generating a movie from several image frames (using IDLffVideoWrite), and would like to put additional information into the frames as text (such as dates).
>>
>> You can use xyouts with the Z device and read back the image with tvrd().
>>
>> regards,
>> Lajos
>
> Ok, thanks.
>
> In case anyone wants to know, this is the solution:
>
> result_arr = MAKE_ARRAY(image_size[0], image_size[1], /BYTE, VALUE=0)
> old_device = !D.Name
> SET_PLOT, 'Z', /COPY
> DEVICE, SET_RESOLUTION=image_size
> ERASE
> TV, result_arr
> xyouts, location[0], location[1], input_text, CHARSIZE=font_size, CHARTHICK=fontsize/2
> result_arr=TVRD()
> SET_PLOT, old_device, /COPY
> return, result_arr

With Graphics functions, you could simply do:

> im = IMAGE(bytarr(image_size))
> t = TEXT(TARGET=im, ...)
> im.GETDATA, result_arr

alx.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: overplotting contours on tvimage....
Next Topic: defroi

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

Current Time: Wed Oct 08 11:37:39 PDT 2025

Total time taken to generate the page: 0.00520 seconds