Page 1 of 2

Calling stream.exe from another program

Posted: 2012-06-01T04:01:53-07:00
by mrdo
hi there,

bit of a long shot this, but i'm calling imagemagick from within a visual studio 2010 application on windows by simply calling either convert.exe or stream.exe and passing in parameters.

convert works perfectly but when i call stream.exe i have problems.

when i call the command via a command prompt i get a 300KB jpg as expected but from within visual studio, the stream window opens but stays open indefinitely. a jpg of 4160KB has been created that reports itself as a PCD file with the incorrect extension and is corrupt.

am i misinterpreting how stream.exe works or could i be doing something else wrong ?

the command that i'm running is the following :

D:\PROGRA~2\IMAGEM~1.6-Q\stream.exe -map rgb -storage-type char -extract 689x2067+0+0 "D:\Thumbnails\Test\Preview\TIFF\16_26-_19_log_LOG_VEL_233872468_rotated.jpg" - | convert -depth 8 -size 689x2067 rgb:- "D:\Thumbnails\Test\Preview\TIFF\16_26-_19_log_LOG_VEL_233872468_header.jpg"

thanks in advance

Re: Calling stream.exe from another program

Posted: 2012-06-01T08:17:37-07:00
by tomriddle
Try running the stream.exe command line on it's own, that way you might see if it has returned any errors. I've checked on the syntax of the command and it appears fine but, who knows, something else is to blame. Maybe it's the original image?

Re: Calling stream.exe from another program

Posted: 2012-06-01T08:51:42-07:00
by mrdo
hi there,

thanks for taking the time to reply.

running the command direct from the command line produces the expected result so i'm not sure what difference running it as a process through visual studio makes.

as it is, i can't identify the problem - at least if nothing happens i know that there's a problem with my syntax but a file is created, unfortunately it's unreadable ...

thanks again

Re: Calling stream.exe from another program

Posted: 2012-06-12T09:16:46-07:00
by mrdo
does anyone else have any idea as to why my conversion is failing ?

i can successfully run the conversion from a command prompt but not from within a process called by visual studio.
the file is 308KB from the command prompt but always gets stuck at 4160KB when called from VS.

when i try and open the VS 4160KB file, i get the following message in irfanview :

Warning !
The file: "D:\Thumbnails\Test\Preview\TIFF\16_26-_19_log_LOG_VEL_233872468_header.jpg" is a PCD file with incorrect extension !
Rename ?

any ideas ?

Re: Calling stream.exe from another program

Posted: 2012-06-12T10:42:26-07:00
by fmw42
try adding the full path to convert in your convert command. many scripting systems do not know where IM resides. this occurs often when using PHP if not set up to know where IM resides. Sorry I know little about windows.

Re: Calling stream.exe from another program

Posted: 2012-06-12T10:57:51-07:00
by mrdo
hi there,

thanks for the suggestion.

i'm passing in the full path to stream.exe (see code above) and an image is being created but the process never completes - i'm assuming that nothing would be created if the process couldn't find stream.exe ?

thanks again ...

Re: Calling stream.exe from another program

Posted: 2012-06-12T11:27:36-07:00
by fmw42
mrdo wrote:hi there,

thanks for the suggestion.

i'm passing in the full path to stream.exe (see code above) and an image is being created but the process never completes - i'm assuming that nothing would be created if the process couldn't find stream.exe ?

thanks again ...
But you pipe to convert and do not have the full path to convert. Sorry that is all that I was suggesting. I don't know much about windows or the IM stream command. Do you get any output from stream if you remove the pipe and save the file there?

Re: Calling stream.exe from another program

Posted: 2012-06-12T11:45:13-07:00
by mrdo
sorry, i misunderstood your original comment - it's a good suggestion.

off to try - will post back my results. :-)

Re: Calling stream.exe from another program

Posted: 2012-06-12T12:15:51-07:00
by mrdo
hi there,

still the same result unfortunately but i think you're on the right lines though.

i now have the following, tested successfully from the command line but still hanging on stream.exe when run from visual studio :

