X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_imagemagick%2Ftrgt_imagemagick.cpp;h=88dd95affbd48c923ccbea96ae79952afc269c93;hb=b289bc06a054acb7a61f887d19b9bfc0b7793d9c;hp=0d0cdffd77baff70fa124ce4e6b0a316391119b6;hpb=c3ad95144d148602f672e95ddda1f18fc35502f8;p=synfig.git diff --git a/synfig-core/trunk/src/modules/mod_imagemagick/trgt_imagemagick.cpp b/synfig-core/trunk/src/modules/mod_imagemagick/trgt_imagemagick.cpp index 0d0cdff..88dd95a 100644 --- a/synfig-core/trunk/src/modules/mod_imagemagick/trgt_imagemagick.cpp +++ b/synfig-core/trunk/src/modules/mod_imagemagick/trgt_imagemagick.cpp @@ -80,8 +80,7 @@ imagemagick_trgt::~imagemagick_trgt() bool imagemagick_trgt::set_rend_desc(RendDesc *given_desc) { - String ext(find(filename.begin(),filename.end(),'.')+1,filename.end()); - if(ext=="xpm") + if(filename_extension(filename) == ".xpm") pf=PF_RGB; else pf=PF_RGB|PF_A; @@ -114,19 +113,30 @@ imagemagick_trgt::end_frame() pclose(file); } file=NULL; + imagecount++; } bool imagemagick_trgt::start_frame(synfig::ProgressCallback *cb) { string command; + string newfilename; - if(channels(pf)==4) - command=strprintf("convert -depth 8 -size %dx%d rgba:-[0] -density %dx%d \"%s\"\n",desc.get_w(),desc.get_h(),round_to_int(desc.get_x_res()/39.3700787402),round_to_int(desc.get_y_res()/39.3700787402),filename.c_str()); + if (multi_image) + newfilename = (filename_sans_extension(filename) + + etl::strprintf(".%04d",imagecount) + + filename_extension(filename)); else - command=strprintf("convert -depth 8 -size %dx%d rgb:-[0] -density %dx%d \"%s\"\n",desc.get_w(),desc.get_h(),round_to_int(desc.get_x_res()/39.3700787402),round_to_int(desc.get_y_res()/39.3700787402),filename.c_str()); + newfilename = filename; - file=popen(command.c_str(),"w"); + command=strprintf("convert -depth 8 -size %dx%d rgb%s:-[0] -density %dx%d \"%s\"\n", + desc.get_w(), desc.get_h(), // size + ((channels(pf) == 4) ? "a" : ""), // rgba or rgb? + round_to_int(desc.get_x_res()/39.3700787402), // density + round_to_int(desc.get_y_res()/39.3700787402), + newfilename.c_str()); + + file=popen(command.c_str(),POPEN_BINARY_WRITE_TYPE); if(!file) {