Matthias,

I thought I'd add the option to jpeg2swf to allow for outputting a swf file
for each input jpeg. Here is a patch that I generated. I'm a total noob when
it comes to cvs and generating patches so I hope this does the trick.


--- /home/dmiller/swftools-0.9.0/src/jpeg2swf.c 2009-02-16
05:34:51.000000000 -0500
+++ /home/dmiller/swftools-0.9.0-doug/src/jpeg2swf.c 2009-04-28
21:48:06.000000000 -0400
@@ -47,6 +47,7 @@ struct {
     int version;
     int fit_to_movie;
     float scale;
+    int one_file_per_image;
 } global;

 static int custom_move=0;
@@ -419,8 +420,27 @@ int args_callback_option(char *arg, char
     break;

  case 'o':
-    if (val)
- global.outfile = val;
+    if (val){
+     //if val contains a % symbol, set a boolean value in global for
outputting one file per page
+ char *c = 0;
+ if((c = strchr(val, '%'))){
+    if(strchr(c+1, '%')){
+        if (VERBOSE(1))
+            fprintf(stderr,
+                    "Error: The output filename can contain a maximum of
one %%\n");
+        exit(1);
+    }
+    global.one_file_per_image = 1;
+    char *pattern = (char *)malloc(strlen(val)+2);
+    int len = c - val + 1;
+    memcpy(pattern, val, len);
+    pattern[len] = 'd';
+    strcpy(pattern + len + 1, val + len);
+    global.outfile = pattern;
+ }
+ else
+    global.outfile = val;
+    }
     res = 1;
     break;

@@ -618,6 +638,7 @@ int main(int argc, char **argv)
     global.next_id = 1;
     global.fit_to_movie = 0;
     global.scale = 1.0;
+    global.one_file_per_image = 0;

     processargs(argc, argv);

@@ -637,10 +658,23 @@ int main(int argc, char **argv)
     t = MovieAddFrame(&swf, t, image[i].filename, image[i].quality,
       image[i].width, image[i].height);
     free(image[i].filename);
+    //if set, output a new swf file for each image
+    if(global.one_file_per_image){
+     //generate the correct filename to use
+     char buf[1024];
+     sprintf(buf, global.outfile, i);
+     //call MovieFinish with the generated filename
+     MovieFinish(&swf, t, buf);
+     //re-initialize t by calling MovieStart again
+     t = MovieStart(&swf, global.framerate,
+               global.force_width ? global.force_width :
(int)(global.max_image_width*global.scale),
+               global.force_height ? global.force_height :
(int)(global.max_image_height*global.scale));
+    }
  }
     }

-    MovieFinish(&swf, t, global.outfile);
+    if(!global.one_file_per_image)
+        MovieFinish(&swf, t, global.outfile);

     return 0;
 }


On Tue, Apr 28, 2009 at 7:11 AM, Gunivortus Goos <
[email protected]> wrote:

> Hello Matthias,
>
> >> To do the work I only can think of adding the jpg files all one by one
> by hand
> >> into an Open Office document, exporting that to PDF and then use the Gui
> to make
> >> that SWF book out of it.
>
> MK> Adding each jpeg by hand seems a bit inefficent to me.
> MK> Maybe some image viewer (ACDSee, IfranView etc.) has a
> MK> "export to PDF" or at least "print to PDF" option that
> MK> can be used on a directory of images?
>
> Hmm.. that doesn't make it easier, 'cause it creates for every picture an
> own
> PDF file.
> Got some more tips, but either they didn't what I want or I didn't
> understand
> them. :-)
>
> Maybe there's another way......
> When using jpg2swf, is there an option to let it create too output html
> files?
> (As the Gui does).
>
> I didn't find another tool that converts jpg into swf AND gives the needed
> html
> too.
>
> Kind regards,
> Gunivortus
>
>
>
>
>
>
>
> --
> Best regards,
>  Gunivortus                            mailto:[email protected]
>
>
>
>

Reply via email to