pyvips icon indicating copy to clipboard operation
pyvips copied to clipboard

vips_colourspace: no known route from 'labs' to 'rgb'

Open 2h4dl opened this issue 5 years ago • 11 comments

pyvips.error.Error: unable to call sharpen
  vips_colourspace: no known route from 'labs' to 'rgb'

2h4dl avatar Dec 19 '19 02:12 2h4dl

Hello, you need to give more information.

  • libvips version
  • pyvips version
  • platform
  • complete, runnable code sample that shows the problem
  • any images the program needs to run

jcupitt avatar Dec 19 '19 07:12 jcupitt

AH! Sorry. libvips: 8.8.2 pyvips: 2.1.8 platform: ubuntu 16.04 Image: Imgur

import requests
import pyvips
image_content = requests.get("https://i.imgur.com/rpm6DLE.jpg").content
image = pyvips.Image.new_from_buffer(image_content)
if image.get_typeof("icc-profile-data") != 0:
            image = image.icc_transform("srgb", embedded=True, input_profile="srgb")
image = pyvips.Image.sharpen(image, sigma=1, y2=2, y3=2, m1=0, m2=0.9)

2h4dl avatar Dec 19 '19 11:12 2h4dl

@jcupitt I'm sure this exception caused by method icc_transform.

2h4dl avatar Dec 20 '19 02:12 2h4dl

Try to update your libvips version to 8.8.3 (or even better 8.8.4), this bug was introduced in 8.8.2. See: https://github.com/libvips/libvips/commit/46212e92b1f943e6852e807db1ee6e5ca66b6ccf#r34904985

@jcupitt I guess we still need the RGB -> sRGB conversion on master?:

	if( old_interpretation == VIPS_INTERPRETATION_RGB )
		old_interpretation = VIPS_INTERPRETATION_sRGB;

https://github.com/libvips/libvips/blob/1ee54bfa80a4d940b6988d76edcbca025039d286/libvips/convolution/sharpen.c#L196

kleisauke avatar Dec 20 '19 13:12 kleisauke

OK, this should be fixed (again) in git master and therefore in 8.9.

Instead of:

image = pyvips.Image.sharpen(image, sigma=1, y2=2, y3=2, m1=0, m2=0.9)

You can just write:

image = image.sharpen(sigma=1, y2=2, y3=2, m1=0, m2=0.9)

I expect you know.

jcupitt avatar Dec 22 '19 12:12 jcupitt

I'm trying to upgrade libvips version to 8.8.4. An error occured in make.

libvips-cpp.so.42 -o .libs/libvips-cpp.so.42.11.3
libtool: link: (cd ".libs" && rm -f "libvips-cpp.so.42" && ln -s "libvips-cpp.so.42.11.3" "libvips-cpp.so.42")
libtool: link: (cd ".libs" && rm -f "libvips-cpp.so" && ln -s "libvips-cpp.so.42.11.3" "libvips-cpp.so")
libtool: link: ar cru .libs/libvips-cpp.a  VImage.o VInterpolate.o VError.o
ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib .libs/libvips-cpp.a
/bin/sed: can't read /usr/lib/x86_64-linux-gnu/libfreetype.la: No such file or directory
libtool:   error: '/usr/lib/x86_64-linux-gnu/libfreetype.la' is not a valid libtool archive
Makefile:620: recipe for target 'libvips-cpp.la' failed

I already have libfreetype installed.

~# apt-get install libfreetype6-dev
~# Reading package lists... Done
~# Building dependency tree       
~# Reading state information... Done
~# libfreetype6-dev is already the newest version (2.9.1-3).
~# 0 upgraded, 0 newly installed, 0 to remove and 81 not upgraded.

build options:

* build options
native win32:                           no
native OS X:                            no
open files in binary mode:              no
enable debug:                           no
enable deprecated library components:   yes
enable docs with gtkdoc:                no
gobject introspection:                  no
enable radiance support:                yes
enable analyze support:                 yes
enable PPM support:                     yes

* optional dependencies
use fftw3 for FFT:                      no
Magick package:                         MagickCore
Magick API version:                     magick7
load with libMagick:                    yes
save with libMagick:                    yes
accelerate loops with orc:              no
  (requires orc-0.4.11 or later)
ICC profile support with lcms:          yes (lcms2)
file import with niftiio:               no
file import with libheif:               no
file import with OpenEXR:               yes
file import with OpenSlide:             no
  (requires openslide-3.3.0 or later)
file import with matio:                 no
PDF import with PDFium                  no
PDF import with poppler-glib:           no
  (requires poppler-glib 0.16.0 or later)
SVG import with librsvg-2.0:            yes
  (requires librsvg-2.0 2.34.0 or later)
zlib:                                   yes
file import with cfitsio:               no
file import/export with libwebp:        no
  (requires libwebp, libwebpmux, libwebpdemux 0.5.0 or later)
text rendering with pangoft2:           yes
file import/export with libpng:         yes (pkg-config libpng >= 1.2.9)
  (requires libpng-1.2.9 or later)
support 8bpp PNG quantisation:          yes
  (requires libimagequant)
file import/export with libtiff:        yes (pkg-config libtiff-4)
file import/export with giflib:         yes (found by search)
file import/export with libjpeg:        yes (pkg-config)
image pyramid export:                   yes
  (requires libgsf-1 1.14.26 or later)
use libexif to load/save JPEG metadata: yes

2h4dl avatar Dec 23 '19 08:12 2h4dl

libvips doesn't ask for libfreetype directly (it asks for pangoft2 for text rendering), so I think this must be a bug in one of the packages that libvips is using.

I would try configuring libvips with --without-pangoft2 and see if that fixes it.

If not, I would then try --without-magick, since ImageMagick has a very long list of dependencies.

You could also experiment with disabling rsvg, since that will pull in text rendering.

jcupitt avatar Dec 23 '19 15:12 jcupitt

I tried with ./configure --without-rsvg and ./configure --without-pangoft2, it's not working.

2h4dl avatar Dec 23 '19 16:12 2h4dl

Try --without-magick too.

If you can make a dockerfile which reproduces this problem, I could check.

jcupitt avatar Dec 23 '19 17:12 jcupitt

--without-magick is working. Will this slow down libvips speed when read, resize, crop or sharpen and so on?

2h4dl avatar Dec 24 '19 02:12 2h4dl

That's great! I guess the imagemagick package has a bug.

Imagemagick is used to load formats like BMP and ICO, and to save GIF, so there's no effect on speed.

jcupitt avatar Dec 24 '19 06:12 jcupitt