提取圖像的字串表示除了將表達式轉換為字串並提取之外,有沒有更好的方法可以從 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 整合變得更容易。