Read image node failed to read JPEG and PNG

I am trying to read images into KNIME using the read image node. Below is an image of my workflow:

image

I am feeding the read image node a csv file. The csv file looks like this:

The error I keep getting is this:

5:109 Execute failed: Failed to read image content from row ‘Row0’, url=‘D:\Universit…lassification\Paintings_dataset\A_1’: unknown protocol: d

Maybe you are missing the file extension in the table?

L.

Hi @Haroon2001

The Read Images nodes requires an URL/URI input to work properly. As such, add a String to URI node in between the CSV Reader and the Read Images. See this example:

image

image

@zioludo is right that the File Path should contain the file extension. It’s easier to use the List Files node which automatically does this. Here you can also filter for certain file names and extensions.

This will create a file location of type Path which you also can convert to URI with the Path to URI node.

As a general tip, have a look on the KNIME hub for example workflows where the Read Images node is used.

Hope this helps!

4 Likes

So I followed your advice this is my new workflow:
image

The CSV fil looks like this

I followed your instructions and also added the .png file format into the csv’s file row
but when I read the image it just shows question mark in the row instead of the image.

When I try to upload an image from my local disk D it says this error:
WARN Read Images 3:109 Failed to read image content from row ‘Row99’, url=‘D:\Universit…\Paintings_dataset\jpg2png\V_50.png’: unknown protocol: d

and when I try to open the file from Local disk C it says this:
3:109 Failed to read image content from row ‘Row0’, url=‘C:\Painting_dataset\A_1.png’: unknown protocol: c
Image_reading.txt (3.8 MB)

Have you tried the List files option and filter for A_* just to test if that is working? Only other reason I could think of right now is that your images are not properly formatted as PNG.

@Haroon2001 the log file says that something might (still) be wrong with the URL. Can you try and do this example and see if that does work.

You will have to load the whole workflow group:

Also could you maybe upload some examples of the PNG files you are trying to import. If that would not spell any secrets.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.