libvips / lua-vips

Lua binding for the libvips image processing library
MIT License
125 stars 10 forks source link

vips.Image.text : no such operation #38

Closed piface314 closed 6 months ago

piface314 commented 3 years ago

I recently installed vips-8.10.5, and tried rendering text, but I got an error:

> vips = require 'vips'
> image = vips.Image.text("Hello <i>World!</i>", {dpi = 300})
/usr/local/share/lua/5.1/vips/voperation.lua:155: no such operation
VipsOperation: class "text" not found

stack traceback:
    [C]: in function 'error'
    /usr/local/share/lua/5.1/vips/voperation.lua:155: in function 'text'
    stdin:1: in main chunk
    [C]: at 0x5649cc4771d0

(this is the example taken from README, run in luajit interactive mode)

I installed vips with just ./configure && make && sudo make install && sudo ldconfig. Did I miss something? Is there a proper way to uninstall and try again, maybe trying an older version?

jcupitt commented 3 years ago

Hello @piface314,

Your example works for me:

john@kiwi:~$ luajit
LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/
JIT: ON SSE2 SSE3 SSE4.1 BMI2 fold cse dce fwd dse narrow loop abc sink fuse
> vips = require 'vips'
> image = vips.Image.text("Hello <i>World!</i>", {dpi = 300})
> 

My guess would be that libvips failed to find the various libraries it needs to enable text rendering during configure. Check the output carefully and keep adding dependencies until you see yes in the summary table at the end. pangoft2-dev is probably the main one.

What platform are you using?

piface314 commented 3 years ago

I'm using Ubuntu 20.04. It's weird that I checked for pango before installing, it seems to be there:

$ apt search pangoft2
Sorting... Done
Full Text Search... Done
libpangoft2-1.0-0/focal,now 1.44.7-2ubuntu4 amd64 [installed,automatic]
  Layout and rendering of internationalized text

Is it the wrong package? Now that you said it, I really noticed that running ./configure again showed that it's missing:

...
text rendering with pangoft2:       no
jcupitt commented 3 years ago

You need the -dev package to get the headers for compilation.

Ubuntu 20.04 comes with an OK libvips, I would just use that unless you have a very strong reason to make your own.

piface314 commented 3 years ago

Oh, I wasn't aware of that. How should I properly remove this current misconfigured installation? Is enough to just delete the binaries? At /usr/local/bin/vips and /usr/local/bin/vips-8.10.

jcupitt commented 3 years ago

You can do make uninstall, as long as you've not touched the libvips area since you did make install.

Otherwise, I'd do:

find /usr/local/ -name "*vips*"

And remove everything that looks vipsy.

piface314 commented 3 years ago

Thanks! That solved it, and now I'm using vips 8.9.1 which is in apt.

rolandlo commented 6 months ago

Closing, since the issue has been solved.

jcupitt commented 6 months ago

Nice job clearing the weeds @rolandlo !