Padding/margin inserted by Image to Report node

I am trying to wrap my head around image sizes/scaling in BIRT reports. Using the 07_BIRT_Example_Basic workflow, I can’t seem to get rid of the padding/margin seen here:

In the Scatter Plot’s configuration, the image width and height are set to 800 and 600, respectively:

In the Image to Report configuration, I’ve used the same values:
Image to Report config
By the way, in the original example workflow, the dimensions are swapped (width=600, height=800). I guess, this is probably by accident as the node’s configuration uses a non-intuitive order (height first, width second; this took me quite a while to figure out so you may want to consider changing the node’s configuration interface).

Anyway, even when using the exact same dimensions in the Scatter Plot and the Image to Report nodes, KNIME somehow inserts some padding/margin around the original plot as seen in the first screenshot. One can see that the image has the correct dimensions but now the original plot is downsized due to the added padding/margin. Is this a bug? If not, how do I get rid of that padding/margin?

So I played around a bit with the Image to Report dimensions, and it seems to me that internally a scaling factor is being calculated in a wrong manner.
Let’s say, the original plot dimensions are w and h (in the example workflow, that’d be the Scatter Plot node’s dimensions), and the dimensions for the report are W and H (that’s the Image to Report node’s dimensions). Then the scaling factor should be something like s = min(W/w, H/h) but it seems to be calculated rather like s = min(W/h, H/w) followed by adding padding/margins to accomodate the Image to Report’s dimensions leading to the observed strange behaviour. This may be related to the node’s configuration interface where width and height are defined in an unusual order as I mentioned above.

Hi @mattflor -

Thanks for the detailed report. I agree with you that something is strange here, and it appears to be in the Image to Report node - I only see the additional border padding added there. If I write an SVG image directly using an Image Writer (Port) node the padding isn’t present, but that’s no help on the BIRT side of things.

I’ll followup with the developers and see what I can find out - in particular, I’m interested to see if your idea about the scaling factor is on the mark.

(Internal: AP-14427)

1 Like