:Hast du auch dies hier gesehen? ==> |
:Hast du auch dies hier gesehen? ==> RTF/AnmerkungBilder -- VolkerGlave |
<pre> "Images in RTF" In the RTF Pocket Guide's section on "Embedding Images", I say this: In an ideal world, RTF would allow you to insert a picture into a document by simply dropping a hex-encoded GIF, JPEG, or PNG file into your RTF code. But RTF doesn't do things that way. The RTF specification, on the subject of pictures, explains a {\pict...} construct that contains picture data (typically as a long series of hexadecimal digits). And the crucial sentence: But the picture data encoded in the {\pict...} construct is in a binary format that can't be converted to easily from a conventional image format (i.e., GIF, JPEG, or PNG). The binary format that I'm talking about is actuall WMF (Windows Metafile), incidentally -- whenever I'd try dropping a gif into a document and the examining how it saved, it'd be encased in inscrutible WMF code (or, even worse, MSWord-specific binary formats). One can, I'm sure, convert GIF to WMF, but not easily. But a reader of mine, Dave Thielen, has pointed out to me something that totally escaped me, my experienced tech-editors, and everyone else I've ever asked about this (and I asked far and wide) -- namely, that the contents of a {\pict...} construct CAN be in an WMF, OR they can be in JPG or PNG (and a few other uninteresting formats besides). That is, whereas you can't dump raw GIF data into a \pict construct, you CAN dump raw JPG/PNG data in -- encoded as hex data, and prefaced by the image heigh and width. (Actually, you can use unencoded data as part of a \binN keyword, but this is probably a bad idea for various minor pragmatic reasons, and is in any case not covered in the book.) Specifically, you use {\pict\jpegblip\picwX\pichY...} or {\pict\pngblip\picwX\pichY...} where X is the image's width in pixels and Y is the image's height in pixels. The content is simply hex encoded. I suggest adding a newline every so often -- I like adding one every 64 characters, and maybe even before and after the data as a whole. This approach is demonstrated by the rtf_image_embed_sample.pl program in this directory, and its sample input files hypnocat.jpg and hypnocat.png, and output files hypnocat_jpg.rtf and hypnocat_png.rtf. You can stick other, optional, commands between the \pichY and the picture data. Consult the RTF specification's section "Pictures" for all the gory details, but here's a quick reference to the eight interesting ones: \picwgoalN Desired width of the picture, in twips. \pichgoalN Desired height of the picture, in twips. \picscalexN Horizontal scaling value. The N argument is a value representing a percentage (the default is 100 percent). \picscaleyN Vertical scaling value. The N argument is a value representing a percentage (the default is 100 percent). \piccroptN \piccropbN \piccroprN \piccroplN The top, bottom, right, and left cropping values, in twips. A positive value crops toward the center of the picture; a negative value crops away from the center, adding a space border around the picture (the default value is 0). Remember, that's just quick reference; the spec is more detailed, mostly for options that used only with embedding image types other than PNG and JPG. </pre> Gefunden in ![]() dies wiederum gefunden auf ![]() dies wiederum gefunden auf ![]() dies wiederum gefunden auf ![]() dies wiederum gefunden auf ![]() dies wiederum gefunden auf ![]() dies wiederum gefunden auf ![]() dies wiederum gefunden per Google-Groups-Suche nach "html2rtf". -- VolkerGlave |
Ja, ich kenn die Stelle, aber ich glaube nicht, dass diese Andeutungen tragen. Das Problem ist bekannt und lästig. Es würde Anwendungs-Beispiele im Netz dazu geben. Ich würde mir aber wünschen, dass ich mich irre. -- HelmutLeitner |
RTF Format ohne Kompression für Bilder | ![]() |
Bei der kürzlichen Beschäftigung mit dem RTF-Format (mit dem Ziel HTML- und Wiki-Seiten in RTF zu konvertieren und downloadbar zu machen) musste ich feststellen, dass dieses Format keine Kompression für die im Text enthaltenen Bilder unterstützt. Zusammen damit, das Bytes als 2-stelliges Hex codiert werden, blähen sich Dateien mit Bildmaterial auf das 10-30-fache Volumen auf. Dateien mit einigen 0.1-1 GB sind so keine Seltenheit. Zumindest ein simples RLE-Verfahren wäre kinderleicht zu implementieren gewesen und hätte diese Situation entspannt. Besser wäre die binären Abbildung der Originalfiles im Text. RTF existiert schon lange und mittlerweile in Version 1.7, das Problem muss bekannt sein, genug Zeit das zu implementieren. Schande über die Leute, die für dieses Format zuständig sind. -- HelmutLeitner