xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justin McCarthy" <justinamccar...@gmail.com>
Subject PNG transcoding time -- f(resulting file size)?
Date Mon, 03 Apr 2006 19:27:07 GMT
I've spent 20 minutes or so digging through the archives without finding
much detail on this topic.  Apologies if I missed an obvious thread, but I
have an interesting observation to share anyway --

Here's the problem:

I'm deploying Batik as a servlet.  This application will be deployed to a
high load, highly concurrent environment.  We'll be rasterizing both JPEGs
and PNGs in equal number.

Unfortunately, encoding exactly the same SVG with exactly the same
parameters, but substituting the PNGTranscoder for the JPEGTranscoder runs
about 10x slower.  Here's the interesting part: at least 20% of the
execution time in the PNG scenario can be attributed to Firefox rendering
the PNG slowly (I'm logging the transcode after streaming the result to the
browser).  Here are the logs; width=500, height=500; the final number is
time, in ms:

Apr 3, 2006 12:11:43 PM com.cafepress.svg.SvgServlet logTranscode (JPEG from
FF)
INFO: Transcode complete: - 500 500 image/jpeg    47
Apr 3, 2006 12:11:45 PM com.cafepress.svg.SvgServlet logTranscode (JPEG from
IE)
INFO: Transcode complete: - 500 500 image/jpeg    47
Apr 3, 2006 12:11:48 PM com.cafepress.svg.SvgServlet logTranscode (PNG from
IE)
INFO: Transcode complete: - 500 500 image/png   532
Apr 3, 2006 12:11:51 PM com.cafepress.svg.SvgServlet logTranscode (PNG from
IE)
INFO: Transcode complete: - 500 500 image/png   547
Apr 3, 2006 12:11:59 PM com.cafepress.svg.SvgServlet logTranscode (PNG from
FF)
INFO: Transcode complete: - 500 500 image/png   688
Apr 3, 2006 12:12:03 PM com.cafepress.svg.SvgServlet logTranscode (PNG from
FF)
INFO: Transcode complete: - 500 500 image/png   672

So, my question is:

Do we expect PNG transcoding to be an order of magnitude slower than JPEG?
The example image I provide below _is_ a photograph, and therefore
transcodes much larger as PNG than JPEG.  Do we expect transcoding time to
be linear with resultant file size?  Is IO the dominant component of any
transcoding operation?  If so, I think the mystery is solved (and we'll just
have to figure a way to avoid PNG'ing certain graphics).

Here's the SVG:

<svg
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:cc="http://web.resource.org/cc/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:svg="http://www.w3.org/2000/svg"
    xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink" width="500" height="333">
    <g id="layer1" transform="rotate(15)">
        <image
            id="puppy"
            height="333"
            width="500"
            xlink:href="http://static.flickr.com/41/122717114_84699d322f.jpg"

        x="0" y="0"/>
    </g>
</svg>

Thanks for the help,
Justin

Mime
View raw message