erro message 4 using convert

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?".
Post Reply
fsasfsas
Posts: 4
Joined: 2012-03-01T09:15:49-07:00
Authentication code: 8675308

erro message 4 using convert

Post 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
fsasfsas
Posts: 4
Joined: 2012-03-01T09:15:49-07:00
Authentication code: 8675308

Re: erro message 4 using convert

Post by fsasfsas »

nowbody?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: erro message 4 using convert

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: erro message 4 using convert

Post by anthony »

Perhaps post the part of your code that actually calls imagemagick command?
Without more information it is impossible to help!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
fsasfsas
Posts: 4
Joined: 2012-03-01T09:15:49-07:00
Authentication code: 8675308

Re: erro message 4 using convert

Post 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
fsasfsas
Posts: 4
Joined: 2012-03-01T09:15:49-07:00
Authentication code: 8675308

Re: erro message 4 using convert

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: erro message 4 using convert

Post 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\" ...."
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply