rokka-io / imagine-vips

libvips adapter for php imagine
https://rokka.io
Other
41 stars 8 forks source link

layers #1

Closed jcupitt closed 4 years ago

jcupitt commented 6 years ago

Hello and congratulations on your release!

Re. layers, libvips can save multi-page TIFF images, and can load multi-page PDF, TIFF, and GIF. It can also load any multi-page format supported by libMagick.

It's certainly true that GIF save is not supported :(

chregu commented 6 years ago

We could certainly load all the layers as single VipsImage somehow. What I couldn't figure out yet is, how to do that the most efficient way. I know I can use the page option to load a certain page, but I wouldn't know how many pages there are until the last load fails. Which seems a little bit inefficient (especially since most images are just one page). Is there a way to achieve that?

jcupitt commented 6 years ago

You set the number of pages to -1 and it'll load all of them. For example:

$ vips copy nipguide.pdf[n=-1] x.tif

Makes an N-page TIFF, with a page for each page of the PDF.

Many page images are represented internally as very tall, thin "toilet paper" images, with a page-height metadata item giving the sheet size (sorry about the analogy).

chregu commented 6 years ago

Thanks for that, did some very basic layers support in this branch: https://github.com/rokka-io/imagine-vips/tree/layers-support

It loads a gif image with ['n' => -1] and if it has more than one "layer", it crops the image up by page-height and puts them into layers, doesn't do much more than that yet and lower on my prio list currently.

chregu commented 6 years ago

Had some ideas how to do the whole animated gif support (with gifsicle), see #3 for details.

chregu commented 4 years ago

This is good enough for now. Closing issue finally.

jcupitt commented 4 years ago

You can save GIF via the magick saver, of course.

vips invert something.gif[n=-1] other.gif

Will invert an animated gif.