How do I convert PDF to TIFF (300 DPI resolution)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
AnthonyC84
Posts: 16
Joined: 2017-01-23T07:50:07-07:00
Authentication code: 1151

How do I convert PDF to TIFF (300 DPI resolution)

Post by AnthonyC84 »

Hi,

I just downloaded this program and I'm not use to cmd line script. I'm a total N00b getting invalid parameter errors. All help would be appreciated.

I have a folder called PDF2Tiff on my Desktop with a pdf file called Test.pdf. I would like to know what command I need to type in so that I can convert this file to many tiff files (one tiff file for each page of the pdf with sequential numbering) with a DPI of 300 and have the files output in the same folder. Are there any file compression commands that need to be used?

Thank you!

Also, as an extension. If I have a bunch of numbered tiff files, what command would I use to create a PDF provided that they are in the same folder.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How do I convert PDF to TIFF (300 DPI resolution)

Post by snibgo »

What version of IM did you download? Was it v6 or v7?

What is your platform? What command have you tried? What was the exact message you got back?
AnthonyC84 wrote:... getting invalid parameter errors
I'll take a wild guess: you are on Windows, and tried the "convert" command. But you haven't set it up correctly, so are running the Microsoft program instead.
snibgo's IM pages: im.snibgo.com
AnthonyC84
Posts: 16
Joined: 2017-01-23T07:50:07-07:00
Authentication code: 1151

Re: How do I convert PDF to TIFF (300 DPI resolution)

Post by AnthonyC84 »

snibgo wrote: 2017-01-23T08:11:05-07:00 What version of IM did you download? Was it v6 or v7?

What is your platform? What command have you tried? What was the exact message you got back?
AnthonyC84 wrote:... getting invalid parameter errors
I'll take a wild guess: you are on Windows, and tried the "convert" command. But you haven't set it up correctly, so are running the Microsoft program instead.
I am on Windows 7 x64. I downloaded the latest version of ImageMagick. The file I installed was ImageMagick-7.0.4-5-Q16-x64-dll

Yes I was trying to use the convert command at first. I know the density command exists for changing the resolution but didn't attempt it as I wanted to just get the conversion down first.

Thank you for helping!
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: How do I convert PDF to TIFF (300 DPI resolution)

Post by Bonzo »

Try replacing convert with magick
AnthonyC84
Posts: 16
Joined: 2017-01-23T07:50:07-07:00
Authentication code: 1151

Re: How do I convert PDF to TIFF (300 DPI resolution)

Post by AnthonyC84 »

Bonzo wrote: 2017-01-23T08:31:53-07:00 Try replacing convert with magick
Thank you for that.

Provided I change my directory to where my file is in cmd and then use magick, I can get the conversion to work. However, the images I get are blurry and lack detail. I have a bunch of mathematical formulas and graphs which are turning out to be of very poor quality. The command that I am using now is

> magick test.pdf -density 300x300 test.tiff

Is there any way to change the compression option (LZW perhaps) for the tiff file? Is this the reason why my files are blurry?
AnthonyC84
Posts: 16
Joined: 2017-01-23T07:50:07-07:00
Authentication code: 1151

Re: How do I convert PDF to TIFF (300 DPI resolution)

Post by AnthonyC84 »

Ok after some testing I have finally got this working to the way I need it to.

My only inquiry now is whether I can add in LZW image compression to my TIFF files to try and reduce the file size. The command I am using now is

> convert -density 300 test.pdf test_%d.tiff

I am now able to use the convert command. There was an option to install legacy commands in the install of v7 that I didn't notice when I first installed the program.

Also, if I have files named test1.tiff, test2.tiff, test3.tiff .... test50.tiff. How would I convert all 50 tiff images to a single pdf document with the same resolution.

Edit: Realized the compression command. Now using

> convert -density 300 -compress lzw -units 2 "test.ptf" "test_%d.tiff"

I'm really starting to like this program. Soo much to learn!

Edit 2: To convert from multiple tiff files to pdf I am sort of using a noob way where I just put cmd into the directory where all the tiff files are and I'm using the command > convert *.tiff -compress jpeg Test2.pdf. Are there any useful commands that should be used when converting tiff to pdf to retain image quality?

In a previous post I saw someone using
convert -limit memory 0 -limit map 0 *tiff -compress jpeg -quality 100 Output.pdf
Last edited by AnthonyC84 on 2017-01-23T11:22:38-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How do I convert PDF to TIFF (300 DPI resolution)

Post by snibgo »

AnthonyC84 wrote:Also, if I have files named test1.tiff, test2.tiff, test3.tiff .... test50.tiff. How would I convert all 50 tiff images to a single pdf document with the same resolution.
With this command:

Code: Select all

convert test1.tiff, test2.tiff, test3.tiff .... test50.tiff. out.pdf
All your inputs must be listed. You could use just "test*.tiff" instead, but they would be in the wrong order because you haven't used leading zeros.
snibgo's IM pages: im.snibgo.com
AnthonyC84
Posts: 16
Joined: 2017-01-23T07:50:07-07:00
Authentication code: 1151

Re: How do I convert PDF to TIFF (300 DPI resolution)

Post by AnthonyC84 »

snibgo wrote: 2017-01-23T11:07:07-07:00
AnthonyC84 wrote:Also, if I have files named test1.tiff, test2.tiff, test3.tiff .... test50.tiff. How would I convert all 50 tiff images to a single pdf document with the same resolution.
With this command:

Code: Select all

convert test1.tiff, test2.tiff, test3.tiff .... test50.tiff. out.pdf
All your inputs must be listed. You could use just "test*.tiff" instead, but they would be in the wrong order because you haven't used leading zeros.
Thank you for the tip. Now using

> convert -density 300 -compress lzw -units 2 "Input.pdf" "Output_%03d.tiff"
to get leading zeros for 100+ page tiff document.

Still trying to learn optimal settings for producing a pdf document from the tiff files.

Currently using > convert *.tiff -compress jpeg Test2.pdf
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do I convert PDF to TIFF (300 DPI resolution)

Post by fmw42 »

I do not know if pdf actually supports JPEG compression.

With respect to -units 2, I do not believe that numerical values are allowed. It is either pixelsperinch or pixelspercentimeter.
AnthonyC84
Posts: 16
Joined: 2017-01-23T07:50:07-07:00
Authentication code: 1151

Re: How do I convert PDF to TIFF (300 DPI resolution)

Post by AnthonyC84 »

fmw42 wrote: 2017-01-23T11:58:08-07:00 I do not know if pdf actually supports JPEG compression.

With respect to -units 2, I do not believe that numerical values are allowed. It is either pixelsperinch or pixelspercentimeter.
I saw the compression from a different forum post. After testing with and without the compression method, when I insert -compress jpeg, the file size ends up being 3x larger than what it is without the command. I will now be scrapping it. I tried -quality 100 but that returned the same file size. I can only assume that 100 is default when it is not specified.

With regards to -units I saw this code on a different post. I looked up different tiff files I have and under their properties, it said Resolution unit 2. When I didn't put in the units, the properties said 1. Since all of my other tiff files had 2, I figured I'd just slot that in. I'm not too sure if it is making any impact.
Last edited by AnthonyC84 on 2017-01-23T12:22:11-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do I convert PDF to TIFF (300 DPI resolution)

Post by fmw42 »

What are those references. I believe they are wrong or pertain to some other software. Or you have misunderstood what they are telling you about -units.

See
http://www.imagemagick.org/script/comma ... .php#units
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do I convert PDF to TIFF (300 DPI resolution)

Post by fmw42 »

I am apparently wrong about PDF and JPEG compression. This reference seems to show that PDF does support JPEG compression. https://www.prepressure.com/pdf/basics/compression
AnthonyC84
Posts: 16
Joined: 2017-01-23T07:50:07-07:00
Authentication code: 1151

Re: How do I convert PDF to TIFF (300 DPI resolution)

Post by AnthonyC84 »

fmw42 wrote: 2017-01-23T12:17:42-07:00 What are those references. I believe they are wrong or pertain to some other software. Or you have misunderstood what they are telling you about -units.

See
http://www.imagemagick.org/script/comma ... .php#units
I compared file sizes with and without the -units command. Both returned the same file size aside from one property of the file being changed. Namely, if you go to the file, right click to go to properties then go into the details tab, the Resolution unit says 1 w/o command and 2 with the command. I don't see any major difference. I will scrap the command.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do I convert PDF to TIFF (300 DPI resolution)

Post by fmw42 »

Units make no difference in image file size. They control the size when printed (resolution converted from pixels to inches or centimeters)

With regard to your units numerical values, those are coming from your Window? interpretation of the units, not the units that are defined by IM. For example -units pixelsperinch might be interpreted by your Windows software as 1 and pixelspercentimeter as 2 and no units as 0. I do not know Windows nor how it presents units.

You should always define -density and -units, so that printers will know exactly how to convert the pixels to print dimensions.
AnthonyC84
Posts: 16
Joined: 2017-01-23T07:50:07-07:00
Authentication code: 1151

Re: How do I convert PDF to TIFF (300 DPI resolution)

Post by AnthonyC84 »

fmw42 wrote: 2017-01-23T12:55:05-07:00 Units make no difference in image file size. They control the size when printed (resolution converted from pixels to inches or centimeters)

With regard to your units numerical values, those are coming from your Window? interpretation of the units, not the units that are defined by IM. For example -units pixelsperinch might be interpreted by your Windows software as 1 and pixelspercentimeter as 2 and no units as 0. I do not know Windows nor how it presents units.

You should always define -density and -units, so that printers will know exactly how to convert the pixels to print dimensions.
I think its safe for me to just avoid using the -units command entirely. The only command that is very important for me is -density. You may be correct for how Windows is interpreting the units. Since I see no difference, I'll just let it be.
Post Reply