[prev in list] [next in list] [prev in thread] [next in thread] 

List:       swftools-common
Subject:    Re: [Swftools-common] jpg swf_gui
From:       Douglas Miller <doug () douglas-miller ! com>
Date:       2009-04-29 1:52:37
Message-ID: a3f39dcb0904281852n798d30faycaf50dd9b3e9d32e () mail ! gmail ! com
[Download RAW message or body]

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 <
Gunivortus.Goos@boudicca.de> 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:Gunivortus.Goos@boudicca.de
>
>
>
>

[Attachment #3 (text/html)]

<div>Matthias,</div><div><br></div><div>I thought I&#39;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&#39;m a total noob when it comes to cvs and generating patches so I hope \
this does the trick.</div> <div><br></div><div><br></div><div>--- \
/home/dmiller/swftools-0.9.0/src/jpeg2swf.c<span class="Apple-tab-span" \
style="white-space:pre">	</span>2009-02-16 05:34:51.000000000 -0500</div><div>+++ \
/home/dmiller/swftools-0.9.0-doug/src/jpeg2swf.c<span class="Apple-tab-span" \
style="white-space:pre">	</span>2009-04-28 21:48:06.000000000 -0400</div> <div>@@ \
-47,6 +47,7 @@ struct {</div><div>     int version;</div><div>     int \
fit_to_movie;</div><div>     float scale;</div><div>+    int \
one_file_per_image;</div><div> } global;</div><div> </div><div> static int \
custom_move=0;</div> <div>@@ -419,8 +420,27 @@ int args_callback_option(char *arg, \
char</div><div> <span class="Apple-tab-span" style="white-space:pre">	</span>    \
break;</div><div> </div><div> <span class="Apple-tab-span" \
style="white-space:pre">	</span>case &#39;o&#39;:</div> <div>-<span \
class="Apple-tab-span" style="white-space:pre">	</span>    if (val)</div><div>-<span \
class="Apple-tab-span" style="white-space:pre">		</span>global.outfile = \
val;</div><div>+<span class="Apple-tab-span" style="white-space:pre">	</span>    if \
(val){</div> <div>+<span class="Apple-tab-span" style="white-space:pre">	</span>    \
<span class="Apple-tab-span" style="white-space:pre">	</span>//if val contains a % \
symbol, set a boolean value in global for outputting one file per page</div> \
<div>+<span class="Apple-tab-span" style="white-space:pre">		</span>char *c = \
0;</div><div>+<span class="Apple-tab-span" style="white-space:pre">		</span>if((c = \
strchr(val, &#39;%&#39;))){</div><div>+<span class="Apple-tab-span" \
style="white-space:pre">		</span>    if(strchr(c+1, &#39;%&#39;)){</div> <div>+<span \
class="Apple-tab-span" style="white-space:pre">		</span>        if \
(VERBOSE(1))</div><div>+<span class="Apple-tab-span" \
style="white-space:pre">		</span>            fprintf(stderr,</div><div>+<span \
class="Apple-tab-span" style="white-space:pre">		</span>                    \
&quot;Error: The output filename can contain a maximum of one %%\n&quot;);</div> \
<div>+<span class="Apple-tab-span" style="white-space:pre">		</span>        \
exit(1);</div><div>+<span class="Apple-tab-span" style="white-space:pre">		</span>    \
}</div><div>+<span class="Apple-tab-span" style="white-space:pre">		</span>    \
global.one_file_per_image = 1;</div> <div>+<span class="Apple-tab-span" \
style="white-space:pre">		</span>    char *pattern = (char \
*)malloc(strlen(val)+2);</div><div>+<span class="Apple-tab-span" \
style="white-space:pre">		</span>    int len = c - val + 1;</div> <div>+<span \
class="Apple-tab-span" style="white-space:pre">		</span>    memcpy(pattern, val, \
len);</div><div>+<span class="Apple-tab-span" style="white-space:pre">		</span>    \
pattern[len] = &#39;d&#39;;</div><div>+<span class="Apple-tab-span" \
style="white-space:pre">		</span>    strcpy(pattern + len + 1, val + len);</div> \
<div>+<span class="Apple-tab-span" style="white-space:pre">		</span>    \
global.outfile = pattern;</div><div>+<span class="Apple-tab-span" \
style="white-space:pre">		</span>}</div><div>+<span class="Apple-tab-span" \
style="white-space:pre">		</span>else</div> <div>+<span class="Apple-tab-span" \
style="white-space:pre">		</span>    global.outfile = val;</div><div>+<span \
class="Apple-tab-span" style="white-space:pre">	</span>    }</div><div> <span \
class="Apple-tab-span" style="white-space:pre">	</span>    res = 1;</div> <div> <span \
class="Apple-tab-span" style="white-space:pre">	</span>    break;</div><div> \
</div><div>@@ -618,6 +638,7 @@ int main(int argc, char **argv)</div><div>     \
global.next_id = 1;</div><div>     global.fit_to_movie = 0;</div> <div>     \
global.scale = 1.0;</div><div>+    global.one_file_per_image = 0;</div><div> <span \
class="Apple-tab-span" style="white-space:pre">	</span></div><div>     \
processargs(argc, argv);</div><div> </div><div>@@ -637,10 +658,23 @@ int main(int \
argc, char **argv)</div> <div> <span class="Apple-tab-span" \
style="white-space:pre">	</span>    t = MovieAddFrame(&amp;swf, t, image[i].filename, \
image[i].quality,</div><div> <span class="Apple-tab-span" \
style="white-space:pre">			</span>      image[i].width, image[i].height);</div> <div> \
<span class="Apple-tab-span" style="white-space:pre">	</span>    \
free(image[i].filename);</div><div>+<span class="Apple-tab-span" \
style="white-space:pre">	</span>    //if set, output a new swf file for each \
image</div> <div>+<span class="Apple-tab-span" style="white-space:pre">	</span>    \
if(global.one_file_per_image){</div><div>+<span class="Apple-tab-span" \
style="white-space:pre">	</span>    <span class="Apple-tab-span" \
style="white-space:pre">	</span>//generate the correct filename to use</div> \
<div>+<span class="Apple-tab-span" style="white-space:pre">	</span>    <span \
class="Apple-tab-span" style="white-space:pre">	</span>char \
buf[1024];</div><div>+<span class="Apple-tab-span" style="white-space:pre">	</span>   \
<span class="Apple-tab-span" style="white-space:pre">	</span>sprintf(buf, \
global.outfile, i);</div> <div>+<span class="Apple-tab-span" \
style="white-space:pre">	</span>    <span class="Apple-tab-span" \
style="white-space:pre">	</span>//call MovieFinish with the generated \
filename</div><div>+<span class="Apple-tab-span" style="white-space:pre">	</span>    \
<span class="Apple-tab-span" style="white-space:pre">	</span>MovieFinish(&amp;swf, t, \
buf);</div> <div>+<span class="Apple-tab-span" style="white-space:pre">	</span>    \
<span class="Apple-tab-span" style="white-space:pre">	</span>//re-initialize t by \
calling MovieStart again</div><div>+<span class="Apple-tab-span" \
style="white-space:pre">	</span>    <span class="Apple-tab-span" \
style="white-space:pre">	</span>t = MovieStart(&amp;swf, global.framerate,</div> \
<div>+<span class="Apple-tab-span" style="white-space:pre">		</span>               \
global.force_width ? global.force_width : \
(int)(global.max_image_width*global.scale),</div><div>+<span class="Apple-tab-span" \
style="white-space:pre">		</span>               global.force_height ? \
global.force_height : (int)(global.max_image_height*global.scale));</div> <div>+<span \
class="Apple-tab-span" style="white-space:pre">	</span>    }</div><div> <span \
class="Apple-tab-span" style="white-space:pre">	</span>}</div><div>     }</div><div> \
</div><div>-    MovieFinish(&amp;swf, t, global.outfile);</div> <div>+    \
if(!global.one_file_per_image)</div><div>+        MovieFinish(&amp;swf, t, \
global.outfile);</div><div> </div><div>     return 0;</div><div> \
}</div><div><br></div><br><div class="gmail_quote">On Tue, Apr 28, 2009 at 7:11 AM, \
Gunivortus Goos <span dir="ltr">&lt;<a \
href="mailto:Gunivortus.Goos@boudicca.de">Gunivortus.Goos@boudicca.de</a>&gt;</span> \
wrote:<br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex;">Hello Matthias,<br> <div class="im"><br>
&gt;&gt; To do the work I only can think of adding the jpg files all one by one by \
hand<br> &gt;&gt; into an Open Office document, exporting that to PDF and then use \
the Gui to make<br> &gt;&gt; that SWF book out of it.<br>
<br>
</div>MK&gt; Adding each jpeg by hand seems a bit inefficent to me.<br>
MK&gt; Maybe some image viewer (ACDSee, IfranView etc.) has a<br>
MK&gt; &quot;export to PDF&quot; or at least &quot;print to PDF&quot; option that<br>
MK&gt; can be used on a directory of images?<br>
<br>
Hmm.. that doesn&#39;t make it easier, &#39;cause it creates for every picture an \
own<br> PDF file.<br>
Got some more tips, but either they didn&#39;t what I want or I didn&#39;t \
understand<br> them. :-)<br>
<br>
Maybe there&#39;s another way......<br>
When using jpg2swf, is there an option to let it create too output html files?<br>
(As the Gui does).<br>
<br>
I didn&#39;t find another tool that converts jpg into swf AND gives the needed \
html<br> too.<br>
<br>
Kind regards,<br>
<font color="#888888">Gunivortus<br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
Best regards,<br>
 Gunivortus                            mailto:<a \
href="mailto:Gunivortus.Goos@boudicca.de">Gunivortus.Goos@boudicca.de</a><br> <br>
<br>
<br>
</div></div></blockquote></div><br>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic