X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_imagemagick%2Fmptr_imagemagick.cpp;h=921557f7a242aa01581b0406bfd865116722d54a;hb=d04c74c8f5a45493895afdaba9b39772401fbf39;hp=c945ee538f9809483995ba999477f11e6a7760ca;hpb=991d45b68d8b19c075e5b16bb63b6b8898090341;p=synfig.git diff --git a/synfig-core/trunk/src/modules/mod_imagemagick/mptr_imagemagick.cpp b/synfig-core/trunk/src/modules/mod_imagemagick/mptr_imagemagick.cpp index c945ee5..921557f 100644 --- a/synfig-core/trunk/src/modules/mod_imagemagick/mptr_imagemagick.cpp +++ b/synfig-core/trunk/src/modules/mod_imagemagick/mptr_imagemagick.cpp @@ -63,7 +63,7 @@ using namespace etl; #if defined(HAVE_FORK) && defined(HAVE_PIPE) && defined(HAVE_WAITPID) #define UNIX_PIPE_TO_PROCESSES -#elif defined(HAVE__SPAWNLP) && defined(HAVE__PIPE) && defined(HAVE_CWAIT) +#else #define WIN32_PIPE_TO_PROCESSES #endif @@ -104,17 +104,26 @@ imagemagick_mptr::get_frame(synfig::Surface &surface,Time /*time*/, synfig::Prog return false; } string temp_file="/tmp/deleteme.png"; - string output="png32:"+temp_file; #if defined(WIN32_PIPE_TO_PROCESSES) + if(file) + pclose(file); + + string command; + if(filename.find("psd")!=String::npos) - _spawnlp(_P_WAIT, "convert", "convert", filename.c_str(), "-flatten", output.c_str(), (const char *)NULL); + command=strprintf("convert \"%s\" -flatten \"png32:%s\"\n",filename.c_str(),temp_file.c_str()); else - _spawnlp(_P_WAIT, "convert", "convert", filename.c_str(), output.c_str(), (const char *)NULL); + command=strprintf("convert \"%s\" \"png32:%s\"\n",filename.c_str(),temp_file.c_str()); + + if(system(command.c_str())!=0) + return false; #elif defined(UNIX_PIPE_TO_PROCESSES) + string output="png32:"+temp_file; + pid_t pid = fork(); if (pid == -1) { @@ -142,8 +151,6 @@ imagemagick_mptr::get_frame(synfig::Surface &surface,Time /*time*/, synfig::Prog Importer::Handle importer(Importer::open(temp_file)); - DEBUGPOINT(); - if(!importer) { if(cb)cb->error(_("Unable to open ")+temp_file); @@ -151,8 +158,6 @@ imagemagick_mptr::get_frame(synfig::Surface &surface,Time /*time*/, synfig::Prog return false; } - DEBUGPOINT(); - if(!importer->get_frame(surface,0,cb)) { if(cb)cb->error(_("Unable to get frame from ")+temp_file); @@ -193,9 +198,7 @@ imagemagick_mptr::get_frame(synfig::Surface &surface,Time /*time*/, synfig::Prog Surface bleh(surface); surface=bleh; - //remove(temp_file.c_str()); - DEBUGPOINT(); return true; #else