Streaming file without write to the disk

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
sangdaono
Posts: 3
Joined: 2015-11-16T18:23:19-07:00
Authentication code: 1151

Streaming file without write to the disk

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Streaming file without write to the disk

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply