Libvips: Vignette vips corrompue

Créé le 4 sept. 2020  ·  3Commentaires  ·  Source: libvips/libvips

Je vois vipsthumbnail produire des vignettes valides mais manifestement incorrectes pour certains fichiers SVS. Curieusement, cela ne semble s'appliquer que lors de l'exécution dans un conteneur Alpine. L'exécution de la même commande avec la même version vips sur OSX fonctionne correctement.

Voici un exemple de vignette incorrecte (rectangle bleu ajouté par mes soins pour masquer les données médicales). Les zones blanches directement au-dessus et à gauche du rectangle sont incorrectes et ne correspondent pas à l'image d'origine :

image

Malheureusement, je ne peux pas fournir l'image originale ici.

Reproduire
Fichier Docker :

FROM openjdk:14-alpine

ARG OPENSLIDE_VERSION=3.4.1
ARG VIPS_VERSION=8.10.0

WORKDIR /root

RUN apk add --virtual build-deps build-base zlib-dev libpng-dev jpeg-dev tiff-dev openjpeg-dev gdk-pixbuf-dev \
    sqlite-dev cairo-dev libxml2-dev libgsf-dev libexif-dev \
    # Download, build, and install Openslide
    && wget https://github.com/openslide/openslide/releases/download/v$OPENSLIDE_VERSION/openslide-$OPENSLIDE_VERSION.tar.gz \
    && tar xzf openslide-$OPENSLIDE_VERSION.tar.gz \
    && cd openslide-$OPENSLIDE_VERSION && ./configure && make && make install && cd .. && rm -rf openslide-$OPENSLIDE_VERSION* \
    # Download, build, and install Vips
    && wget https://github.com/libvips/libvips/releases/download/v$VIPS_VERSION/vips-$VIPS_VERSION.tar.gz \
    && tar xzf vips-$VIPS_VERSION.tar.gz \
    && cd vips-$VIPS_VERSION && ./configure && make V=0 && make && make install && cd .. && rm -rf vips-$VIPS_VERSION* \
    # Cleanup build deps
    && apk del build-deps \
    # Add runtime deps
    && apk add --virtual run-deps zlib libpng jpeg tiff openjpeg gdk-pixbuf sqlite-libs cairo libxml2 libgsf libexif

ENTRYPOINT "/bin/sh"
  1. docker build -t weird_thumbnail:latest .
  2. docker run -it weird_thumbnail:latest
  3. Copier svs dans le conteneur Docker
  4. vipsthumbnail --size=512 -o %s-thumbnail.jpg weird_thumbnail.svs

Contexte supplémentaire
Je ne sais pas comment fournir suffisamment d'informations utiles sans l'image d'origine. Peut-être que je pourrais envoyer un lien de téléchargement par e-mail (mais je devrai d'abord vérifier si c'est possible). Voici les vidages du cache des opérations :

Travailler sur OSX (produit une bonne vignette) :

Operation cache:
0x7fcf7805a4f0 - openslideload("weird_thumbnail.svs",((VipsImage*) 0x7fcf7881b1b0),nickname="openslideload",description="load file with OpenSlide",flags=((VipsForeignFlags) VIPS_FOREIGN_PARTIAL))
0x7fcf78076ff0 - embed(((VipsImage*) 0x7fcf7881bca0),((VipsImage*) 0x7fcf7885c320),0,0,2149,669,nickname="embed",description="embed an image in a larger image",extend=((VipsExtend) VIPS_EXTEND_COPY))
0x7fcf78092cb0 - resize(((VipsImage*) 0x7fcf7881b660),((VipsImage*) 0x7fcf7881b980),0.238472,nickname="resize",description="resize an image",vscale=0.238472)
0x7fcf78065130 - colourspace(((VipsImage*) 0x7fcf7881b340),((VipsImage*) 0x7fcf7881b4d0),((VipsInterpretation) VIPS_INTERPRETATION_sRGB),nickname="colourspace",description="convert to a new colorspace")
0x7fcf78091200 - reduceh(((VipsImage*) 0x7fcf7885c4b0),((VipsImage*) 0x7fcf7885caf0),1.000000,2.096680,nickname="reduceh",description="shrink an image horizontally",kernel=((VipsKernel) VIPS_KERNEL_LANCZOS3))
0x7fcf78097650 - unpremultiply(((VipsImage*) 0x7fcf7881b980),((VipsImage*) 0x7fcf78863020),nickname="unpremultiply",description="unpremultiply image alpha")
0x7fcf780a8200 - cast(((VipsImage*) 0x7fcf78863980),((VipsImage*) 0x7fcf78863ca0),((VipsBandFormat) VIPS_FORMAT_UCHAR),nickname="cast",description="cast an image")
0x7fcf78078960 - shrinkh(((VipsImage*) 0x7fcf7881bca0),((VipsImage*) 0x7fcf7885c190),1,2,nickname="shrinkh",description="shrink an image horizontally")
0x7fcf780a5d70 - flatten(((VipsImage*) 0x7fcf788637f0),((VipsImage*) 0x7fcf78863980),nickname="flatten",background=0 ,description="flatten alpha out of an image")
0x7fcf76c197c0 - tilecache(((VipsImage*) 0x7fcf788694d0),((VipsImage*) 0x7fcf78869660),nickname="tilecache",description="cache an image as a set of tiles",tile-width=240,tile-height=240,max-tiles=22,threaded=TRUE)
0x7fcf78073f80 - shrinkv(((VipsImage*) 0x7fcf7881bb10),((VipsImage*) 0x7fcf7881bca0),1,2,nickname="shrinkv",description="shrink an image vertically")
0x7fcf780a0d90 - colourspace(((VipsImage*) 0x7fcf78863660),((VipsImage*) 0x7fcf788637f0),((VipsInterpretation) VIPS_INTERPRETATION_sRGB),nickname="colourspace",description="convert to a new colorspace")
0x7fcf7809bee0 - cast(((VipsImage*) 0x7fcf78863020),((VipsImage*) 0x7fcf78863340),((VipsBandFormat) VIPS_FORMAT_UCHAR),nickname="cast",description="cast an image")
0x7fcf78080e80 - embed(((VipsImage*) 0x7fcf7885c640),((VipsImage*) 0x7fcf7885c7d0),0,5,1074,682,nickname="embed",description="embed an image in a larger image",extend=((VipsExtend) VIPS_EXTEND_COPY))
0x7fcf780703c0 - embed(((VipsImage*) 0x7fcf7881bb10),((VipsImage*) 0x7fcf7881be30),0,0,2147,1338,nickname="embed",description="embed an image in a larger image",extend=((VipsExtend) VIPS_EXTEND_COPY))
0x7fcf7808f7a0 - embed(((VipsImage*) 0x7fcf7885cc80),((VipsImage*) 0x7fcf7885ce10),5,0,1087,319,nickname="embed",description="embed an image in a larger image",extend=((VipsExtend) VIPS_EXTEND_COPY))
0x7fcf780848e0 - reducev(((VipsImage*) 0x7fcf7885c190),((VipsImage*) 0x7fcf7885c4b0),1.000000,2.096680,nickname="reducev",description="shrink an image vertically",kernel=((VipsKernel) VIPS_KERNEL_LANCZOS3))
0x7fcf78069c00 - premultiply(((VipsImage*) 0x7fcf7881b4d0),((VipsImage*) 0x7fcf7881b660),nickname="premultiply",description="premultiply image alpha")
0x7fcf780629d0 - openslideload("weird_thumbnail.svs",((VipsImage*) 0x7fcf7881b340),nickname="openslideload",description="load file with OpenSlide",level=3,flags=((VipsForeignFlags) VIPS_FOREIGN_PARTIAL),access=((VipsAccess) VIPS_ACCESS_SEQUENTIAL))

Ne fonctionne pas sur le conteneur Alpine Docker (produit une mauvaise vignette):

vipsthumbnail --vips-cache-dump --size=512 -o %s-thumbnail.jpg weird_thumbnail.svs
Operation cache:
0x5617a580b220 - reducev(((VipsImage*) 0x5617a57e51a0),((VipsImage*) 0x5617a57e54c0),1.000000,2.096680,nickname="reducev",description="shrink an image vertically",kernel=((VipsKernel) VIPS_KERNEL_LANCZOS3))
0x5617a57f6340 - embed(((VipsImage*) 0x5617a5731c90),((VipsImage*) 0x5617a57e5330),0,0,2149,669,nickname="embed",description="embed an image in a larger image",extend=((VipsExtend) VIPS_EXTEND_COPY))
0x5617a57f8b80 - shrinkh(((VipsImage*) 0x5617a5731c90),((VipsImage*) 0x5617a57e51a0),1,2,nickname="shrinkh",description="shrink an image horizontally")
0x5617a57bc760 - openslideload("weird_thumbnail.svs",((VipsImage*) 0x5617a57311a0),nickname="openslideload",description="load file with OpenSlide",flags=((VipsForeignFlags) VIPS_FOREIGN_PARTIAL))
0x5617a5820ee0 - resize(((VipsImage*) 0x5617a5731650),((VipsImage*) 0x5617a5731970),0.238472,nickname="resize",description="resize an image",vscale=0.238472)
0x5617a583af60 - colourspace(((VipsImage*) 0x5617a5822640),((VipsImage*) 0x5617a58227d0),((VipsInterpretation) VIPS_INTERPRETATION_sRGB),nickname="colourspace",description="convert to a new colorspace")
0x5617a5842fe0 - flatten(((VipsImage*) 0x5617a58227d0),((VipsImage*) 0x5617a5822960),nickname="flatten",background=0 ,description="flatten alpha out of an image")
0x5617a5831920 - cast(((VipsImage*) 0x5617a5822000),((VipsImage*) 0x5617a5822320),((VipsBandFormat) VIPS_FORMAT_UCHAR),nickname="cast",description="cast an image")
0x5617a57f20c0 - shrinkv(((VipsImage*) 0x5617a5731b00),((VipsImage*) 0x5617a5731c90),1,2,nickname="shrinkv",description="shrink an image vertically")
0x5617a581e840 - reduceh(((VipsImage*) 0x5617a57e54c0),((VipsImage*) 0x5617a57e5b00),1.000000,2.096680,nickname="reduceh",description="shrink an image horizontally",kernel=((VipsKernel) VIPS_KERNEL_LANCZOS3))
0x5617a57ec840 - embed(((VipsImage*) 0x5617a5731b00),((VipsImage*) 0x5617a5731e20),0,0,2147,1338,nickname="embed",description="embed an image in a larger image",extend=((VipsExtend) VIPS_EXTEND_COPY))
0x5617a581c200 - embed(((VipsImage*) 0x5617a57e5c90),((VipsImage*) 0x5617a57e5e20),5,0,1087,319,nickname="embed",description="embed an image in a larger image",extend=((VipsExtend) VIPS_EXTEND_COPY))
0x5617a5805d00 - embed(((VipsImage*) 0x5617a57e5650),((VipsImage*) 0x5617a57e57e0),0,5,1074,682,nickname="embed",description="embed an image in a larger image",extend=((VipsExtend) VIPS_EXTEND_COPY))
0x5617a57df480 - premultiply(((VipsImage*) 0x5617a57314c0),((VipsImage*) 0x5617a5731650),nickname="premultiply",description="premultiply image alpha")
0x5617a582ace0 - unpremultiply(((VipsImage*) 0x5617a5731970),((VipsImage*) 0x5617a5822000),nickname="unpremultiply",description="unpremultiply image alpha")
0x5617a57ca120 - openslideload("weird_thumbnail.svs",((VipsImage*) 0x5617a5731330),nickname="openslideload",description="load file with OpenSlide",level=3,flags=((VipsForeignFlags) VIPS_FOREIGN_PARTIAL),access=((VipsAccess) VIPS_ACCESS_SEQUENTIAL))
0x5617a57d79a0 - colourspace(((VipsImage*) 0x5617a5731330),((VipsImage*) 0x5617a57314c0),((VipsInterpretation) VIPS_INTERPRETATION_sRGB),nickname="colourspace",description="convert to a new colorspace")
0x5617a5847b20 - cast(((VipsImage*) 0x5617a5822960),((VipsImage*) 0x5617a5822c80),((VipsBandFormat) VIPS_FORMAT_UCHAR),nickname="cast",description="cast an image")
0x5617a5cfdf40 - tilecache(((VipsImage*) 0x5617a58444b0),((VipsImage*) 0x5617a5844640),nickname="tilecache",description="cache an image as a set of tiles",tile-width=240,tile-height=240,max-tiles=22,threaded=TRUE)
question

Commentaire le plus utile

Kleis a trouvé le bogue, pas moi! Mais je suis content que ça marche.

Tous les 3 commentaires

Salut @adamu ,

Il semble que vous ayez été piqué par ce bug :

https://github.com/libvips/libvips/issues/1401

tldr : mettez à jour pixman vers la 0.40 ou une version ultérieure.

@jcupitt tu es une légende ! Je l'ai essayé sur une image Alpine 3.12 qui a pixman 0.40 dans le gestionnaire de paquets, et la vignette était bonne 🎉

Malheureusement, l'image JDK 14 que j'utilise est sur Alpine 3.10 qui n'a que pixman 0.38 disponible, je vais donc devoir contourner cela.

Merci pour l'aide rapide comme toujours!

Kleis a trouvé le bogue, pas moi! Mais je suis content que ça marche.

Cette page vous a été utile?
0 / 5 - 0 notes