Page 1 of 1

Streaming file without write to the disk

Posted: 2015-12-09T01:28:03-07:00
by sangdaono
Hi, i'm trying to crop an image into tiles then upload the tiles into Amazon S3.
I'm doing it on NodeJS with exec function.
Problem: i have to wait until the tile files to be written into the disk then i can upload those files to Amazon S3.
Question: Is is possible to perform upload function right after the tile is cropped or after the all tiles are cropped but not to be written to the disk (Still in memory)? I dont want to write the tile files to the disk, it's kind of slow
This is my code:

Code: Select all

convert <input> -resize 10000x10000 -background transparent -extent 10000x10000 -crop 256x256 -set filename:tile "%[fx:page.x/256]_%[fx:page.y/256]" +repage +adjoin <output>
I'm using IM 6.9.2-5 Q8 x64

Re: Streaming file without write to the disk

Posted: 2015-12-09T20:54:21-07:00
by anthony
It depend on if you can stream a file to amazon.

For example if you have a program that can upload a streams file called "amazon_s3_upload"
then you could stream it like this

convert ...{process image}... png:- | amazon_s3_upload "filename_to_save_on_amazon.png"

The "png:-' just tells Imagemagick to output the file to stdout as a file stream.

How to actually up load a stream is beyond the scope of this forum.. Actually I know it should be posible with things like "wget", "curl", etc. I just have not looked at exactly how it is done, or know what amazon security requirements are.