Ric,

In jwd, after I also required files, your solution worked nicely,
although I have not checked the loss of image fidelity that I will get
with my real snapshots, yet.

But in jconsole I could not make it work. The first sign of a
difference between jwd and jconsole was that the fcopynew produced the
result 1 9195 with jconsole, not 0 9195 as in jwd. Is that important,
or should I be executing the script differently in jconsole?

Thanks for suggesting this compact solution.

On Wed, Jun 2, 2010 at 9:11 PM, Sherlock, Ric <[email protected]> wrote:
>
> Here is the sketch of a gl2 solution. It is probably possible to do this 
> using entirely using the media/platimg addon, in which case you could do it 
> from jconsole too, not just jwd.
>
> However because the solution resaves the image, the downside is that you will 
> be losing some image fidelity if you use the jpg format.
>
> NB.=========================================
> require 'gl2 media/platimg'
>
> addCaption=: 4 : 0
>  caption=. x
>  imgpath=. y
>  img=. readimg imgpath
>  imgsize=. $img
>  wd 'pc capimg;'
>  wd 'xywh 0 0 ', ": >.-: imgsize
>  wd 'cc g isigraph rightmove bottommove;pas 0 0;'
>  glpixels_jgl2_ 0 0 , imgsize , ,img
>  gltextcolor_jgl2_ glrgb_jgl2_ 255 0 0
>  gltextxy_jgl2_ 0 0
>  glfont_jgl2_ 'Arial 24 bold'
>  gltext_jgl2_ caption
>  newimg=. imgsize$ glqpixels_jgl2_ 0 0, imgsize
>  wd 'pclose'
>  r=. newimg writeimg jpath '~temp/testcaption.jpg'
> )
>
> Note 'test'
> require 'viewmat'
> (jpath '~temp/testcaption.jpg') fcopynew jpath '~help/box.jpg'
> viewrgb readimg jpath '~temp/testcaption.jpg'
> 'Hello World' addCaption jpath '~temp/testcaption.jpg'
> viewrgb readimg jpath '~temp/testcaption.jpg'
> )
> NB. ===============================================
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
(B=) <-----my sig
Brian Schott
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to