Libvips: Beschädigtes Vipsthumbnail-Bild

Erstellt am 4. Sept. 2020  ·  3Kommentare  ·  Quelle: libvips/libvips

Ich sehe, dass vipsthumbnail gültige, aber offensichtlich falsche Miniaturansichten für einige SVS-Dateien erzeugt. Seltsamerweise scheint es nur beim Laufen in einem Alpine-Container zu gelten. Das Ausführen desselben Befehls mit derselben vips-Version unter OSX funktioniert einwandfrei.

Hier ist ein Beispiel für ein falsches Thumbnail (blaues Rechteck von mir hinzugefügt, um medizinische Daten auszublenden). Die weißen Bereiche direkt über und links vom Rechteck sind falsch und nicht im Originalbild:

image

Das Originalbild kann ich hier leider nicht zur Verfügung stellen.

Fortpflanzen
Docker-Datei:

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. svs in den Docker-Container kopieren
  4. vipsthumbnail --size=512 -o %s-thumbnail.jpg weird_thumbnail.svs

Zusätzlicher Kontext
Ich bin mir nicht sicher, wie ich ohne das Originalbild genügend nützliche Informationen bereitstellen kann. Vielleicht könnte ich einen Download-Link per E-Mail senden (aber ich muss zuerst prüfen, ob das möglich ist). Hier sind die Vorgangs-Cache-Dumps:

Arbeiten unter OSX (erzeugt gutes Thumbnail):

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))

Funktioniert nicht auf dem Alpine Docker-Container (erzeugt schlechte Miniaturansicht):

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

Hilfreichster Kommentar

Kleis hat den Fehler gefunden, nicht ich! Aber ich bin froh, dass es funktioniert.

Alle 3 Kommentare

Hallo @adamu ,

Es sieht so aus, als ob Sie von diesem Fehler gebissen wurden:

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

tldr: aktualisiere pixman auf 0.40 oder höher.

@jcupitt du bist eine Legende! Versuchte es auf einem Alpine 3.12-Bild, das Pixman 0.40 im Paketmanager hat, und das Vorschaubild war in Ordnung 🎉

Leider ist das JDK 14-Image, das ich verwende, auf Alpine 3.10, wo nur Pixman 0.38 verfügbar ist, also muss ich das umgehen.

Vielen Dank für die schnelle Hilfe wie immer!

Kleis hat den Fehler gefunden, nicht ich! Aber ich bin froh, dass es funktioniert.

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen

Verwandte Themen

harukizaemon picture harukizaemon  ·  4Kommentare

revathi-murali picture revathi-murali  ·  3Kommentare

helloqhx picture helloqhx  ·  3Kommentare

solisoft picture solisoft  ·  3Kommentare

nattfodd picture nattfodd  ·  5Kommentare