HackerTrans
TopNewTrendsCommentsPastAskShowJobs

jcupitt

no profile record

comments

jcupitt
·เดือนที่แล้ว·discuss
Some packages with native code components (like sharp) will use these hooks to download the correct precompiled native binary for you.
jcupitt
·เดือนที่แล้ว·discuss
sharp downloads over https and checks the sha256 (I think?) of the archive.
jcupitt
·เดือนที่แล้ว·discuss
sharp does this too:

https://sharp.pixelplumbing.com/install/#prebuilt-binaries

it can sometimes need to compile the C++ shim that sits between node and libvips, but that's rare.
jcupitt
·เดือนที่แล้ว·discuss
sharp does not rebuild libvips, it downloads a pre-compiled libvips for your platform.

https://sharp.pixelplumbing.com/install/#prebuilt-binaries

It can usually also download a precompiled binary for the C++ shim that sits between node and libvips, but if your node / arch / etc. is not supported, it'll compile that (that's what the build.js file you linked does).
jcupitt
·4 เดือนที่ผ่านมา·discuss
Hello, libvips author here, you can get it to do the OKLab averaging for you. For example, using pyvips (ahem, untested):

image = pyvips.Image.new_from_file(filename, access="sequential")

scale = min(200 / image.width, 200 / image.height)

thumbnail = image.colourspace("oklab").resize(scale).extract_bands(0, n=3)

rgbf = thumbnail.write_to_memory()

That'll stream the source image and make a RGBRGBRGB memory buffer of single precision floats. You could perhaps use kernel="linear" and avoid any ringing from lanczos3.

I think I would downsample in a linear light space, like scRGB. Averaging there means averaging photons, which will surely be better than OKLab. Maybe switch to OKLab for clustering. Though of course I've not tested it.
jcupitt
·5 เดือนที่ผ่านมา·discuss
libvips uses imagemagick (via libMagick) for BMP load and save, fwiw
jcupitt
·7 เดือนที่ผ่านมา·discuss
It's just `vips copy src.heic dst.jpg`.
jcupitt
·7 เดือนที่ผ่านมา·discuss
libvips, the library behind sharp, has just released version 8.18.0: https://www.libvips.org/2025/12/04/What's-new-in-8.18.html

It includes support for UltraHDR (HDR and SDR in one JPEG file), camera RAW images, and the Oklab colourspace. This should all be coming to sharp in the next six month or so.
jcupitt
·9 เดือนที่ผ่านมา·discuss
Cleanup can be very useful if you depend on a library that does not support arenas.
jcupitt
·9 เดือนที่ผ่านมา·discuss
`free(NULL);` will crash on some platforms that gcc supports, I believe.
jcupitt
·10 เดือนที่ผ่านมา·discuss
I'm the libvips author, I should have said, so I'm not very neutral. But at least on that test it's usefully quicker and less memory hungry.
jcupitt
·10 เดือนที่ผ่านมา·discuss
pyvips (the libvips Python binding) is quite a bit better than pillow-simd --- 3x faster, 10x less memory use, same quality. On this benchmark at least:

https://github.com/libvips/libvips/wiki/Speed-and-memory-use
jcupitt
·10 เดือนที่ผ่านมา·discuss
Ah no problem! I'm glad it's useful.

`govips` was a pretty early binding and wasn't really done the libvips way. It doesn't expose all the operations or options, it's mostly done by hand, and there are a number of leaks and misfeatures.

It's been replaced by `vipsgen`:

https://github.com/cshum/vipsgen

Which is an automatically generated 100% binding. It should have the complete API, it should be very stable and leak-free, and it should be simple to maintain.

`autorot` is pretty expensive. You'll see much better performance if you flip x and y in your crop instead.
jcupitt
·10 เดือนที่ผ่านมา·discuss
Hello, libvips author here, the JPEG loader has a flag to do this for you. You can write:

VipsImage *image = vips_image_new_from_file("something.jpg", "autorotate", TRUE, NULL);

and it'll flip it upright for you and remove any EXIF orientation tag. It isn't the default since it has (obviously) a large memory and cpu cost.

For simple resize and crop it's much better to use the exif tag to adjust the resize and crop parameters (the vipsthumbnail command does this).
jcupitt
·10 เดือนที่ผ่านมา·discuss
Applying rotation can have a large performance penalty (both cpu and memory), so you want to be able to avoid it if possible.