Code: Select all

D:\PROGRA~2\IMAGEM~1.6-Q\stream.exe -map rgb -storage-type char -extract 689x2067+0+0 "D:\Thumbnails\Test\Preview\TIFF\16_26-_19_log_LOG_VEL_233872468_rotated.jpg" - | D:\PROGRA~2\IMAGEM~1.6-Q\convert.exe -depth 8 -size 689x2067 rgb:- "D:\Thumbnails\Test\Preview\TIFF\16_26-_19_log_LOG_VEL_233872468_header.jpg"
anything else that i can try ? i think you're right - it does seem to hang after stream has run ...

thanks again

Re: Calling stream.exe from another program

Posted: 2012-06-12T12:27:36-07:00
by fmw42
try

D:\PROGRA~2\IMAGEM~1.6-Q\stream.exe -map rgb -storage-type char -extract 689x2067+0+0 "D:\Thumbnails\Test\Preview\TIFF\16_26-_19_log_LOG_VEL_233872468_rotated.jpg" MIFF:- | D:\PROGRA~2\IMAGEM~1.6-Q\convert.exe -depth 8 -size 689x2067 rgb:- "D:\Thumbnails\Test\Preview\TIFF\16_26-_19_log_LOG_VEL_233872468_header.jpg"

or

D:\PROGRA~2\IMAGEM~1.6-Q\stream.exe -map rgb -storage-type char -extract 689x2067+0+0 "D:\Thumbnails\Test\Preview\TIFF\16_26-_19_log_LOG_VEL_233872468_rotated.jpg" RGB:- | D:\PROGRA~2\IMAGEM~1.6-Q\convert.exe -depth 8 -size 689x2067 rgb:- "D:\Thumbnails\Test\Preview\TIFF\16_26-_19_log_LOG_VEL_233872468_header.jpg"

or

D:\PROGRA~2\IMAGEM~1.6-Q\stream.exe -map rgb -storage-type char -extract 689x2067+0+0 "D:\Thumbnails\Test\Preview\TIFF\16_26-_19_log_LOG_VEL_233872468_rotated.jpg" MIFF:- | D:\PROGRA~2\IMAGEM~1.6-Q\convert.exe -depth 8 -size 689x2067 - "D:\Thumbnails\Test\Preview\TIFF\16_26-_19_log_LOG_VEL_233872468_header.jpg"

But I am just guessing as I really don't know stream.

Re: Calling stream.exe from another program

Posted: 2012-06-12T13:19:12-07:00
by mrdo
no luck with the first two i'm afraid and i can't see the difference between the first and third options.

thanks again for your efforts.

Re: Calling stream.exe from another program

Posted: 2012-06-12T16:31:03-07:00
by fmw42
third has - rather than rgb:-

but I suspect no difference.

try breaking the command into two parts at the pipe and save a real temp file. perhaps your scripting system does not like the pipe.

Re: Calling stream.exe from another program

Posted: 2012-06-12T16:42:57-07:00
by mrdo
Yes, am going to try separating the commands tomorrow and see what happens...

Thanks for your help!

Re: Calling stream.exe from another program

Posted: 2012-06-13T02:04:30-07:00
by mrdo
ok, so i'm trying to run the piped commands separately - the stream command works fine but i'm having problems with the convert command :

Code: Select all

D:\PROGRA~2\IMAGEM~1.6-Q\convert "D:\Thumbnails\Test\Preview\TIFF\16_26-_19_log_LOG_VEL_233872468_header_temp.jpg" -depth 8 -size 689x2067 rgb:- "D:\Thumbnails\Test\Preview\TIFF\16_26-_19_log_LOG_VEL_233872468_header.jpg"
any ideas ?

thanks in advance

Re: Calling stream.exe from another program

Posted: 2012-06-13T09:34:57-07:00
by fmw42
Please post both commands. I am not sure how you are passing the image from one command to the other, ie. what format. I don't think you cannot use standard in (rgb:-) for your input of the second command without a pipe. You should save the output to a real file such as image.miff or image.rgb or image.mpc