• [Apache FOP] tiff output is blurred.

    From Michael Uplawski@michael.uplawski@uplawski.eu to comp.text.pdf,comp.text.xml on Tue Jun 16 09:31:56 2026
    From Newsgroup: comp.text.pdf

    Good morning

    I want to use Apache FOP to create TIFF from XML (via FO). The
    objective is to transform these TIFFs to PDF and thus create
    machine-unreadable documents.

    The command in question is thus:
    ----------
    fop -c ~/bin/fop-2.11/fop/conf/fop.xconf -fo "infile.fo" -tiff "/tmp/out.tif" ---------

    The Tiff renderer is configured like this:
    -----------
    <renderer mime="image/tiff">
    <rendering>quality</rendering>
    <anti-aliasing>true</anti-aliasing>
    <compression>NONE</compression>
    <source-resolution>600</source-resolution>
    <target-resolution>600</target-resolution>
    <!--transparent-page-background>true</transparent-page-background-->
    <!--compression>CCITT T.6</compression-->
    </renderer>
    ------------

    I am unable to manipulate the resolution of the resulting TIFF,
    text is still blurred, irrespective of my settings.
    My workaround is for the time to create PDF from FO, then to use the Ghostscript and the LIBTiff tools to transform the PDF to tiff and
    back to PDF. This way both versions of the PDF are equally readable,
    only file sizes differ.

    I would like to know if rCo once the resolution problems solved rCo fop produces smaller tiff files.

    Do you have any hints?

    Cheerio

    f'up comp.text.pdf
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Peter Flynn@peter@silmaril.ie to comp.text.pdf on Thu Jul 2 23:07:59 2026
    From Newsgroup: comp.text.pdf

    On 16/06/2026 08:31, Michael Uplawski wrote:
    Good morning

    I want to use Apache FOP to create TIFF from XML (via FO). The
    objective is to transform these TIFFs to PDF and thus create machine-unreadable documents.

    Is there a reason why you are going via TIFF, instead of converting the
    PDF to page images and rebuilding the PDF from them?

    The command in question is thus:
    ----------
    fop -c ~/bin/fop-2.11/fop/conf/fop.xconf -fo "infile.fo" -tiff "/tmp/out.tif" ---------

    I use XSLT to create LaTeX to get PDF, but I can convert a PDF to TIFF
    with Imagemagick:

    convert -density 600 page.pdf -resample 600x600 page.tiff

    The standard tiff2pdf cannot handle the 16-bit TIFF file, but
    Imagemagick can convert back to PDF. The problem is file size:

    -rw-rw-r-- 1 peter peter 86774 Jul 2 22:47 page.pdf
    -rw-rw-r-- 1 peter peter 278454850 Jul 2 22:55 page.tiff
    -rw-rw-r-- 1 peter peter 138891446 Jul 2 23:02 newpage.pdf

    Using the same conversion but omitting the resampling and creating JPG
    gives much smaller file sizes:

    -rw-rw-r-- 1 peter peter 86774 Jul 2 22:47 page.pdf
    -rw-rw-r-- 1 peter peter 5637811 Jul 2 23:05 page.jpg
    -rw-rw-r-- 1 peter peter 5635861 Jul 2 23:05 newpage.pdf

    But perhaps there are other reasons for using TIFF.

    Peter

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Michael Uplawski@michael.uplawski@uplawski.eu to comp.text.pdf on Fri Jul 3 06:50:26 2026
    From Newsgroup: comp.text.pdf

    Good morning

    and thank you Peter for responding.

    I have tried to be as specific and precise as possible, but there
    are zones where my Engish may not really be sufficient.

    Let me first repeat the phrase from the bottom of my OP, above:

    rCLI would like to know if rCo once the resolution problems solved rCo fop produces smaller tiff files.rCY

    Now I react ;)

    Peter Flynn wrote in comp.text.pdf:
    On 16/06/2026 08:31, Michael Uplawski wrote:

    I want to use Apache FOP to create TIFF from XML (via FO). The
    objective is to transform these TIFFs to PDF and thus create >>machine-unreadable documents.

    Is there a reason why you are going via TIFF, instead of converting the
    PDF to page images and rebuilding the PDF from them?

    Yes. As I do PDF -> TIFF -> PDF to achieve the same objective, an
    alternative that I have not been aware of, has stirred my interest.

    I use XSLT to create LaTeX to get PDF, but I can convert a PDF to TIFF
    with Imagemagick:

    convert -density 600 page.pdf -resample 600x600 page.tiff

    I use ghostscript because I can thus manipulate resolutions and
    stuff. But with convert, I convert PDF to monochrome which
    (sometimes) results in smaller PDF files, albeit converted again
    from TIFF. This is because Word processors add a lot of superfluous
    stuff to a PDF.

    The standard tiff2pdf cannot handle the 16-bit TIFF file, but
    Imagemagick can convert back to PDF. The problem is file size:

    -rw-rw-r-- 1 peter peter 86774 Jul 2 22:47 page.pdf
    -rw-rw-r-- 1 peter peter 278454850 Jul 2 22:55 page.tiff
    -rw-rw-r-- 1 peter peter 138891446 Jul 2 23:02 newpage.pdf

    Using the same conversion but omitting the resampling and creating JPG
    gives much smaller file sizes:

    -rw-rw-r-- 1 peter peter 86774 Jul 2 22:47 page.pdf
    -rw-rw-r-- 1 peter peter 5637811 Jul 2 23:05 page.jpg
    -rw-rw-r-- 1 peter peter 5635861 Jul 2 23:05 newpage.pdf

    But perhaps there are other reasons for using TIFF.

    I *believe* that in the beginning, I had been after something
    / lossless / but it is also possible that I had stumbled over
    Ghostscript and rCo being unable to comprehend that monster rCo had
    hammered together a first rCo and surprisingly runnable rCo script.

    Now, the possibility to create
    -) smaller
    -) machine - unreadable PDF-files
    has been important to me, notably when I send around files to public
    services or to my Boss.

    Really, I arrive at doing what I want, but I have never been able to
    compare the TIFFs that FOP should be able to produce to those that I
    get from Ghostscript. The procedures may be complicated (or not),
    but comparing two files is too simple a task.., I should be able to
    do that.

    Cheerio
    --
    rCLI watched with glee, While your kings and queens,
    fought for ten decades, For the gods they maderCY
    (Sympathy for the Devil)
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Peter Flynn@peter@silmaril.ie to comp.text.pdf on Wed Jul 15 22:40:04 2026
    From Newsgroup: comp.text.pdf

    On 03/07/2026 05:50, Michael Uplawski wrote:
    [...]
    are zones where my English may not really be sufficient.

    Your English is excellent.

    Let me first repeat the phrase from the bottom of my OP, above:

    rCLI would like to know if rCo once the resolution problems solved rCo fop produces smaller tiff files.rCY

    I can't answer that because I don't use fop.
    I do know that TIFF files are notoriously large.

    [...]
    I use ghostscript because I can thus manipulate resolutions and
    stuff. But with convert, I convert PDF to monochrome which
    (sometimes) results in smaller PDF files, albeit converted again
    from TIFF. This is because Word processors add a lot of superfluous
    stuff to a PDF.

    That is why I never use them.

    I *believe* that in the beginning, I had been after something
    / lossless / but it is also possible that I had stumbled over
    Ghostscript

    JPG is a lossy format. Maybe if you converted to PNG, set to lossless,
    that would perform better than TIFF.

    and rCo being unable to comprehend that monster rCo had
    hammered together a first rCo and surprisingly runnable rCo script.

    Ghostscript is very powerful but a little monstrous :-)

    Now, the possibility to create
    -) smaller
    -) machine - unreadable PDF-files
    has been important to me, notably when I send around files to public
    services or to my Boss.

    Because you don't want the text copied?

    Really, I arrive at doing what I want, but I have never been able to
    compare the TIFFs that FOP should be able to produce to those that I
    get from Ghostscript. The procedures may be complicated (or not),
    but comparing two files is too simple a task.., I should be able to
    do that.

    Good luck

    Peter
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Michael Uplawski@michael.uplawski@uplawski.eu to comp.text.pdf on Thu Jul 16 09:58:40 2026
    From Newsgroup: comp.text.pdf

    Peter Flynn wrote in comp.text.pdf:

    I *believe* that in the beginning, I had been after something
    / lossless / but it is also possible that I had stumbled over
    Ghostscript

    JPG is a lossy format. Maybe if you converted to PNG, set to lossless,
    that would perform better than TIFF.

    I have tried that. Although in some cases rCo and taking into account
    pictures that may already be embedded in the PDF rCo PNG can bring
    some advantage, the ZIP compression in PDF does compensate most of
    it, irrespective of the picture format.

    Now, the possibility to create
    -) smaller
    -) machine - unreadable PDF-files
    has been important to me, notably when I send around files to public >>services or to my Boss.

    Because you don't want the text copied?

    Several implications of different impact. That my PDF content is not
    (easily) chopped into pieces has its charm. But this is *France* and
    most Public Services that claim (by imperial decree) to master
    -2 Informatics -+ (meaning: rCLThe WebrCY), do not (but won't admit it).

    Difficulties are avoided by quite simply banning all specificity
    from my documents. As for my Boss, this is a certitude.

    Another thing that is spooking in my mind for a while, is
    handwritten hypertext. Although I have created a bit for the
    Web rCoru+1, it
    appears to make even more sense in PDF.

    But this has nothing to do with TIFF or FOP and is finally off topic
    in this discussion.

    Cheerio

    Michael
    ----------------
    1) Handwriting to Hypertext:
    <https://www.uplawski.eu/div/handwriting_to_hypertext/page1.html>
    --
    Whatever you do rCo try to have a reason to do it.
    (Winston Groom / Forest Gump)
    --- Synchronet 3.22a-Linux NewsLink 1.2