0
echo file.jpg | gm convert @- -interlace Line -resize 300x300^\> - > /tmp/file_r.jpg

is not working..

but if i have file filename.txt with content as file.jpg

gm convert @filename.txt -interlace Line -resize 300x300^\> - > /tmp/file_r.jpg

works.

Any idea why

user2106480
  • 181
  • 1
  • 5

1 Answers1

0

Try something like this:

echo file.jpg | { read filename; gm convert "$filename" -interlace Line -resize 300x300^\> - > file_r.jpg; }

Mind the braces. More on reading variables from stdin here.

Community
  • 1
  • 1
  • I dont actually run this is shell. For me the gm processes is spawned already in nodejs. I can only communicate to it using streams. Because of some limits on the number of open file handlers, I don't want to stream the contents of the file to this process. So I was thinking of some ways of streaming the filename and make the gm process open and load the file.. – user2106480 Jul 15 '14 at 13:52
  • It's hard to imagine what's going on there. Do you have any code sample/gist for that maybe? – pwlmaciejewski Jul 15 '14 at 17:13