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 12-18-2009, 02:40 PM   #1
danutz
LQ Newbie
 
Registered: Oct 2008
Posts: 5

Rep: Reputation: 0
rasterize pdf made up of multiple bitmap slices / page


Hi,

I have a PDF file made up of 4 vertically-stacked bitmap images per page (output from a scan job). Running "pdfimages" on it produces 4 separate images for each page.

I want to produce a single bitmap image for each page, WITHOUT resampling the embedded bitmaps.

ImageMagick's "convert" is not a solution, because it re-samples (resizes) the embedded bitmaps. By default it resamples at 72dpi. The dpi can be changed with the '-density' option, but the "true" dpi is a fractional value (205.72685432...) and so the resolution would always be inexact.

Is there a way to just preserve the resolution of the embedded bitmaps when rendering each page? Both 'convert' and ghostscript annoyingly ignore that intrinsic resolution of the bitmaps and default to 72 dpi.

It seems like such a simple operation, equivalent to displaying each page at 100% in xpdf or acroread. But I don't see any command-line tools to do it.
 
Old 12-21-2009, 09:18 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,115

Rep: Reputation: 218Reputation: 218Reputation: 218
Hi

Why not use pdfimages to pull out the 4 images, and then imagemagick to combine them? If the PDF files always have the same sizes, it shouldn't be very difficult to write a little script to do the job.

For information about doing this with imagemagick:

http://www.imagemagick.org/Usage/montage/

Maybe play with the montage command until you find one that will do the job? And then put it in a little script.
 
Old 12-21-2009, 05:10 PM   #3
danutz
LQ Newbie
 
Registered: Oct 2008
Posts: 5

Original Poster
Rep: Reputation: 0
*sigh*

I ended up doing something like that... However it seems that the slices are not necessarily vertically contiguous (i.e. where there was a vertical gap on the page, the scanning software skipped it). Therefore, after assembling the slices, I obtained pages of varying height.

The fact that pdfimages doesn't report which images came from which page was a big nuisance (the original PDF had some pages with 4 slices and some with a single slice).

At the very least I wish pdfimages could report the location (page, x and y) of the various images it pulls out of a PDF, instead of dumping a heap of sequentially-numbered image files. It seems like such a silly omission. The other thing that I found annoying is imagemagick's propensity to silently resample images.

Oh well, I guess we're lucky to have even these tools...

Last edited by danutz; 12-21-2009 at 05:12 PM.
 
  


Reply

Tags
ghostscript, graphics, imagemagick, pdf


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
how to find PDF page count mfoley Programming 8 02-26-2009 02:55 PM
Web page to PDF miykle Linux - Newbie 2 04-04-2008 05:07 AM
Printing html page to pdf with links MikeyCarter Linux - Software 1 11-16-2006 06:20 PM
Print PDF - blank page Trio3b Linux - General 1 12-10-2005 01:00 AM
printing from multiple pdf files the first page harmster Linux - Software 2 05-09-2005 07:06 AM


All times are GMT -5. The time now is 10:46 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration