cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
lala
Level IX

How to use JSL to restore a picture binary to a picture in a table?

The image binary file is downloaded from the web using JSL in the format of.

2022-11-25_11-07-14.png
I tried the following JSL, which cannot be loaded as a picture in the table.

 

rs=New HTTP Request(URL(u),Method("GET"),Headers(h));
rr=rs<<Send;

img="New Image(Char To Blob("||rr||"base64compressed\!"),\!"png\!")";
dt=New Table("kk",Add Rows(1),New Column("A", Expression),New Column("B", Expression),New Column("C", Expression));
dt[1,1]=img;

I have attached the results of this binary file.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

回复: How to use JSL to restore a picture binary to a picture in a table?

u = "https://community.jmp.com/t5/image/serverpage/image-id/47607iC302B97FB4C8A9DF/image-size/large?v=v2&px=999";

rs=New HTTP Request(URL(u),Method("GET"));
rr=rs<<Send;

img=open(rr,"PNG");
dt=New Table("kk",Add Rows(1),New Column("A", Expression),New Column("B", Expression),New Column("C", Expression));
dt[1,1]=img;

capture.png

If you don't need the httprequest, open can fetch the url directly. Above, httprequest fetched a BLOB from the server and open accepts the BLOB in place of a file name; open needs the explicit file type since the BLOB does not know the extension.

Craige

View solution in original post

3 REPLIES 3
lala
Level IX

回复: How to use JSL to restore a picture binary to a picture in a table?

  • Use  browser to download the image and save it to a local file. Then load it with JMP

2022-11-25_11-20-12.png

lala
Level IX

回复: How to use JSL to restore a picture binary to a picture in a table?

  • Does it indicate that this binary requires further conversion?

txt=Decode64 Blob(rr);

2022-11-25_10-46-50.png

Craige_Hales
Super User

回复: How to use JSL to restore a picture binary to a picture in a table?

u = "https://community.jmp.com/t5/image/serverpage/image-id/47607iC302B97FB4C8A9DF/image-size/large?v=v2&px=999";

rs=New HTTP Request(URL(u),Method("GET"));
rr=rs<<Send;

img=open(rr,"PNG");
dt=New Table("kk",Add Rows(1),New Column("A", Expression),New Column("B", Expression),New Column("C", Expression));
dt[1,1]=img;

capture.png

If you don't need the httprequest, open can fetch the url directly. Above, httprequest fetched a BLOB from the server and open accepts the BLOB in place of a file name; open needs the explicit file type since the BLOB does not know the extension.

Craige

Recommended Articles