plotlib icon indicating copy to clipboard operation
plotlib copied to clipboard

PNG Support

Open Stoeoef opened this issue 5 years ago • 3 comments

Reading the 1.0 roadmap .png support seems to be planned. Is there anything ongoing for implementing this?

Otherwise, the easiest way seems to rely on an existing svg renderer like librsvg or resvg. Exporting an svg would consists of creating the svg root node, finding good export options and handing those over to the renderer.

The major downside of this approach, despite the increased compile times, is in my opinion the dependency on a system library like cairo or qt. resvg allows to choose from these, librsvg is based on cairo. Thus, it may be appropriate to hide these backends behind feature flags.

As a plus, many more image formats should be exportable. For resvg, I was able to export .bmp, .jpg, .png and probably more.

I could offer a hand for implementing this, just let me know about your preferences.

Stoeoef avatar Apr 14 '19 13:04 Stoeoef

resvg looks good. If there is no better solution (e.g. a pure rust library) I would say go for it, although I don't have the final say about what gets merged. @mindriot101 @milliams what do you think?

Ploppz avatar Apr 21 '19 11:04 Ploppz

I think that using something like resvg makes sense. I'd like to keep plotlib and its dependencies as pure-rust as possible in general but that shouldn't get too much in the way of adding features.

milliams avatar Mar 14 '20 18:03 milliams

Is this on the roadmap for a future release / are you interested in PR's for adding resvg?

sstadick avatar Jul 14 '20 15:07 sstadick