cannot able to convert text into png image using node Generic Javascript view

Hello sir,

I am new to KNIME. I have a sample input file containing data uri (SVG and PNG), SVG is showing properly using node Generic javascript view but it is not showing png image using same node Generic javascript view. Is there something that I need to change?

It will be very helpful is some give solution with sample workfolw.

here is my workflow snapshot and result.


Thanks in advance.

Here is my workflow for the previous problem.
tablewithSvgAndPngImage.knwf (91.3 KB)

Thanks in advance.

I am not an expert in Java script Views. From what I see the node needs a script to export the but there is no template to do that.

WARN Generic JavaScript View 0:265 Generate view was set, but no script defined. View generation not possible.

Hello maluber

Thanks for your kind effort :hugs:. Yes I am trying to do it by customize JS.
Here I have make a rough solution if it by customizing the JS code in node Generic Javascript view :slightly_smiling_face:.

js source code:
$.each(, function(coli, col){
// 列タイプを取得する
var colType = t.getColumnTypes();
let colPNG = colType[coli];
var convertToPNG = document.createElement(“IMG”);
convertToPNG.setAttribute(“src”, “data:image;”+“base64,” + col);
//convertToPNG.setAttribute(“height”, “400”);
//convertToPNG.setAttribute(“width”, “400”);
convertToPNG.setAttribute(“alt”, “alt Img”);
/* 取得データをテーブルへ設定 */
if (colPNG == “png”) {
$(’’, {‘class’:tblBclass})
.attr(‘rowi’, rowi)
.attr(‘coli’, coli)
.on(‘click’, function(e){tdEvent(e, rowi, coli)})
} else {
$(’’, {‘class’:tblBclass})
.attr(‘rowi’, rowi)
.attr(‘coli’, coli)
.on(‘click’, function(e){tdEvent(e, rowi, coli)})

here I had attached the workflow showing png and svg image. Note that just configure the png or svg in Renderer to image node to see the result.
tablewithSvgAndPngImage[solved].knwf (91.7 KB)


1 Like

Not entirely sure if this does work for you now. If not you might focus on producing the SVG at the green output port and later convert that to a PNG if you have to.

I agree with your opinion.
Thank you.