How to read a figure(.png file) and pass it as a binary blob to TERR and visualize in data table or text area in spotfire?

I am tryingto read a picture (png file) and pass it as a binary blob to TERR and visualize in data table in spotfire,  I defined a data table (Fig) as the output of my data function in TERR. The problem is that  I can not remove   header of data table. Also, the size of the figure in data table is very small and I have to adjust it every time I run the data function.  Thanks in advance. 

 

# name of picture

path<- "C:/data/" 

tempfilename <- paste0(path,"TestPlot.png")

 

# Read the resulting png into binaryValue

 

myConnection <- file(tempfilename,'rb')

binaryValue <- readBin(con=myConnection,what="raw",n=(file.info(tempfilename)$size)) 

close(myConnection)

 

# Generate an output data table, with 1 row, 1 column, with a blob value.

Fig <- data.frame(col1=c(NA))

Fig <- list(binaryValue)

 

p <- "image/*"

names(p) <- "ContentType"

attr(Fig, "SpotfireDataTableMetaData") <- as.list(p)

 

 

 

Attachments

AttachmentSize
Image icon capture.png16.78 KB

(2) Answers

Login