Comments (10)
Hello @HackersSpirit,
Sorry, I don't think this will be possible. Windows has a hard limit of 2000 open files per process, and you can't change it. 15 * 153 is 2295, so you won't be able to open all of your input images. You will need to assemble the image in sections, or change your platform.
You seem to be failing earlier, which is strange. Perhaps you are opening other files elsewhere? You would need to post a sample program for me to test.
from pyvips.
@jcupitt : thanks for the clear explanation on the windows side.
Can you please elaborate on assembling the images in a section part
from pyvips.
Just assemble the first 1000 to a temporary file, then the second, then the third. Finally, join the three parts.
from pyvips.
@jcupitt : Just for clarification.
I have to create 3 files consisting name of 1000 images each and then join them.
Also joining them in separate files won't create any issues :)
from pyvips.
I don't know any details about what you are doing, but that's the general idea, yes. You'll need to experiment a bit.
from pyvips.
@jcupitt : OK thanks 👍
from pyvips.
#Program Starts
import os
import pyvips
# natsort helps with sorting the list logically
from natsort import natsorted
source = r"C:\\Users\\thermo\\Desktop\\ScanSample\\input\\"
output = r"C:\\Users\\thermo\\Desktop\\ScanSample\\output\\"
save_to = output + 'final' + '.tif'
# define list of pictures we are going to get from folder
list_of_pictures = []
# get the
for x in os.listdir(source):
list_of_pictures.append(source + x)
# list_of_pictures now contains all the images from folder including full path
# since os.listdir will not guarantee proper order of files we use natsorted to do it
list_of_pictures = natsorted(list_of_pictures)
array_images = []
image = None
# lets create array of the images for joining, using sequential so it use less ram
for i in list_of_pictures:
tile = pyvips.Image.new_from_file(i, access="sequential")
array_images.append(tile)
# Join them, across is how many pictures there be next to each other, so i just counted all pictures in array with len
out = pyvips.Image.arrayjoin(array_images, across=len(list_of_pictures))
# write it out to file....
out.write_to_file(save_to, Q=95, compression="lzw", bigtiff=True)
#Program Completes
Hi @jcupitt : Here is one of the sample program which reads the imarges and join them.
The program returns the above error when number of file exceed.
Can you please provide sample of what you have mentioned in the comment above:
Just assemble the first 1000 to a temporary file, then the second, then the third. Finally, join the three parts.
from pyvips.
Run the program to insert the first 1000 images and save the result to a temporary file in TIFF format.
Now run a second program that loads the TIFF from above as the background, then inserts another 1000 images on top and saves to s second temporary file.
Finally, run the program again, loading the second temporary as a background and pasting the final 1000 images on top. Save that to your output file and delete the two temporary files.
from pyvips.
Thanks for the clarifying the steps. 👍
One more thing instead of running the above process sequentially can we run it parallely and finally merge temp images one by one.
from pyvips.
Maybe. It depends if your images overlap.
from pyvips.
Related Issues (20)
- Reading in image a second time breaks on qptiff file HOT 6
- Documentation link to conda package HOT 1
- Create svs file with image pyramid, label and macro in pyvips? HOT 4
- Image merge stitch HOT 2
- `addalpha` has different behaviour compared to C HOT 1
- Error installing pyvips on Mac OS HOT 15
- draw_rect fill error HOT 2
- creating tiles of 16bit multiband (4 band) tiff image leaves black canvas HOT 4
- class "jxlsave" not found HOT 9
- Assertion failed: sp->cinfo.comm.is_decompressor HOT 3
- Help installing pyvips for jupyter HOT 5
- `TIFFFillTile: Read error` when writing a TIFF file on a per-tile basis. HOT 2
- Thumbnail creation taking too long HOT 2
- Unable to save images when certain combinations of them are resize()'d HOT 7
- pyvips stats HOT 1
- How does composite() merge colors? HOT 8
- ICC profiles from file stream in pyvips HOT 5
- Why is error 0x7f? HOT 1
- Can libvips' stack size be modified using pyvips? HOT 6
- Unable to convert multiband image to srgb HOT 9
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 pyvips.