weserv / images

Source code of wsrv.nl (formerly images.weserv.nl), to be used on your own server(s).
https://wsrv.nl/
BSD 3-Clause "New" or "Revised" License
1.97k stars 193 forks source link

Support EPS format #417

Open ab192130 opened 5 months ago

ab192130 commented 5 months ago

Hey everyone!

First off, thanks a bunch for this super cool open source project! You guys rock!

I would like to know if weserv supports EPS format (Encapsulated PostScript). The FAQ mentions that it unofficially supports ALL image extensions of imagemagick.

And I've tested it with a sample.eps file: https://files.catbox.moe/1szxcf.eps. I've tested it with my S3 link either.

The response I get is: {"status":"error","code":404,"message":"Image not readable. Is it a valid image?"}

Is it really supports EPS, if not, can we implement it? Or am I doing something wrong? I need it for my project so bad.

Have a great day ☀

kleisauke commented 5 months ago

ImageMagick delegates PostScript interpretation by shelling out to the Ghostscript command-line tool. That means that rendering an EPS image is now a many-stage process: the EPS buffer is copied to a temporary image file in /tmp, Ghostscript is executed with a set of command-line flags to render the document out to an image file in /tmp, this temporary image file is read back in again, and finally the image is converted into the desired output format.

Obviously shelling out to an external program and passing the image back in via a temp file is pretty inefficient, which is one of the main reasons we disabled this format on our public service. Furthermore, Ghostscript is licensed under the restrictive AGPL licence, which means that any software linked to it must also be licensed under the AGPL.

ab192130 commented 5 months ago

Thanks for the detailed explanation! This clarifies the EPS rendering process and the reasoning behind disabling the format.

There seems to be a lack of information about using ImageMagick with custom microservices. I'm going to do some deeper research on this topic and see if I can build one myself. Thanks again 🙏