Re: PDF to TIFF hash - Avoid date/time reference

Chris Liddell <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.devel
Message-ID <CAGy8pWpAYcSKHg47ziMB39tF4ejyDWG0PRJ4kMq-w4VtziYQ4w@mail.gmail.com>
On 1 December 2015 at 07:44, Giacomo Boccardo <[email protected]> wrote:
> Hi,
>     I'm using Ghostscript to extract pages' images from a PDF using a
> command like:
>
> gs -dQUIET -dNOPAUSE -dBATCH -dSAFER -dFirstPage=1 -dLastPage=1
> -dBandHeight=100 -dNOPAUSE -sDEVICE=tiff12nc -r200
> -dNumRenderingThreads=2 -dBandBufferSpace=500000000
> -dBufferSpace=750000000 -sBandListStorage=memory -sOutputFile=page1.tiff
> input.pdf
>
> For caching purposes I need that the hash of each tiff must be the same
> if it's produced from the same page. Unfortunately, I noticed that a
> date/time reference is added at the "beginning" (prolog?) of each file.
> That's the only thing that alters the hash: if you produce images in the
> same second, the hash is the same.
>
> So, is it possible to avoid to add that time reference?
> If it's not possible, is there a way to test if two tiffs have the same
> "appearance", without considering the metadata?

You cannot disable that, to the best of my knowledge. I'm not even
sure it's something we have control over - I'd have to look at the
source, and I don't have time right now.

libtiff comes with a few tools that exercise the library, one being
tiffcmp which compares the image samples byte-for-byte. That may
satisfy your requirements.

On Linux distros, they're usually packaged under a name like "libtiff-tools".

> I suppose the last chance is to change the source code and recompile it :)

When I have some time, I'll check the gs source, and see if it is
something we control, or if it's something libtiff does automagically
- I certainly won't be changing the libtiff code!

Chris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.