Calling stream.exe from another program

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?".
mrdo
Posts: 21
Joined: 2012-05-31T02:53:08-07:00
Authentication code: 13

Calling stream.exe from another program

Post 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
tomriddle
Posts: 2
Joined: 2012-06-01T07:36:24-07:00
Authentication code: 13
Location: Ipswich

Re: Calling stream.exe from another program

Post 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?
mrdo
Posts: 21
Joined: 2012-05-31T02:53:08-07:00
Authentication code: 13

Re: Calling stream.exe from another program

Post 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
mrdo
Posts: 21
Joined: 2012-05-31T02:53:08-07:00
Authentication code: 13

Re: Calling stream.exe from another program

Post 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 ?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Calling stream.exe from another program

Post 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.
mrdo
Posts: 21
Joined: 2012-05-31T02:53:08-07:00
Authentication code: 13

Re: Calling stream.exe from another program

Post 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 ...
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Calling stream.exe from another program

Post 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?
mrdo
Posts: 21
Joined: 2012-05-31T02:53:08-07:00
Authentication code: 13

Re: Calling stream.exe from another program

Post by mrdo »

sorry, i misunderstood your original comment - it's a good suggestion.

off to try - will post back my results. :-)
mrdo
Posts: 21
Joined: 2012-05-31T02:53:08-07:00
Authentication code: 13

Re: Calling stream.exe from another program

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Calling stream.exe from another program

Post 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.
mrdo
Posts: 21
Joined: 2012-05-31T02:53:08-07:00
Authentication code: 13

Re: Calling stream.exe from another program

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Calling stream.exe from another program

Post 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.
mrdo
Posts: 21
Joined: 2012-05-31T02:53:08-07:00
Authentication code: 13

Re: Calling stream.exe from another program

Post by mrdo »

Yes, am going to try separating the commands tomorrow and see what happens...

Thanks for your help!
mrdo
Posts: 21
Joined: 2012-05-31T02:53:08-07:00
Authentication code: 13

Re: Calling stream.exe from another program

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Calling stream.exe from another program

Post 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
Post Reply