Page 1 of 1

convert from C-prompt but not elsewhere?

Posted: 2017-07-11T05:07:15-07:00
by harryjohnbee
Windows 10

This command line:

convert -scale "26%" "C:\image files\unsorted personal images\Unsquared Images\Unsized Images\Tests\Tree 2012.bmp" "C:\image files\unsorted personal images\Unsquared Images\Unsized Images\Tests\small-Tree 2012.bmp"

and anything like it works fine from the C:\ prompt in a C-print window (from any directory - e.g., C:\Users\), but does not work from the Win10 Run dialog or from any inline shell function.

What am I missing?

Harry

Re: convert from C-prompt but not elsewhere?

Posted: 2017-07-11T08:04:22-07:00
by snibgo
What version of IM?

How do you know it doesn't work? What error message do you get?

"-scale" is an operation on images. It should come after you read the image, not before. Putting this first might work in v6 but not v7.

I don't know what an "inline shell function" is. Perhaps you need the full path to the convert program.

Re: convert from C-prompt but not elsewhere?

Posted: 2017-07-11T09:41:30-07:00
by fmw42
I would second what snibgo said. Perhaps your shells do not know where ImageMagick convert (IM6) or magick (IM7) reside. What is your ImageMagick version. Try putting the full path to convert/magick in your command line or add the path to convert/magick to your PATH environment variables for those shells. Also put your input before -scale as he said. For example if you are using Windows 10 unix, you could put that in the PATH environment variable or your .profile or .bash_profile files.

Re: convert from C-prompt but not elsewhere?

Posted: 2017-07-12T05:11:07-07:00
by harryjohnbee
Thanks for your answers

Snibgo: There is no error message, but I know the conversion doesn't work because the "small-tree" scaled image file isn't created. When run in a c-prompt window, there is a pause, and the scaled file is created. When run from the Run dialog or called by program code, there is a only flash of a c-prompt window and the scaled image is not created. The examples show the -command switches, including the -scale command, before input/output files, but I'll try rearranging. By "inline shell function" I was referring to things like tools.shell in C++, the Shell( function in Visual Basic/Studio, or the RUN command in old standby BASIC that call/run external executables.

FMW42: convert is duly listed as part of Windows PATH environment variable, so any shell/run-calling of the program should find it. However, I'll try it with the complete path, as suggested. (I think I did that already, but at may age, who knows?) Looks like I have version 6.9.8-10.

I'll report back. Thanks again

Re: convert from C-prompt but not elsewhere?

Posted: 2017-07-12T05:44:14-07:00
by snibgo
I always use the command prompt, and can't advise on the others.

In Windows 8.1, convert can be executed in the "run" facility by including the full path to the executable.

Re: convert from C-prompt but not elsewhere?

Posted: 2017-07-15T12:06:08-07:00
by harryjohnbee
Just to put draw a line under this, convert does work slick from the Run dialog and when shelled from an application apparently only when you include the entire path to convert. (Thanks, snibgo.) Don't know why that should be when the path is included in the PATH environment variable, but whatever works. Right?

And, yes, ya''l were right that most of the examples show the -commands after the input file and before the output file. But it works when the -command is first, too, though probably not recommended.

Thanks for all the help.

Re: convert from C-prompt but not elsewhere?

Posted: 2017-07-15T12:15:22-07:00
by fmw42
harryjohnbee wrote: 2017-07-15T12:06:08-07:00 Just to put draw a line under this, convert does work slick from the Run dialog and when shelled from an application apparently only when you include the entire path to convert. (Thanks, snibgo.) Don't know why that should be when the path is included in the PATH environment variable, but whatever works. Right?

And, yes, ya''l were right that most of the examples show the -commands after the input file and before the output file. But it works when the -command is first, too, though probably not recommended.

Thanks for all the help.
Many shells are like that. You need to do that with AppleScript also.

IM 6 is forgiving (mostly) of bad syntax structure. But that is not the case for IM 7. So you should get used to the proper syntax. See http://www.imagemagick.org/Usage/basics/#why