Colorbar font size bug?

Hi.

When saving a screenshot with resolution than that of the default one the size of fonts in the colormap are scaled awkwardly, i.e. they appear in the saved image much larger than in the rendering window.

The same does not occur with fonts in annotations.

Could it be a bug?

Update: the same behavior applies to the colorbar thickness

Replicated. This is a bug. I wrote it up here: https://gitlab.kitware.com/paraview/paraview/issues/18651. Scheduled for next fall, but it will depend on the queue of bugs that exist the middle half of next year.

Here is what is happening. When you save a screenshot larger than the current render view resolution, ParaView needs to scale up text so that it looks proportional to the other elements in the image if you have the Font Scaling property in the Save Screenshot Options dialog set to “Scale fonts proportionally”. Now, this scaling is restricted to integral scale factors, so if you increase the resolution in each dimension by 2, 3, 4 times, or some other integral, the font scaling looks as expected. But if you increase the resolution by 1.1 times, for instance, the fonts will appear too large.

A workaround is to set the render view size in ParaView to some integral factor smaller than the desired output image resolution using the menu item View -> Preview -> Custom … Then save the image at the desired resolution. The fonts will be proportional to the rest of the image.

Why aren’t we able to scale fonts by an arbitrary scale factor? I believe there are historical reasons I am not familiar with, but this integral scale factor is scattered throughout VTK. It may be a fair amount of work to change it to an arbitrary scale factor, but it is worth looking into.

Got it.

Thanks for the in deep explanation, Cory.

R

@cory.quammen @utkarsh.ayachit would it be worth the time to look into VTK, to try to understand why we can’t scale at non integer values?

I think it would be nice to be able to scale fonts in a truly proportional manner.

Also probably the same issue: https://gitlab.kitware.com/paraview/paraview/-/issues/20290

I noticed that math font scales properly even when saved in a different resolution. So a temporary hack (until ParaView gets a fix) would be to edit axes and color legend font formatting to something like $%.0f$. This setting is available only in the advanced options (made visible by clicking the gear icon).

Actually, the edge lines and contour lines also do not scale properly. A fix for this to render them as 3d tubes is suggested here: Axes label do not scaling righ when save the screenshot at higher resolution. - #2 by liangwang0734.

I struggled with this issue and before finding Cory’s excellent explanation and workaround had almost given up.

I strongly recommend emitting a warning when the unexpected screenshot behavior will occur. This would have saved me many hours.

My use case is that I was trying to automatically create a gallery of images by executing demos. Most of the screeenshots were useless b/c the text was far larger than the object being viewed. For me, the solution was

ImageResolution = [1920, 1080]
renderView.ViewSize = ImageResolution
pvs.Render(renderView)
pvs.SaveScreenshot(file_png, renderView, ImageResolution=ImageResolution)

https://gitlab.kitware.com/paraview/paraview/-/issues/21459