[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(mgp-users 00144) Re: converting presentations to html...
- To: mgp-users@mew.org
- Subject: (mgp-users 00144) Re: converting presentations to html...
- From: sen_ml@eccosys.com
- Date: Mon, 5 Apr 1999 21:22:59 +0900
- In-reply-to: Your message of "Mon, 5 Apr 1999 02:26:23 +0900" <>
- Posted: Mon, 05 Apr 1999 21:13:37 +0900
- References: <>
- Reply-to: mgp-users@mew.org
attached is a slightly nicer patch (still slow though, and png support
seems flaky...)
i forgot to mention that the default image format becomes jpeg w/ this
patch (and the former one). gif generation is a lot slower than in
vanilla mgp :-(
--- mgp.c-dist Fri Apr 2 16:55:08 1999
+++ mgp.c Mon Apr 5 14:38:56 1999
@@ -77,6 +77,8 @@
static char *tsfile = NULL;
static char *dumpdir = NULL;
+/* file format extension -- use what 'convert' from imagemagick uses */
+static char *gformat = NULL;
char *gsdevice = DEFAULT_GSDEV;
@@ -202,7 +204,7 @@
mgpwdir = p;
}
-#define ACCEPTOPTS "BdvVob:c:g:f:hlGp:qt:Q:PST:D:CORw:X:x:n"
+#define ACCEPTOPTS "BdvVob:c:g:f:hlGp:qt:Q:PST:D:z:CORw:X:x:n"
while ((opt = getopt(argc, argv, ACCEPTOPTS)) != -1) {
#undef ACCEPTOPTS
switch (opt) {
@@ -263,6 +265,10 @@
tbar_mode = 1;
break;
+ case 'z':
+ gformat = optarg;
+ break;
+
case 'Q':
b_quality = atoi(optarg);
quality_flag = 1;
@@ -404,6 +410,12 @@
FILE *txt;
int page;
char *childdebug;
+ /* hope this works... */
+ char *gr_format = "jpeg";
+
+ if (gformat) {
+ gr_format = gformat;
+ }
/* check if we can write to the directory */
sprintf(buf, "%s/%ld", dumpdir, (long)time((time_t *)NULL));
@@ -426,20 +438,19 @@
draw_page(&state, NULL);
/*
- * dump out gif image
+ * dump out image (default is jpeg)
*/
fprintf(stderr, "(full image)");
- sprintf(buf, "xwintoppm -silent -name MagicPoint | "
- "ppmquant 256 %s | "
- "ppmtogif %s > %s/mgp%05d.gif",
- childdebug, childdebug, dumpdir, page);
+ sprintf(buf, "import -window MagicPoint -colors 256 "
+ "%s/mgp%05d.%s %s",
+ dumpdir, page, gr_format, childdebug);
system(buf); /*XXX security hole*/
fprintf(stderr, "(thumbnail)");
- sprintf(buf, "giftopnm %s/mgp%05d.gif | "
- "pnmscale 0.25 | ppmquant 256 %s | "
- "ppmtogif %s > %s/mgp%05d.idx.gif",
- dumpdir, page, childdebug, childdebug,
- dumpdir, page);
+ sprintf(buf, "convert -colors 256 -geometry 25%% "
+ "%s/mgp%05d.%s "
+ "%s/mgp%05d.idx.%s %s",
+ dumpdir, page, gr_format,
+ dumpdir, page, gr_format, childdebug);
system(buf); /*XXX security hole*/
/*
@@ -474,14 +485,15 @@
fprintf(html, "<BR>Page %d: %s<BR>\n", page, page_title(page));
fprintf(html, "<HR>\n");
if (window_width < 0 || window_height < 0) {
- fprintf(html, "<IMG SRC=\"mgp%05d.gif\" "
+ fprintf(html, "<IMG SRC=\"mgp%05d.%s\" "
"ALT=\"Page %d\">\n",
- page, page);
+ page, gr_format,
+ page);
} else {
- fprintf(html, "<IMG SRC=\"mgp%05d.gif\" "
+ fprintf(html, "<IMG SRC=\"mgp%05d.%s\" "
"WIDTH=%d HEIGHT=%d ALT=\"Page %d\"><BR>\n",
- page, window_width, window_height,
- page);
+ page, gr_format,
+ window_width, window_height, page);
}
fprintf(html, "<HR>Generated by "
"<A HREF=\"http://www.mew.org/mgp/\">MagicPoint</A>\n"
@@ -539,16 +551,20 @@
for (page = start_page; page <= maxpage; page++) {
if (window_width < 0 || window_height < 0) {
fprintf(html, "<A HREF=\"mgp%05d.html\">"
- "<IMG SRC=\"mgp%05d.idx.gif\" "
+ "<IMG SRC=\"mgp%05d.idx.%s\" "
"ALT=\"Page %d\"></A>\n",
- page, page, page);
+ page,
+ page, gr_format,
+ page);
} else {
fprintf(html, "<A HREF=\"mgp%05d.html\">"
- "<IMG SRC=\"mgp%05d.idx.gif\" "
+ "<IMG SRC=\"mgp%05d.idx.%s\" "
"WIDTH=%d HEIGHT=%d "
"ALT=\"Page %d\"></A>\n",
- page, page, window_width / 4,
- window_height / 4, page);
+ page,
+ page, gr_format,
+ window_width / 4, window_height / 4,
+ page);
}
}
fprintf(html, "<HR>\n");