algoo / preview-generator

generates previews of files with cache management
https://pypi.org/project/preview-generator/
MIT License
224 stars 49 forks source link

Feat: Generating PNG/webP images #308

Open tsnobip opened 2 weeks ago

tsnobip commented 2 weeks ago

Feature description and goals

How come the only output format for raster images is jpeg? It's not meant to be used for (uncompressed) graphics and it's overall not great for small images.

It would make sense to rather generate PNG (or webP) previews of documents for example.

I have little experience with the matter so I'm all ears if I've overlooked something here.

Prerequisites

Well, I don't think we have to add anything since Magick already supports PNG and WebP, so I guess it's only a matter of adding the API.

lebouquetin commented 2 weeks ago

Hello @tsnobip

You right: jpg is not always the best/most efficient image file format. The choice of JPG was because it was the most usable file format.

In a web context (this is the case for example for our software tracim) today the right choice would be webp.

Note: at the very beginning of preview-generator development jpg was the best average rendering.

I'm currently working on an extended version of preview generator which would also allow webp preview.

tsnobip commented 2 weeks ago

Thanks for your reply @lebouquetin.

I totally understand the situation was different back then, but today indeed WebP seems like the right format for the web.

I'm very interested in such a feature, regarding the timeline are we talking about weeks or more of a long term goal? I could totally contribute to this project if you're open to publish the work in progress.