Re: XProc-based rasterizer

Wendell Piez <wapiez@wendellpiez.com> writes:
> The FOP processor integrates Apache Batik for SVG support, and Batik can do the job. Can an XProc processor invoke Batik directly to convert SVG to a supported raster format? What would that look like, for XML Calabash for example (which comes with FOP, I think)?

There’s no obvious way to do it directly in XProc. I can imagine hacky ways to do it: write a Java class that does the work, then register that as an extension function and call it from XPath.

But that’s not very XProc-y.

> Or is there some other nice or easy way to do this using XProc?

This draws attention to an extension point in XProc 3.0 that didn’t exist in 1.0 and which I don’t think we have much experience with yet. I think a conformant processor could implement this with cast-content-type.

When I implemented the RDF extension steps, I was faced with eight or ten different RDF content types. I decided that loading any of them would always produce an efficient binary representation. If you want to export the binary form in N3 or turtle or rdf/json or rdf/xml or or or, you can use cast-content-type.

That seemed preferable to having special-purpose rdf-load and rdf-store steps. And, until I’m persuaded otherwise, I think that was the right call. 

Casting from SVG to PNG either feels really natural (they’re just different content types, different representations for “the same” data), or really odd (is that *really* like the standard casts, from HTML to XML or JSON to text?).

I vacillate.

I think the other way to do this would be with a “rasterize” step that takes a vector format and produces a raster format. Building it on top of the Batik processor for SVG seems very natural. But at least in principle it could have (implementation dependent) support for rasterizing EPS, PDF, etc.

                                        Be seeing you,
                                          norm

--
Norm Tovey-Walsh <ndw@nwalsh.com>
https://norm.tovey-walsh.com/

> A man may destroy everything within himself, love and hate and belief,
> and even doubt, but as long as he clings to life he cannot destroy
> fear.--Joseph Conrad

Received on Friday, 7 March 2025 16:49:13 UTC