-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
question: how do i split a tilesheet into multiple grid and merge them together? #357
Comments
Hi @scarf005, You can use
It made 8100 jpeg tiles (90 x 90). I can reassemble with:
|
thank you, but would there be a way to do that using pyvips api? i need to use them in python script i'm writing. |
Sure, it's the same. Eg. (untested): image.dzsave("x", depth="one", tile_size=10, overlap=0) And: 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) (I might have the x and y loops swapped, I always forget which way py list comprehensions do nesting) |
Thank you, it works. however I've encountered thse problems:
could there be a way to save images at just
{ "id": ["player_female", "player_male"], "fg": 144, "rotates": false },
{ "id": ["t_open_air", "t_open_air_rooved"], "bg": 811 },
{ "id": "lighting_hidden", "fg": 1067, "bg": 1067, "rotates": false },
also, your example is correct since for y in (...):
for x in (...):
(...) for example: In [3]: [(y, x) for y in range(2) for x in 'ab']
Out[3]: [(0, 'a'),
(0, 'b'),
(1, 'a'),
(1, 'b')] |
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 an uncompressed zip, which will save a lot of time and disc space, especially on windows. That might be worth checking. You can write to a zip in memory and then use any standard python zip handler to pull tiles out efficiently. Square tiles only, sorry. |
I need to work with a tilesheet, composed of 10x10 tiles.
for example, a 160x2560 image would contain 16x256=4096 tiles.
after that, I need to merge those 4096 10x10 images back into 160x2560 image.
I tried this:
but encountered with:
The text was updated successfully, but these errors were encountered: