<div dir="ltr"><div><div><div>Hi Thomas<br><br></div>Thanks for your reply. The pull request by mdboom actually led me to find an undocumented option in Pillow to set the compression level (we now use compress_level=7). This reduced the cost of producing the paletted PNG very much with very little effort.<br><br></div><div>We are however still interested in improving the performance further. And the information that you have provided is definitely useful for this<br><br>Best regards,<br></div></div>Jesper<br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-02-15 16:43 GMT+01:00 Thomas Caswell <span dir="ltr"><<a href="mailto:tcaswell@gmail.com" target="_blank">tcaswell@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Jesper,<div><br></div><div>That is a cool application!</div><div><br></div><div>I am not sure doing this directly in Agg would be the best place (as I am not sure how to conceptually combine anti-aliasing + compositing + color pallet). I think a better place to extend would be the png writer to directly export a palleted png (<a href="https://github.com/matplotlib/matplotlib/blob/master/src/_png.cpp#L123" target="_blank">https://github.com/matplotlib/matplotlib/blob/master/src/_png.cpp#L123</a>) from the Agg RBGA buffer. </div><div><br></div><div>You might also be interested in <a href="https://github.com/matplotlib/matplotlib/pull/5389" target="_blank">https://github.com/matplotlib/matplotlib/pull/5389</a> where Mike did some work to sort out which png settings are fastest.</div><div><br></div><div>Tom</div><div><br></div><div>PS The mailing list has moved to <a href="mailto:matplotlib-devel@python.org" target="_blank">matplotlib-devel@python.org</a> please re-subscribe and send future emails there.<br><br><div class="gmail_quote"><div><div class="h5"><div dir="ltr">On Mon, Feb 15, 2016 at 3:19 AM Jesper Larsen <<a href="mailto:jesper.webmail@gmail.com" target="_blank">jesper.webmail@gmail.com</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div><div><div><div><div><div><div><div><div>Hi Matplotlib users,<br><br></div>We are using Matplotlib for a web service which makes PNG images on the fly for presentation on a map (web site using the web service is here: <a href="https://ifm-beta.fcoo.dk" target="_blank">https://ifm-beta.fcoo.dk</a>)<br><br></div>Performance and image size are two major concerns for us. We therefore save the resulting RGBA PNG to a buffer and afterwards use Pillow (PIL) to convert it to a P PNG (paletted PNG) to reduce the image size dramatically.<br><br>This procedure does however use a significant amount of our total processing time per image. I would therefore be interested in extending e.g. the AGG backend to produce paletted PNGs directly. I am of course aware that this might not be useful for many others since one would have to provide some extra information when rendering with this backend (possibly output palette and quantizing method). But on the other hand it might be useful for others doing web services using matplotlib.<br><br></div>My questions are:<br><br></div>1) Is it possible to extend the AGG backend for this and how?<br><br></div>2) Is it better to make a separate Pillow based backend for this (Pillow is probably not as fast as AGG)?<br><br></div><div></div></div>Best regards,<br></div>Jesper<br><br></div><div><div><div><div><div><div><div><div><br><br></div></div></div></div></div></div></div></div></div></div></div>
------------------------------------------------------------------------------<br>
Site24x7 APM Insight: Get Deep Visibility into Application Performance<br>
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month<br>
Monitor end-to-end web transactions and take corrective actions now<br>
Troubleshoot faster and improve end-user experience. Signup Now!<br>
<a href="http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140" rel="noreferrer" target="_blank">http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140</a>_______________________________________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@lists.sourceforge.net" target="_blank">Matplotlib-users@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://lists.sourceforge.net/lists/listinfo/matplotlib-users</a><br>
</blockquote></div></div></div>
</blockquote></div><br></div>