Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending examples #99

Open
lofcz opened this issue Sep 17, 2020 · 5 comments
Open

Extending examples #99

lofcz opened this issue Sep 17, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@lofcz
Copy link

lofcz commented Sep 17, 2020

Issue
Current index page with tutorials https://kleisauke.github.io/net-vips/tutorial/getting_started.html could be improved with more snippets which would save new users (like me) some time. These are some basic things most web app devs need:

  1. Resizing to exact size:
    First try after migrating to libvips from another image library: image.ThumbnailImage(width: w, height: h);
    Actual way to do it: image.ThumbnailImage(width: w, height: h, size: "force");

2) Saving gif image:
First attempt: image.WriteToFile('somepath.gif');
Actual way to do it: 1) Uninstall nuget with dll binaries. 2) Download binaries from libvips, mark as embedded resources 3) image.Magicksave("somepath.gif", "gif");

Since v8.12.0-rc1: https://www.libvips.org/2021/11/14/What's-new-in-8.12.html#better-gif-save

Describe the solution you'd like
Consider adding these to the examples.

Describe alternatives you've considered
Do nothing, keep things as is. It was hard to write, it should be hard to use.

@WDeenik
Copy link

WDeenik commented Oct 2, 2020

I've been trying for some time now to save GIFs and this post saved me, so yeah, I can imagine this will help quite some people.

I'm not sure if the method to support GIF saving will work for us though.

@kleisauke kleisauke added the enhancement New feature or request label Oct 11, 2020
@kleisauke
Copy link
Owner

Have you seen the samples/NetVips.Samples/Samples/ directory? It contains some useful and different image processing snippets with NetVips. I agree, perhaps the common ones should be included on the getting started page or on a separate wiki page.

The first snippet breaks the aspect ratio, it's usually not convenient to do that. Also, as mentioned in #97 (comment) I'd avoid ThumbnailImage, if possible.

For the second snippet, note that the libvips binary vips-dev-w64-all-x.y.z.zip contains ALL the file format loaders that libvips supports, including some very minor ones, and a complete copy of ImageMagick. It can process many different file types, but it is also rather vulnerable to hacking. It also contains GPL licensed libraries, so it is a bit problematic when you want to distribute your application.

@kleisauke
Copy link
Owner

fwiw, there is also an online playground available for libvips that can be useful for making prototypes. It has a similar API as the .NET binding: http://kleisauke.github.io/wasm-vips/playground/

@kleisauke
Copy link
Owner

The second snippet is no longer required for libvips 8.12, as that features a gifsave operation that uses cgif and libimagequant. See: https://www.libvips.org/2021/11/14/What's-new-in-8.12.html#better-gif-save

This can be tested using the NetVips.Native v8.12.0-rc1 NuGet package.

@kleisauke
Copy link
Owner

NetVips v2.1.0 and NetVips.Native v8.12.1 is now available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants