Skip to content

Image Pyramid Issues #1875

@imgifty

Description

@imgifty

Hello John,
I have some questions regarding the 'tiffsave' command.
I am working with images ('.png' format), which are labels with colors containing red (255, 0, 0), blue (0, 0, 255), white (255, 255, 255).
To be able to work with those images, I first convert the large '.png' images into tiled pyramidic '.tif' files, using following vips (8.9.1) command:

vips tiffsave label.png --compression deflate --pyramid --tile --region-shrink mode --vips-progress ../labels/label.tif

Here I use the --region-shrink mode, which in my understanding should preserve the label colorings, by picking for each 2x2 pixels, the color, which occurs most often?

Afterwards, I open up the image using openslide-python:

import openslide
slide = openslide.OpenSlide('label.tif')
image = slide.read_region((0, 0), 0, (2000, 2000))
array = np.array(image)
np.unique(array) => [255, 0] # works for level 0

image = slide.read_region((0, 0), 2, (2000, 2000)) # any other level of the pyramid
array = np.array(image)
np.unique(array) => [0, ..., 255] # pixel values seem interpolated (red/blue are mixed at the edges)

Where is this interpolation happening? Is it from openslide, or is my tif conversion faulty?
Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions