LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-31-2009, 09:30 AM   #1
senseproof
Member
 
Registered: May 2009
Distribution: Fedora 10
Posts: 31
Blog Entries: 5

Rep: Reputation: 16
Why do I need to add the option -dEPSFitPage to ghostscript? (Is my math wrong?)


At first this was a huge question but I solved the problem myself by discovering the -dEPSFitPage option. The so now it's a short question, why do I need to use this option? What is wrong with my maths here?

Here is my original scanned image (bzipped to a tiny size). I converted it to postscript with:

pnmtops -dpi=300 -width 142.5 -height 190 <image-0005.pnm >correctly-sized.ps

The result of that conversion is here.

So now I want a PDF. I try this, with the points and pixels specified as I think they should be (pnmtops accepts sizes in mm):

gs -dCompatibilityLevel=1.4 -dSAFER -dFIXEDMEDIA -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=403.93700797 -dDEVICEHEIGHTPOINTS=538.58267730 -dDEVICEWIDTHPIXELS=1683 -dDEVICEHEIGHTPIXELS=2244 -sOutputFile=test.pdf -f correctly-sized.ps

But that doesn't work. I have to add the -dEPSFitPage option and then I get the result I expect.

As one final sanity check, I go back to my xsane batch settings and check:

Size of images is 19.00 cm by 14.25 cm. Scan was taken at 300 dpi and then forced to 300 dpi with pnmtops anyway, which is also the default dpi for pnmtops.

This is 190 x 142.5 mm. I reversed width and height to pnmtops, it's clever enough to realise it should rotate the image if I do that, it wasn't a mistake.

DPI = Dots Per Inch = Pixels. If I google "mm in inch" it says:

1 inch = 25.4 millimeters

( 190 / 25.4 ) * 300 = 2244 pixels high.
( 142.5 / 25.4 ) * 300 = 1683 pixels wide, so it seems I gave the right numbers. Since I had to tell ghostscript to resize I suppose I didn't.

What went wrong?

Last edited by senseproof; 05-31-2009 at 09:32 AM. Reason: one word wrong
 
Old 06-02-2009, 05:57 PM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Initial and quick thought is, you didn't account for borders/margins in the pdf?

Also what do you mean when you say "it doesn't work" what do you get as output? Nothing? Broken? etc
 
  


Reply

Tags
ghostscript, gs


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mount: wrong fs type, bad option kginige Linux - Hardware 5 04-26-2007 09:26 AM
How can I add support for math emulation? Crysm Linux - Newbie 15 02-07-2006 06:11 AM
wrong fs type, bad option, etc. etc. lyceum Linux - Newbie 4 06-28-2004 03:18 PM
What is wrong with pdf files created by Ghostscript? J_Szucs Linux - Software 2 02-01-2004 10:45 AM
KPPP - wrong option 'passwordfd' guerilla fighta Linux - Software 7 02-12-2003 05:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration