Page 1 of 1

PDF TO TIF COMPARISION

Posted: 2010-06-23T13:00:01-07:00
by SIDDARTH
Can we compare PDF and TIFF using "compare.exe" in imagemagick.

-------------------------
Scenario:

I have a PDF file which i am converting to indivuidual tiff's.

After conversion, can i compare the tiff and individual PDF pages for consistency in conversion using "compare.exe"

***tiff is group4 compression so its black&white.The PDF may be in Colour
------------------------

Kindly Help,
Thanks.

Re: PDF TO TIF COMPARISION

Posted: 2010-06-23T15:56:45-07:00
by snibgo
Best to convert them both, if necessary, to lowest common denominator before comparing, especially as PDFs can contain vector graphics.

Re: PDF TO TIF COMPARISION

Posted: 2010-06-24T09:43:16-07:00
by SIDDARTH
I am already converting them from pdf to tiff and reconverting them again for comparision is not an option.

Please let me know if there is any way to compare source pdf and target tiff for consistency in conversion.

kindly help.
:(

Re: PDF TO TIF COMPARISION

Posted: 2010-06-24T11:21:47-07:00
by snibgo
I don't know what you mean by "consistency in conversion", but try:

compare -metric RMSE x.pdf x.tif NULL:

Re: PDF TO TIF COMPARISION

Posted: 2010-06-24T11:42:51-07:00
by Drarakel
@Siddarth: I'm also not sure about what you're trying to achieve. Try to describe a specific case.

Note that if you do a comparison like that:
convert input.pdf image.tif
compare -metric RMSE input.pdf image.tif null:
That it will always give you a difference of 0. And image.tif could still be 'bad' (from the rasterizing process). And in other cases you could end up comparing different colorspaces, which won't help you a bit.
Directly comparing to the PDF will only be useful if you want to know about the differences that you applied to the image after 'rasterizing' (the first result that ImageMagick gets when converting a PDF).

Re: PDF TO TIF COMPARISION

Posted: 2010-06-24T11:46:15-07:00
by SIDDARTH
Thank you for the reply.

Consistency meaning:

How do i know the page in PDF and the individual tiff are not missing any information.

------------------------------
For Example:

Page 1 in PDF has one image and one paragraph.How do I know that the tiff is not missing any of them.

------------------------------

what does NULL represent in the "compare -metric RMSE x.pdf x.tif NULL:"

Kindly help

Thanks :(

Sid

Re: PDF TO TIF COMPARISION

Posted: 2010-06-24T11:59:05-07:00
by SIDDARTH
@ Drarakel

Thank you for replying.Below is my scenario.

My Scenario:
---------------------

I am converting a PDF to group4 compression tiff's.Manually i can see that by comparing whether there is an error while converting or not(if any content is missing or poorly created).

But it would be good if it can be done by Compare.exe.

Issues encountered:

i) PDF may be in colour. So comparison may have to take place between colored PDFs and black & white tiffs(group4 compression id B&W).

ii) Resolution is different for both pdf and tiff

iii) Comparision has to take place between pages in PDF to individual tiff's.(have tried but no sucess)

---------------------

Appreciate your help
Thank you :(

Re: PDF TO TIF COMPARISION

Posted: 2010-06-24T12:28:00-07:00
by Drarakel
SIDDARTH wrote:what does NULL represent in the "compare -metric RMSE x.pdf x.tif NULL:"
This only shows the comparison statistics and doesn't create an image with the differences (the output goes to NULL device). See the examples here.
SIDDARTH wrote:Page 1 in PDF has one image and one paragraph.How do I know that the tiff is not missing any of them.
You can't. Not with ImageMagick alone. You can watch for error messages, but apart from that.. There's no alternative in looking at the output file by yourself.
When you're first converting a PDF to a TIF and there are elements missing - why do you think that compare should know that these elements are in the PDF? That would be illogical. :)

Your points (i) and (iii) in your last post are no real problem with the right commands. But as I said, comparing directly to the PDF won't be very helpful for your goal.
SIDDARTH wrote:ii) Resolution is different for both pdf and tiff
There's no fixed resolution in PDFs. If you want a larger image, then specify a density value, e.g. 300dpi - like that:
convert -density 300 input.pdf image.tif
The standard density value used for rasterization is 72dpi.

Re: PDF TO TIF COMPARISION

Posted: 2010-06-24T13:02:17-07:00
by SIDDARTH
@ Drarakel
You can't. Not with ImageMagick alone. You can watch for error messages, but apart from that.. There's no alternative in looking at the output file by yourself.
When you're first converting a PDF to a TIF and there are elements missing - why do you think that compare should know that these elements are in the PDF? That would be illogical.
The reason i want to use compare is to know whther the conversion has happened succesfully without missing anything or not.

If it was possible i would use the compare.exe to compare and find out if anything is missing.Unfortunately its not.

Please let me know any other way possible.
Thanks.

Re: PDF TO TIF COMPARISION

Posted: 2010-06-24T16:28:28-07:00
by Drarakel
So if you have a case where some elements are missing... How do YOU know that these are missing? By opening the PDF in another software (not ImageMagick/Ghostscript)? If this software could display 100% of all PDFs without problems (unlikely), then you would have to use that software to output the PDF to a e.g. TIF file and THEN theoretically, you could use 'compare' to compare the IM TIF and the other software's image. But if the output of another software is so easy to get and always without problems, then you wouldn't need ImageMagick/Ghostscript to begin with - right? In Germany, we have a saying for something like that - could be translated with "the cat bites in its own tail" (well, not really translatable).. :wink:
ImageMagick's compare is not a specialized PDF tool - it's just a (quite useful) tool to compare two images.

But if you have a real case where you have problems, then post your input/output files and what you expected to get.
Then some user might be able to help.

Re: PDF TO TIF COMPARISION

Posted: 2010-06-25T06:58:13-07:00
by SIDDARTH
@ Drarakel

I have till now not had an issue with Imagemagick converting PDF TO TIFF''s.But because of the importance & volume of PDF's being converted,I need to validate the target file with the source.

I have not put the product i am developing in production as yet.If Anything happens it would be FATAL.

Well let me know any ideas

Thank you,
:)