Replies: 10 comments
-
Hello @tomasc, it should just work, ruby-vips is supposed to self-update. I see:
Perhaps your ruby is picking up a libvips that's been built without
|
Beta Was this translation helpful? Give feedback.
-
@jcupitt indeed
|
Beta Was this translation helpful? Give feedback.
-
Try to hint the file type: x.write_to_buffer ".gif", format: "gif" |
Beta Was this translation helpful? Give feedback.
-
Yes, I guess |
Beta Was this translation helpful? Give feedback.
-
@kleisauke @jcupitt yes that works! But only when saving to gif. x = Vips::Image.new_from_file "sample.gif"
x.write_to_buffer(".jpg", format: "jpg")
Vips::Error: unable to call VipsForeignSaveJpegBuffer: unknown option format |
Beta Was this translation helpful? Give feedback.
-
In other words, it feels funny to hint the format only on certain formats (gif) – should not this work across the board? |
Beta Was this translation helpful? Give feedback.
-
It does seem weird. It's to do with the way that savers work in libvips. libvips has a saver operation for each file format, so there's im.jpegsave "somefilename", Q: 85 There are versions with str = im.jpegsave_buffer Q: 85 When a saver class is initialized, it registers a list of suffixes it supports with libvips, eg. im.write_to_file "somefile.jpg" libvips extracts the suffix from the filename, then walks the saver list, searching for the highest priority saver which has registered that suffix. It then invokes that operation on your filename, passing down any options. For buffer output, it passes down the options, but does not pass down the filename (why would you need a filename for buffer output?). This causes problems for I suppose the fix would be for |
Beta Was this translation helpful? Give feedback.
-
Thanks, John. I worked around that for the time being in dargonfly_libvips. To me, it would be make sense if |
Beta Was this translation helpful? Give feedback.
-
Heh, I see I'm not the one who was confused by that there is some magic format guessing based on the extension. |
Beta Was this translation helpful? Give feedback.
-
For anyone looking for how to preserve a gif's animation when generating variants with vips and ActiveStorage: post.image.variant(loader: { n: -1 }, resize_to_limit: [400, 400]) with |
Beta Was this translation helpful? Give feedback.
-
It seems is possible to output
.gif
files in libvips~> 8.7.0
via command-line, but not usingruby-vips
. Is that correct? Do we need to updateruby-vips
somehow? If so, I can try to start a PR if you could point me to the right direction …Beta Was this translation helpful? Give feedback.
All reactions