[Matplotlib-devel] [Matplotlib-users] paletted PNG backend

Eric Firing efiring at hawaii.edu
Mon Feb 15 12:52:17 EST 2016


I wonder whether we can take advantage of this: https://pngquant.org/.

Eric

On 2016/02/15 5:43 AM, Thomas Caswell wrote:
> Jesper,
>
> That is a cool application!
>
> 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
> (https://github.com/matplotlib/matplotlib/blob/master/src/_png.cpp#L123)
> from the Agg RBGA buffer.
>
> You might also be interested in
> https://github.com/matplotlib/matplotlib/pull/5389 where Mike did some
> work to sort out which png settings are fastest.
>
> Tom
>
> PS The mailing list has moved to matplotlib-devel at python.org
> <mailto:matplotlib-devel at python.org>  please re-subscribe and send
> future emails there.
>
> On Mon, Feb 15, 2016 at 3:19 AM Jesper Larsen <jesper.webmail at gmail.com
> <mailto:jesper.webmail at gmail.com>> wrote:
>
>     Hi Matplotlib users,
>
>     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: https://ifm-beta.fcoo.dk)
>
>     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.
>
>     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.
>
>     My questions are:
>
>     1) Is it possible to extend the AGG backend for this and how?
>
>     2) Is it better to make a separate Pillow based backend for this
>     (Pillow is probably not as fast as AGG)?
>
>     Best regards,
>     Jesper
>
>
>
>     ------------------------------------------------------------------------------
>     Site24x7 APM Insight: Get Deep Visibility into Application Performance
>     APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>     Monitor end-to-end web transactions and take corrective actions now
>     Troubleshoot faster and improve end-user experience. Signup Now!
>     http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140_______________________________________________
>     Matplotlib-users mailing list
>     Matplotlib-users at lists.sourceforge.net
>     <mailto:Matplotlib-users at lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> _______________________________________________
> Matplotlib-devel mailing list
> Matplotlib-devel at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-devel
>



More information about the Matplotlib-devel mailing list