Giter VIP home page Giter VIP logo

Comments (10)

jcupitt avatar jcupitt commented on July 19, 2024

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.

HackersSpirit avatar HackersSpirit commented on July 19, 2024

@jcupitt : thanks for the clear explanation on the windows side.
Can you please elaborate on assembling the images in a section part

from pyvips.

jcupitt avatar jcupitt commented on July 19, 2024

Just assemble the first 1000 to a temporary file, then the second, then the third. Finally, join the three parts.

from pyvips.

HackersSpirit avatar HackersSpirit commented on July 19, 2024

@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.

jcupitt avatar jcupitt commented on July 19, 2024

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.

HackersSpirit avatar HackersSpirit commented on July 19, 2024

@jcupitt : OK thanks 👍

from pyvips.

HackersSpirit avatar HackersSpirit commented on July 19, 2024
#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.

jcupitt avatar jcupitt commented on July 19, 2024

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.

HackersSpirit avatar HackersSpirit commented on July 19, 2024

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.

jcupitt avatar jcupitt commented on July 19, 2024

Maybe. It depends if your images overlap.

from pyvips.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.