Does it make sense to deploy reusable library for rendering SVG, etc.?

I was thinking of creating a library that can render art, which could then be called from any other contract, such as an ERC721 smart contract.

The motivation for this is that there are many NFTs that want to render art, such as SVG, and this requires the same (or similar) code to be deployed on-chain repeatedly, which is expensive.

This led me to wonder why there are not already libraries deployed that can render things like SVG, HTML, or other common formats. Is there a fundamental reason why this is not useful or practical? There seems to be a lot of interest in decentralization, and the only reliable way to store certain data is on chain.

Why are you putting client side rendering code on Ethereum? Such code should live somewhere like IPFS instead.

IPFS storage has no guarantee that it’s permanent. Looking at the opposite perspective: Why would I NOT put it on Ethereum, if it’s small enough to be stored there? There are already NFTs that store the art on chain, such as Nouns (see On-Chain Artwork at https://nouns.wtf/). Also generative artwork from Artblocks, I think there are many examples.

Storing a seed on-chain but the algorithm off-chain is reasonable. Similarly, storing a hash on-chain and the image itself off-chain is reasonable. The reason “why not” is because on-Ethereum storage is incredibly expensive, while off-chain storage can achieve desired levels of availability at essentially epsilon cost relative to on-chain storage.