Package: mgp Version: 1.11b-2 Severity: wishlist What I need is being able to choose the image size for html dumps. The patch included implements this feature for mgp-1.11b, and is just a port of bug 161055, I sent three years ago. I submit a new bug report so the html page gets updated. I'll try to close the previous bug myself.
I'm resubmitting the previous description of the patch here: The problems: A) I do my presentations at 1024x768, but a lot of people run at 1024 themselves, so using a browser the page is slightly too large. B) The index page is good for following the presentation if images are not too reduced. The solution: Reduction in image size is now configurable, the default being a reduction of 1.0 and 0.25 like it was in the original. The details: - added two double variables preset to 1.0 and 0.25 - added "-s" command line option to change them - added help message for "-s" - removed WIDTH and HEIGHT html attributes, not needed and now not deterministic any more - generate idx from xwintoppm (not from previous output) since the size of idx is absolute instead of relative (e.g., I use 0.8,0.5, where 0.5 should not be half of 0.8 but rather half of original image. Besides this makes the idx image better in case of lossy compression (jpg). Additionally (though unrelated) - added a "jpeg" type identical to "jpg" for people mistyping it. Related suggestions: * Since png is much better than jpg for synthetic images, I think it should be the default. * if the patch is accepted, the decompression programs are not needed any more in convtab[] * probably pnmtojpeg should be preferred to cjpeg --- ./mgp.c.orig 2005-12-01 15:05:03.000000000 +0100 +++ ./mgp.c 2005-12-01 15:42:17.000000000 +0100 @@ -87,6 +87,9 @@ static char *tsfile = NULL; static char *dumpdir = NULL; +static double imgreduce_page = 1.0; /* image for html pages is not reduced */ +static double imgreduce_index = 0.25; /* image for index.html is reduced by 4 */ + char *gsdevice = DEFAULT_GSDEV; char *htmlimage; @@ -255,7 +258,7 @@ argv=tmp_argv; argc=tmp_argc; -#define ACCEPTOPTS "Bd:vVob:c:eg:f:hlGp:qt:Q:PSUT:D:CORw:X:x:nF:E:" +#define ACCEPTOPTS "Bd:vVob:c:eg:f:hlGp:qt:Q:PSUT:D:CORw:X:x:nF:E:s:" while ((opt = getopt(argc, argv, ACCEPTOPTS)) != -1) { #undef ACCEPTOPTS switch (opt) { @@ -410,6 +413,15 @@ htmlimage = optarg; break; + case 's': + if (sscanf(optarg, "%lf,%lf", &imgreduce_page, + &imgreduce_index) != 2) { + fprintf(stderr, "%s: wrong sizes \"%s\"\n", + argv[0], optarg); + exit(1); + } + break; + case 'h': default: mgp_usage(progname); @@ -493,6 +505,7 @@ int page; char *childdebug; char *convdb[][3] = {{ "jpg", "cjpeg", "djpeg" }, + { "jpeg", "cjpeg", "djpeg" }, { "png", "pnmtopng", "pngtopnm" }, { NULL, NULL, NULL }}; int inum = 0; @@ -543,17 +556,16 @@ */ fprintf(stderr, "(full image)"); sprintf(buf, "xwintoppm -silent -name MagicPoint | " - "%s %s > %s/mgp%05d.%s", + "pnmscale %f | %s %s > %s/mgp%05d.%s", imgreduce_page, convdb[inum][1], childdebug, dumpdir, page, EXT); if (system(buf) < 0){ /*XXX security hole*/ fprintf(stderr, "system() failed for %s", buf); exit(-1); } fprintf(stderr, "(thumbnail)"); - sprintf(buf, "%s %s/mgp%05d.%s | " - "pnmscale 0.25 | %s %s > %s/mgp%05d.idx.%s", - convdb[inum][2], dumpdir, page, EXT, convdb[inum][1], childdebug, - dumpdir, page, EXT); + sprintf(buf, "xwintoppm -silent -name MagicPoint | " + "pnmscale %f | %s %s > %s/mgp%05d.idx.%s", imgreduce_index, + convdb[inum][1], childdebug, dumpdir, page, EXT); if (system(buf) < 0){ /*XXX security hole*/ fprintf(stderr, "system() failed for %s", buf); exit(-1); @@ -596,8 +608,8 @@ page, EXT, page); } else { fprintf(html, "<IMG SRC=\"mgp%05d.%s\" " - "WIDTH=%d HEIGHT=%d ALT=\"Page %d\"><BR>\n", - page, EXT, window_width, window_height, + "ALT=\"Page %d\"><BR>\n", + page, EXT, page); } fprintf(html, "<HR>Generated by " @@ -662,10 +674,8 @@ } else { fprintf(html, "<A HREF=\"mgp%05d.html\">" "<IMG SRC=\"mgp%05d.idx.%s\" " - "WIDTH=%d HEIGHT=%d " "ALT=\"Page %d\"></A>\n", - page, page, EXT, window_width / 4, - window_height / 4, page); + page, page, EXT, page); } } fprintf(html, "<HR>\n"); @@ -713,6 +723,7 @@ fprintf(stderr, "\t-o: Do not override the window manager\n"); fprintf(stderr, "\t-p <page>: Start at the specified page\n"); fprintf(stderr, "\t-q Do not beep on errors\n"); + fprintf(stderr, "\t-s <page>,<index>: Size reduction for html images (default 1.0,0.25)\n"); fprintf(stderr, "\t-t <timeslot>: Enable presentation timer\n"); fprintf(stderr, "\t-v: Show version number and quit\n"); fprintf(stderr, "\t-w <dir>: Specify a working directory\n"); -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]