向图片添加文本@lwx228问如何将文本添加到已加载图像的单元格?这个想法很简单:把图片放在相框框里,用图形脚本装饰,拍一张新的照片。 获得漂亮的往返图像的细节有点复杂。 需要调整框架的大小和比例,定位图片,裁剪最终图像。
// open the original
original = New Image(
"https://upload.wikimedia.org/wikipedia/commons/thumb/f/fc/Oroblanco_%28sweetie%29_fruits.jpg/320px-Oroblanco_%28sweetie%29_fruits.jpg"
);
{xSize, ySize} = original << size;
// use a frame to do the drawing, make the original fit the frame exactly
gb = Graph Box(
<<BACKGROUNDCOLOR></BACKGROUNDCOLOR>
下面的结果显示了用装饰填充框架框的图像,以及下面的三张图像。 左图是原图,中间是修改后的,右图是差值。 区别大多是黑色,没有变化,这很好。 差异中的文本是模糊的,因为抗锯齿在文本边缘做了细微的变化。
Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.Circles and text added on top of fruit picture.在水果图片上添加圆圈和文字。
图片来自裁剪 JPG 图像解释 crop 是如何工作的。
查看更多...
Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.Use a graphics frame box to add text and lines on top of a picture.使用图形框架框在图片顶部添加文本和线条。
使用框架框向图片添加文本和线条。
回复:向图片添加文本好的
谢谢克雷奇!
gb[framebox(1)]<<ADD image=""></ADD>
回复:向图片添加文本是的。有点难,下面解释。
// open the original
original = New Image(
"https://upload.wikimedia.org/wikipedia/commons/thumb/f/fc/Oroblanco_%28sweetie%29_fruits.jpg/320px-Oroblanco_%28sweetie%29_fruits.jpg"
);
{xSize, ySize} = original << size;
overlay1 = new image("https://us.v-cdn.net/6038925/uploads/images/35680iA0171FFF13D53E06/NaturalCat.png");// cat
{xOverlay1Size, yOverlay1Size} = overlay1 << size;
dt = open("$sample_data/big class families.jmp","invisible");
overlay2 = dt:picture[1];// katie
overlay2<<SCALE></SCALE>
<P> </P>
<P><SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Pictures added over another picture." style="width: 971px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Pictures added over another picture." style="width: 971px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Pictures added over another picture." style="width: 971px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Pictures added over another picture." style="width: 971px;"><span class="lia-inline-image-display-wrapper" image-alt="Pictures added over another picture." style="width: 971px;"><img src="https://us.v-cdn.net/6038925/uploads/images/43745i912405FE3CFBC3E8/PicturePlusPicture.png" role="button" title="PicturePlusPicture.png" alt="Pictures added over another picture." /><span class="lia-inline-image-caption" onclick="event.preventDefault();">Pictures added over another picture.</span></span><SPAN class="lia-inline-image-caption" onclick="event.preventDefault();">Pictures added over another picture.</SPAN></SPAN><SPAN class="lia-inline-image-caption" onclick="event.preventDefault();">Pictures added over another picture.</SPAN></SPAN><SPAN class="lia-inline-image-caption" onclick="event.preventDefault();">Pictures added over another picture.</SPAN></SPAN><SPAN class="lia-inline-image-caption" onclick="event.preventDefault();">图片添加到另一张图片上。</SPAN></SPAN></P>
<P>图形脚本无法添加图片。使用 < <ADDIMAGE message="" instead.=""><></ADDIMAGE></P><P> </P>
<P>GraphBox(...) 函数采用三种参数:参数、消息和脚本。最佳实践是将参数和消息放在前面,将单个脚本放在最后。参数和消息以逗号分隔。该脚本使用分号来分隔语句。</P>
<P> </P>
<CODE class=" language-jsl">gb = Graph Box(
<<BACKGROUNDCOLOR></BACKGROUNDCOLOR>
<P> </P>
<P>很多很多图形框脚本都是偶然使用逗号而不是分号编写的。每个逗号都会导致一个新脚本开始,与前一个脚本分开。当一个脚本运行时,JMP 会运行多个脚本,这会产生一点额外的开销。</P>
<P> </P>回复:向图片添加文本你好克雷奇!
请问JSL是否可以在图片的指定位置叠加小图?
我搜索了帮助手册,没有找到答案。
能想到的就这些了。谢谢专家!
img = Open( "$SAMPLE_IMAGES/tile.jpg", jpg );
{x, y} = img << size;
img << crop( Left( 100 ), Right( x - 251 ), top( 0 ), bottom( y - 0 ) );
{x1, y1} = img << size;
img2 = Open( "$SAMPLE_IMAGES/black rhino footprint.jpg", jpg );
img << copy;//??
img2 << paste(100,25);//??
obj = New Window( "paste", New Image( img2 ) );<BR />
回复: 给图片添加文字如何增加肖像的透明度,例如增加到 50%
谢谢专家!
Re: 给图片添加文字好问题。 见第 12-18 行
Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.Katie is now 50% transparent.凯蒂现在有 50% 的透明度。
// open the original
original = New Image(
"https://upload.wikimedia.org/wikipedia/commons/thumb/f/fc/Oroblanco_%28sweetie%29_fruits.jpg/320px-Oroblanco_%28sweetie%29_fruits.jpg"
);
{xSize, ySize} = original << size;
overlay1 = new image("https://us.v-cdn.net/6038925/uploads/images/35680iA0171FFF13D53E06/NaturalCat.png");// cat
{xOverlay1Size, yOverlay1Size} = overlay1 << size;
dt = open("$sample_data/big class families.jmp","invisible");
overlay2 = dt:picture[1];// katie
// adjusting transparency. Katie already has a transparent background, alpha=0, and a mostly opaque
// foreground, alpha=1. Katie probably has some antialiasing around the edge of the shape, 0 < alpha < 1.
// rather than set all the alpha for the entire square to .5, multiply the existing alpha by .5.
// this will leave the alpha=0 at 0, and modify the others...
{r,g,b,a} = overlay2<<GETPIXELS></GETPIXELS>
使用是错误的
{r,g,b,a} = overlay2<<GETPIXELS></GETPIXELS>
这将通过在之前 0.0 的位置干扰 0.5 来忽略现有值。
The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.The cut-away parts are no longer completely transparent.切掉的部分不再是完全透明的。
[0,0] 进行矩阵赋值,而不是将 a 更改为标量。 浅灰色方块告诉我透明切掉的像素可能是白色的,将它们以 50% 的比例放在较深的灰色前面会导致较浅的灰色。
回复: 给图片添加文字谢谢克雷格! JSL中如何直接从绘图窗口中去掉x轴和y轴的值,并取消x轴和y轴的标签文字?

回复: 在图片上添加文字dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
p1 = dt << Graph Builder(
Variables( X( :weight ), Y( :height ), Group X( :age ), Color( :sex ) ),
Elements( Bar( X, Y, Legend( 5 ), Response Axis( "X" ), Summary Statistic( "Sum" ) ) )
);
img = p1 << getpicture ;
{r,g,b,a} = img<<GETPIXELS></GETPIXELS>How can Remove white background?Thanks Experts!
回复:在图片中添加文字图表的透明背景颜色
获取透明背景的一种方法是保存 SVG,然后编辑 SVG 以删除背景矩形。您可以使用 Inkscape 等编辑器执行此操作,也可以编写 JSL 来执行此操作。
dt = Open( "$sample_data/big class.jmp" );
gb = dt << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
SendToReport(
Dispatch( {}, "Graph Builder", FrameBox,
// I chose fedcba to be unique, used in patmatch below
{Background Color( -Hex To Number( "fedcba" ) )}
)
)
);
gb << savepicture( "$temp/temp.svg", "svg" );
txt = Load Text File( "$temp/temp.svg" );
Write( txt ); // to log, for debugging
/* remove something like this:
<G fill="#FEDCBA">
<RECT stroke="none" x="75.5" y="33.5" width="509" height="420"></RECT>
</G>
*/
rc = Pat Match( txt, "<G fill="\!">“ + Pat Arb()>> BadFillPattern +”</G>" );
If( !rc,
Throw( "fill pattern not found" )
);
// the BadFillPattern occurs twice, for two different colors. remove cases of
// <RECT stroke="none" x="75.5" y="33.5" width="509" height="420"></RECT>
// (the svg command that puts a rectangle of color behind the graph's data.)
nfound = 0;
While( Pat Match( txt, BadFillPattern, "" ), nfound += 1 );
If( nfound != 2,
Throw( "nfound=" || Char( nfound ) )
);
Save Text File( "$temp/temp.svg", txt );
// I don't know how you'll load this file on windows to prove it is transparent.
Open( "$temp/temp.svg" ); // this *does* load it, but there is nothing behind it to show through.
// you can open in FireFox and fiddle with the background color to observe the transparency
FireFox background shows through the transparency.FireFox background shows through the transparency.FireFox 背景通过透明度显示出来。
我知道有 Linux 工具可以将 SVG 转换为透明 PNG。这些工具可能也存在于 Win 上。
编辑:许多未经测试的想法https://stackoverflow.com/questions/6589358/convert-svg-to-png-in-python
回复: Add Text to a Picture是的,我现在一直使用这个命令
run program(executable("I:\00\imdisplay\magick.exe"),options({"C:\3\A1.png -fuzz 0% -transparent white C:\3\A2.png"}));
https://stackoverflow.com/questions/12424018/how-to-replace-white-background-color-with-transparent-of-an-image-in-imagemagic