Convert string to image matrix (like xyouts) [message #94391] |
Mon, 08 May 2017 11:31  |
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 #94394 is a reply to message #94392] |
Tue, 09 May 2017 02:41   |
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  |
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.
|
|
|