Is it possible to add text to a cell that has already loaded images?
Thanks!
Add Text to a Picture
Use a graphics frame box to add text and lines on top of a picture.
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" ); For( iRow = 1, iRow <= N Rows( dt ), irow += 1, // open the original original = dt:picture[iRow]; {xSize, ySize} = original << size; // use a frame to do the drawing, make the original fit the frame exactly gb = Graph Box( <<backgroundcolor( "orange" ), // to see errors better FrameSize( xSize + 1, ySize + 1 ), // the +1 is required, 4 times X Scale( 0, xSize + 1 ), Y Scale( 0, ySize + 1 ), // apparently x and y are different. this is correct in 17EA. <<Add Image( image( original ), bounds( top( 0 ), Left( 1 ), bottom( ySize ), Right( xSize + 1 ) ) ), // draw something on top of the image Text( Center Justified, {xSize / 2, 10}, dt:name[irow] ); ); // capture an updated image updated = gb[framebox( 1 )] << getpicture; // crop added border. "updated" is the final image. updated << crop( Left( 1 ), top( 1 ), Right( xSize + 1 ), bottom( ySize + 1 ) ); dt:picture[irow]=updated; );
Mug shots
You could use set each value to re-create the image with text
Names Default To Here(1); dt = Open("$SAMPLE_DATA/Big Class Families.jmp"); Column(dt, "picture") << Set Each Value( H List Box(align("center"), Text box(:name), :picture ) << Get Picture );
If I want to add more than one cell of text, I try to add it left and right.
Can I add text below?It looks like this down here.
Column(dt, "picture") << Set Each Value( H List Box(align("center"), Text box(:name), :picture ) << Get Picture ); Column(dt, "picture") << Set Each Value( H List Box(align("center"), Text box(:sports), :picture ) << Get Picture );
Thanks Experts!
Using proper display functions (h list box, v list box, lineup box...) and display boxes should help you to organize the elements
JSL can add text to a screenshot and then place it on the image.
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" ); rp = New Window( "", dt << Get As Report ); rp << Set Cell Height( 250 ); pic = rp << Get Picture;
Thank Craige!
I copied the following JSL, just to achieve the simplest function.But I still don't know the code.Text is not added where it should be.Consult experts to help modify, with the simplest code implementation.
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" ); dt << delete columns( 3 :: N Col( dt ) ); dt << delete rows( 6 :: N Row( dt ) ); dt << Set Cell Height( 100 ); rp = New Window( "", dt << Get As Report ); original = rp << Get Picture; {xSize, ySize} = original << size; gb = Graph Box( <<backgroundcolor( "orange" ), FrameSize( xSize + 1, ySize + 1 ), X Scale( 0, xSize + 1 ), Y Scale( 0, ySize + 1 ), <<Add Image( image( original ), bounds( top( 0 ), Left( 1 ), bottom( ySize ), Right( xSize + 1 ) ) ), Text( Center Justified, { 50, 10}, "KATIE" ) ); updated = gb[framebox( 1 )] << getpicture; updated << crop( Left( 1 ), top( 1 ), Right( xSize + 1 ), bottom( ySize + 1 ) ); originalMatrix = original << getpixels; newMatrix = updated << getpixels; diff = (originalMatrix - newMatrix != 0); New Window( "bitmaps", V List Box( gb ) );