libvips / libvips

A fast image processing library with low memory needs.
https://libvips.github.io/libvips/
GNU Lesser General Public License v2.1
9.56k stars 665 forks source link

Different behavior of icc_transform() on Windows and Ubuntu #2884

Closed mnasan closed 2 years ago

mnasan commented 2 years ago

Hello,

Thank you for this amazing library. I installed libvips v.8.12.2 on both windows (for testing) and on Ubuntu 18.04 (for regular use). I run the same command on both CMD and BASH. However, I got different results: On windows CMD: vips icc_transform c:\mri\NAS\temp\101-048.svs c:\mri\NAS\temp\101-048.tif srgb --embedded On Ubuntu terminal: vips icc_transform 101-048.svs 101-048.tif srgb --embedded The transformation of the color space is correct on windows, with a (.tif) result image of 24 bit depth according to third-party viewer software. However, on Ubuntu, I got a (.tif) image which has the same color of the original (no color transformation had been performed) and an image depth of 32 bit. Knowing that I installed vips from binaries for Windows but I built it from source on Ubuntu. Also, no error on warning was declared. ./configure:

## Build options
enable debug:                           no
enable deprecated library components:   yes
enable modules:                         no
enable C docs with gtkdoc:              no
 (requires gtk-doc 1.14 or later)
enable C++ docs with doxygen:           no
gobject introspection:                  yes
 (requires gobject-introspection 1.30 or later)
RAD load/save:                          yes
Analyze7 load/save:                     yes
PPM load/save:                          yes
GIF load:                               yes

## Optional dependencies
use fftw3 for FFT:                      yes
accelerate loops with orc:              yes
 (requires orc-0.4.11 or later)
ICC profile support with lcms:          yes (lcms2)
zlib:                                   yes
text rendering with pangocairo:         yes
font file support with fontconfig:      yes
EXIF metadata support with libexif:     yes

## File format support
JPEG load/save with libjpeg:            yes (pkg-config)
JXL load/save with libjxl:              no (dynamic module: no)
JPEG2000 load/save with libopenjp2:     no
 (requires libopenjp2 2.4 or later)
PNG load with libspng:                  no
 (requires libspng-0.6 or later)
PNG load/save with libpng:              yes (pkg-config libpng >= 1.2.9)
 (requires libpng-1.2.9 or later)
quantisation to 8 bit:                  no
 (requires libimagequant)
TIFF load/save with libtiff:            yes (pkg-config libtiff-4)
image pyramid save:                     yes
 (requires libgsf-1 1.14.26 or later)
HEIC/AVIF load/save with libheif:       no (dynamic module: no)
WebP load/save with libwebp:            yes
 (requires libwebp, libwebpmux, libwebpdemux 0.6.0 or later)
PDF load with PDFium:                   no
PDF load with poppler-glib:             yes (dynamic module: no)
 (requires poppler-glib 0.16.0 or later)
SVG load with librsvg-2.0:              yes
 (requires librsvg-2.0 2.34.0 or later)
EXR load with OpenEXR:                  yes
OpenSlide support:                      yes (dynamic module: no)
 (requires openslide-3.3.0 or later)
Matlab load with matio:                 yes
NIfTI load/save with niftiio:           no
FITS load/save with cfitsio:            yes
GIF save with cgif:                     no
 (requires cgif, libimagequant)
Magick package:                         MagickCore (dynamic module: no)
Magick major API version:               magick6
load with libMagickCore:                yes
save with libMagickCore:                yes

Am I missing something during the installation? Are the parameters are correct? Any help or idea is appreciated.

Thank you

jcupitt commented 2 years ago

Hello @mnasan,

I think it's probably openslide --- on linux, you are loading the SVS with openslide, but on window it'll be using regular libtiff (openslide is only included in the -all binary). Openslide does not support ICC profiles, so the linux build is not detecting the slide profile.

Either build without openslide on linux (you'll lose support for other slide formats), or perhaps use something like python to pull the profile from the SVS and apply it yourself.