提取图像的字符串表示除了将表达式转换为字符串并提取之外,有没有更好的方法从 New Image() 获取字符串?感觉有点草率。Arg() 不适用于“Picture”对象。
Names Default to Here ( 1 );
g = New Image( Char To Blob( "blahblahblob", "base64compressed" ) );
f = Substr( Char( g ), Contains( Char( g ), "\!"") + 1, Contains( Char( g ), "\!", \!"base64" ) - ( Contains( Char( g ), "\!"") + 1 ) );
自动化和脚本回复:提取图像的字符串表示我想到该怎么做了。我的数据表 dt 里有图片。提取单元格的值会创建一个图片对象,但我找到了一个解决方法。我一直尝试使用表达式,但总是失败。后来我突然想起,解析字符串和定义表达式本质上是一样的。现在我可以相当顺利地将图片从 JMP 发送到 Python 了。
Names Default to Here ( 1 );
r = Parse( Char( dt:Image[11] ) );
f = Arg( Arg( r, 1 ) );
h = Encode64 Blob( Char to Blob( f, "base64compressed" ) );
Python Submit( Eval Insert( "\[
import base64
import io
from PIL import Image
pic = '''☺h☺'''
imgdata = base64.standard_b64decode(pic)
img = Image.open(io.BytesIO(imgdata))
img.show()
]\", "☺"
) );
回复:提取图像的字符串表示当我想要一个不带 JMP 通常创建的 gfx 文件夹的静态 .html 时,我在这里做了一些类似的带有嵌入图像的 HTML (参见我的回复)。
查看更多...
Names Default To Here(1);
cur_pic = New Image("$SAMPLE_IMAGES/windmap.png");
base64compressed_str = Arg(Arg(parse(Char(cur_pic)), 1), 1);
base64_str = Encode64 Blob(Gzip Uncompress(Char To Blob(base64compressed_str, "base64compressed")));
据我了解,这应该会使 JMP19 中的 JMP Python 集成变得更容易。