From: Joel VanderWerf Date: 2006-11-17T07:09:37+09:00 Subject: Re: Another IO.popen question ... Adam Groves wrote: > Hi, > > I'm wanting to create thumbnails of pdfs in png format and send them off > to be saved. I've come up with this so far: > > IO.popen("curl #{some_uri} | convert -resize 700x700 pdf:-[0] > png:-") {|f| do_something_with_this_file} > > Which works a treat. (In case you didn't know, convert is a command line > tool for ImageMagick). > > What I'd really like to do though is pass on a File object to convert: > > file = File.open("mypdf.pdf") > > IO.popen("#{file} | convert -resize 700x700 pdf:-[0] png:-") {|f| > do_something_with_this_file} would this work? file = "mypdf.pdf" IO.popen("cat #{file} | ...") or simply IO.popen("convert -resize 700x700 #{file} png:-") -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407