Page 1 of 1

erro message 4 using convert

Posted: 2012-03-01T09:22:53-07:00
by fsasfsas
Hi
I am quite a noob in using imagemagick. I made a software program with microsoft visual c++ and I use the command line within this program to resize a picture. If I debug it, it works fine, but if I compile the program and run the executable I get an error message saying:
return: 4, convert
and then the command wich I am using to resize the picture (which works fine if I enter it in a dos command box and also works fine if I use the microsoft visual c++ debugger)

I am using
Version: ImageMagick 6.5.6-10 2009-10-08 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

can somebody please tell me what I am doing wrong? Or where to find information on this topic?
thanks, Anjo

Re: erro message 4 using convert

Posted: 2012-03-04T02:27:11-07:00
by fsasfsas
nowbody?

Re: erro message 4 using convert

Posted: 2012-03-04T12:02:39-07:00
by fmw42
best I can suggest as a non-windows user is to add the full path to your convert or other IM commands in your code

Re: erro message 4 using convert

Posted: 2012-03-04T18:30:43-07:00
by anthony
Perhaps post the part of your code that actually calls imagemagick command?
Without more information it is impossible to help!

Re: erro message 4 using convert

Posted: 2012-03-07T07:06:41-07:00
by fsasfsas
the code is the following:

Code: Select all

	if (width>heigth) 
	{   sprintf (command, "convert d:\\website\\toevoegen\\%s -resize 120 d:\\website\\toevoegen\\%s", filename, filenamesmall);
		systemcommand (command); 
	}
	else 
	{	sprintf (command, "convert d:\\website\\toevoegen\\%s -resize x120 d:\\website\\toevoegen\\%s", filename, filenamesmall);
		systemcommand (command); 

	}
so the full name is already incorporated in the code

thanks, Anjo

Re: erro message 4 using convert

Posted: 2012-03-07T07:08:19-07:00
by fsasfsas
addition: I mean the full path to the files, not to the convert command. Sorry, reply was too quick.
I will try that suggestion

thanks, Anjo

Re: erro message 4 using convert

Posted: 2012-03-07T19:20:39-07:00
by anthony
As a debug, output the actual command being executed somewhere and check it is what you expect!

Also you make like to add escaped quotes around the file arguments to the convert command, just in case the filename has spaces in them!
Eg "convert \"d:\\path\\to\\dir\\%s\" ...."