marbl / MetagenomeScope

Visualization tool for (meta)genome assembly graphs
https://marbl.github.io/MetagenomeScope/
GNU General Public License v3.0
24 stars 8 forks source link

Automatically cropping screenshots #227

Open fedarko opened 2 years ago

fedarko commented 2 years ago

Esp. with relatively linear graphs, the view of the full graph often includes a lot of white space on the top and bottom of the image. For example:

6104

It doesn't seem like Cytoscape.js has functionality to automatically "crop" the image (remove white space), and it'd be really nice if this were included (since as it is currently, the extra space takes up a lot of room when including these visualizations in a paper).

I thiiiink this might be possible to do after we get the base64-encoded image from Cytoscape (see here), but this might rely on adding some fancy JS dependencies (and then the question becomes "is this worth it"). Would be easier to set up a Python / shell script or something to distribute with mgsc that auto-crops a directory of images, or something.

fedarko commented 2 years ago

Ahhh, yeah, we can just use imagemagick (see here):

$ convert mgsc.png -trim mgsc-cropped.png

Can probably just add something to the docs that describes how to apply this to many screenshots at once.

something something xkcd alt text