John Cupitt
John Cupitt
Hi again, this seems to work: ```php #!/usr/bin/env php
It's really easy -- if you do: ```php $outline->divide(255) ``` Your outline image is now 0 - 1 for black to white. To make the black lines in the outlines...
Maybe (untested): ```php // pixels where r == g == b $grey_mask = $image[0]->equal($image[1])->equal(image[2]); // pixels where r > 200 $bright_mask = $image[0]->more(200); // AND them together $mask = $grey_mask->andimage($bright_mask);...
I don't think that will work, the code I posted is probably the best solution.
Oh duh, sorry. Of course it should be: ```php $grey_mask = $image[0]->equal($image[1])->andimage($image[1]->equal($image[2])); ``` (also untested)
Sorry, could you explain what you mean in more detail? Do you want to compute the number of pixels two masks have in common?
You can write something to count the non-zero pixels in an image as: ```php function count_set($image) { $avg = $image->notequal(0)->avg(); return $image->width * $image->height * $avg / 255.0; } ```...
Hi @scarf005, You can use `dzsave` to split an image up, and `arrayjoin` to reassemble it. For example: ``` $ vips dzsave ../astronauts.png x --depth one --tile-size 10 --overlap 0...
Sure, it's the same. Eg. (untested): ```python image.dzsave("x", depth="one", tile_size=10, overlap=0) ``` And: ```python tiles = [pyvips.Image.new_from_file(f"{x}_{y}.jpeg") for y in range(down) for x in range(across)] image = pyvips.Image.arrayjoin(tiles, across=90) ```...
It supports deepzoom, zoomify and gmaps naming convention, so z/x_y, nnn/z_x_y and z/y/x, but that's it. You'll need to run a second pass to rename the files. It can write...