cytoscape / py4cytoscape

Python library for calling Cytoscape Automation via CyREST
https://Py4Cytoscape.readthedocs.io
Other
72 stars 14 forks source link

How to export high dpi pictures with export_image and cytoscape v3.10? #146

Closed matthiaskoenig closed 3 weeks ago

matthiaskoenig commented 3 weeks ago

How can one generate high dpi images with the export_image function? It states in the doc string:

resolution (int): The resolution of the exported image, in DPI. Valid only for bitmap formats, when the selected width and height 'units' is inches. The possible values are: 72 (default), 100, 150, 300, 600. [DEPRECATED as of Cytoscape v3.10]

I have a high DPI monitor and require high dpi images (also for publication). Everything looks blurry with 72 dpi.

bdemchak commented 3 weeks ago

Hi, Matthias --

The situation with the export_image() parameters is pretty difficult. It comes from an overhaul of image exporting features starting in Cytoscape v3.10, and is compounded by not creating a new function (e.g., export_image_10()) when the parameters changed so drastically.

The quickest and easiest way to answer your question would be for you to use Cytoscape manually to create an example of the image you'd like to generate, and then send us a screenshot of the Export Network As Image dialog (from File | Export network to image...). We can derive the equivalent export_image() parameters from there.

Here's an example of that dialog box:

image

matthiaskoenig commented 3 weeks ago

Thanks. I saw how to set all these settings in the function. I just thought there is an option to set the dpi, but the zoom will work.

I am just used to save things for publication/PDF in high dpi. But I can just export with a larger zoom and set the dpi of the image afterwards.

bdemchak commented 3 weeks ago

Thanks ... you're probably right. I don't recall the specific rationale of the Cytoscape developers at the time, but your idea rings a bell.