Comments (8)
Hi @knoppmyth,
Oh dear, that sounds bad. I'll investigate later this week.
from libvips.
I downloaded the tarball, thanks.
I was able to reproduce this in ubuntu 23.10 with libvips master and this prog:
#!/usr/bin/env python3
import sys
import pyvips
input_directory = sys.argv[1]
output_file = sys.argv[2]
tiles_across = int(sys.argv[3])
tiles_down = int(sys.argv[4])
print(f"loading {tiles_across * tiles_down} tiles ...")
tiles = [pyvips.Image.new_from_file(f"{input_directory}/{x}_{y}.jpg",
access="sequential")
for y in range(tiles_down)
for x in range(tiles_across)]
joined = pyvips.Image.arrayjoin(tiles, across=tiles_across)
print("saving ...")
joined.write_to_file(output_file)
It works if I run it like this:
john@banana ~/x/tmp/images/70946.svs/tiles/orig/orig_files $ ~/try/arrayjoin2.py 0 ~/x.tif[compression=jpeg,tile] 366 176
loading 64416 tiles ...
saving ...
john@banana ~/x/tmp/images/70946.svs/tiles/orig/orig_files $
But fails if I run:
john@banana ~/x/tmp/images/70946.svs/tiles/orig/orig_files $ ~/try/arrayjoin2.py 0 ~/x.tif[compression=jpeg,tile] 366 177
loading 64782 tiles ...
(process:181986): GLib-ERROR **: 15:30:25.997: ../../../glib/gmem.c:136: failed to allocate 7044 bytes
Trace/breakpoint trap (core dumped)
john@banana ~/x/tmp/images/70946.svs/tiles/orig/orig_files $
That's suspiciously close to 2^16. I wonder if it's overflowing 16 bits for a file descriptor somewhere?
from libvips.
Thanks @jcupitt
from libvips.
I tried in C and it also fails, so it's not python:
/* compile with:
*
* gcc -g -Wall try345.c `pkg-config vips --cflags --libs`
*/
#include <vips/vips.h>
int
main(int argc, char **argv)
{
if (VIPS_INIT(argv[0]))
vips_error_exit(NULL);
if (argc != 5)
vips_error_exit("usage: %s base-dir outfile tiles-across tiles-down",
argv[0]);
VipsObject *context = VIPS_OBJECT(vips_image_new());
int tiles_across = atoi(argv[3]);
int tiles_down = atoi(argv[4]);
int n_tiles = tiles_across * tiles_down;
VipsImage **tiles = (VipsImage **)
vips_object_local_array(context, n_tiles);
printf("loading %d tiles ...\n", n_tiles);
for (int y = 0; y < tiles_down; y++)
for (int x = 0; x < tiles_across; x++) {
int i = x + y * tiles_across;
char filename[256];
snprintf(filename, 256, "%s/%d_%d.jpg", argv[1], x, y);
if (!(tiles[i] = vips_image_new_from_file(filename,
"access", VIPS_ACCESS_SEQUENTIAL,
NULL)))
vips_error_exit(NULL);
}
printf("assembling ...\n");
VipsImage *image;
if (vips_arrayjoin(tiles, &image, n_tiles, "across", tiles_across, NULL))
vips_error_exit(NULL);
printf("saving ...\n");
if (vips_image_write_to_file(image, argv[2], NULL))
vips_error_exit(NULL);
return 0;
}
I see:
john@banana ~/x/tmp/images/70946.svs/tiles/orig/orig_files $ ~/try/a.out 0 ~/x.tif[compression=jpeg,tile] 366 175
loading 64050 tiles ...
assembling ...
saving ...
john@banana ~/x/tmp/images/70946.svs/tiles/orig/orig_files $
But 176 fails.
from libvips.
It could be a stack overflow, I guess, I'll check.
from libvips.
@jcupitt Thanks for taking a deeper look.
from libvips.
Hi! @jcupitt I'm having the same issue with 8.15.2, what is the status? I was going to see if I can spot the issue but given this issue is some months old maybe someone is already working on it.
from libvips.
Sorry, I've been distracted on other projects. Please have a go if you have time!
from libvips.
Related Issues (20)
- Row sums from vips_project do not necessarily give the same value like summing img(i,j) along i HOT 2
- Looks like 8.15.2 tag is wrong? HOT 1
- vips 8.15.2 failed to build with latest xcode HOT 11
- HDR AVIF to HEIC (hdr) HOT 4
- Feature request: Support SDR→HDR via RTX HDR (upmapping / inverse tone mapping)
- AVIF with bitdepth 10 or 12 crashes
- Add nclx->icc colour management to heifload HOT 24
- Segmentation fault when performing very large number of operations HOT 1
- Subsample mode not working with jpegli HOT 4
- Add target write to `rawsave` HOT 2
- Cannot link to proper libraries on Windows 11 Pro. HOT 1
- Thumbnail/Resize removes color on Alpine HOT 1
- Add support for fractional tiff values (eg. 10 or 12 bits per pixel) HOT 6
- Include JXL as Foreign TIFF Compression HOT 3
- The position of "#include <vips/vips8>" matters. HOT 2
- distance transform HOT 1
- CMYK -> SRGB conversion results in color change
- vips dzsave crashes when saving tiff to avif HOT 3
- OSError: [Errno 30] Read-only file system: '/my' HOT 1
- Error using vips-cpp statically with msvc
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libvips.