-
Notifications
You must be signed in to change notification settings - Fork 10
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
new_from_buffer() VS new_from_file() #10
Comments
I would read the stream into a huge Lua string, then call |
Ok, can know the type of the image, by the first bytes from the buffer, so as not to read the entire buffer, if the first bytes are not correct? |
It varies with the image format, but the first 1000 bytes should be enough, and not take too long. |
Thank! Through vips-server.socket
vips-server@ .service
vips-server.lua while true do
local buff = io.read()
print('ECHO: ' .. buff)
io.flush()
end If this is interesting, then we can put an example. |
Sure, it sounds fun. Open a pull request with your example and I'll add it. |
Oк, later when I'm free I will make an example. Maybe more interesting |
I have one more question ) We receive traffic in chunks of 9 kb, we can process images also in chunks? Traffic speed Process image speed If we parallels in the process of obtaining chunks and processing chunks, then Is it possible to process images with chunks? |
Unfortunately not. This has been discussed quite a bit, but for now you need to read the entire image to a string, then start vips on it. There is a branch that adds true streaming, but it's quite old now. Maybe we should look at this again. |
The most recent discussion around this is here, fwiw: |
You can still overlap read and process, you just need to buffer a couple of images in memory. You can have one thread reading into buffer1, and another thread processing from buffer2. When an image has been completely read, check that the processing thread has finished on buffer2, then swap the buffers and start reading and processing again. I've not tried threading in Lua, does it support this kind of thing? |
I have not tried threads in Lau, but i will try. I thought, there is an excellent and popular web server It has a built-in very popular module for image processing by If you make If you're interested in here is a guide Thank, i will try threads in Lau. |
Yes, a nginx module sounds fun. I don't have time though :( |
Nginx module can be as HTTP middleware, that gets REST requests from browsers or web backend to image processing, then node-sharp, php-vips, and others, will not be much needed, Nginx is 80% servers. I hope you will have lot free time :) |
Well, you could have a go, if you like. It sounds like it could be an easy way to get at least a little famous :) |
I do not know C lang :) I also know how to use and customize many functional in Nginx to cover many to use-case. In this I can help, if development begins. |
Hello.
The lua worker, read bytes from stream pipe, we know length buffer, but not know image type.
How best to do, create an image object,
new_from_buffer(buff)
orfile.write(buff)
andnew_from_file(name)
?Thank.
The text was updated successfully, but these errors were encountered: