Go Back   The macosxhints Forums > OS X Help Requests > UNIX - General



Reply
 
Thread Tools Rating: Thread Rating: 31 votes, 5.00 average. Display Modes
Old 11-17-2002, 12:07 PM   #1
kerim
Major Leaguer
 
Join Date: Jan 2002
Posts: 311
Tiff to PDF Revisited (Ghostscript vs. jpgtoPdf)

I need advice on the *best* way to convert TIFF files to PDF files on Mac OSX. ImageMagick, which I've been trying to use (see here ), just doesn't cut it. It can't handle a large number of Tiff files, even if they are small and compressed. It crashes my computer. However, I see that there are dozens of other programs out there that I might use, but it is overwhelming. Here is a list of links on the subject I have made:

http://kerim.oxus.net/bookmarks/view_group.php?id=99

As you can see, there seem to be dozens of options. Right now I am thinking of using ImageMagick to first convert my scans to PostScript or EPS and then converting those to PDF useing Ghostscript.

(1) ANyone have a better idea? (For instance, using jpgtoPDF?)

(2) What would the command to do this be?

Oh, and I'd like to stick to programs I can install with FINK.

Thanks!
kerim is offline   Reply With Quote
Old 11-17-2002, 02:01 PM   #2
kerim
Major Leaguer
 
Join Date: Jan 2002
Posts: 311
I'm having problems testing out ghostscript.

(1) I can't figure out how to batch convert mulitple files to a single PDF.

ps2pdf *.ps

does NOT work!!!

(2) I can't figure out how to force it to print in landscape mode. There is no landscape paper size, and using the -g variable does not seem to get me anywhere (setting the "geometry"). Maybe I don't have the correct settings?

If I could do both of these then I should be able to at least see how GostScript compares to ImageMagick.
kerim is offline   Reply With Quote
Old 11-17-2002, 03:21 PM   #3
kerim
Major Leaguer
 
Join Date: Jan 2002
Posts: 311
I'm beginning to lose hope. There seem to be some utilities, such as "mpage" and "psmerge" which can merge multiple ps files into a single one, which I could then convert with ghostscript. However, there does not seem to be a FINK installer for either or any of these programs. FINK does have something called "PSutils" which includes a "PSMERGE" command, but I can't get that to work properly either. The Man isn't very helpful and suggests that the command may not work for most uses ... it doesn't give an error, just a useless 8K file...
kerim is offline   Reply With Quote
Old 11-17-2002, 03:28 PM   #4
kerim
Major Leaguer
 
Join Date: Jan 2002
Posts: 311
Interestingly, in 10.2.2, while they have fixed the ability of Preview ot print TIFF files. It seems to only print the first page of multipage TIFF files. The trick of creating a multipage TIFF by draging multiple TIFF files on the PReview.app icon works, but then you can only save the first page... very strange.
kerim is offline   Reply With Quote
Old 11-17-2002, 04:06 PM   #5
osxpez
Major Leaguer
 
Join Date: May 2002
Location: Sweden
Posts: 282
Kerim. You get little help with this TIFF to PDF thingy I see. It seems to be two problems; 1) converting TIFF to PDF, 2) merging several PS (TIFF?) files into one single for PDF-conversion?

Have you found a way to do the TIFF to PDF conversion? Since you talked about dragging TIFF files to Preview.app I tried with TextEdit.app (that is, I dragged the files to an open TextEdit document window). It seems to work, though I'm not sure the quality of the images will do for your purposes. If it is then this solves both the problems.

Also I think that it might be easier to find a utility that merges several PDF files rather than ps files. One such "utility" is Adobe's own Acrobat program. But I would be surprised if there's not an open source alternative around.

I'll keep my eyes open for this.

Regards,
__________________
/PEZ
osxpez is offline   Reply With Quote
Old 11-17-2002, 04:24 PM   #6
kerim
Major Leaguer
 
Join Date: Jan 2002
Posts: 311
Well, I can convert TIFF to pdf directly with ImageMagick, GraphicConverter, Omnipage Pro, preview, but there are problems with all of these methods. If you see the linked thread at the top I am trying to find something that will automate the process on large batch jobs. Most of these programs fail for one reason or another. Mostly of the drag-and-drop programs can't handle properly maintaining the page order of imported files even if they are numbered sequetially!!! And some of the programs produce corrupted output, while others simply crash because of memory problems. So the problem is finding something reliable.

It seems that if I go from Multipage PS files to PDF I could use GhostScript to produce the PDF, but that still requires creating a multipage PS file, and I don't see a standalone utility for that. I could also possibly try another route:

convert all the pictures to JPGs and then use jpg2pdf. I haven't tried this yet because this is a shareware utility and I'm also worried about what settings I would need on the JPG files ot make them print as nicely as TIFF or PS files. I'm sur e this is possible, but I'll have to keep at it. IF you learn anything let me know!
kerim is offline   Reply With Quote
Old 11-17-2002, 04:29 PM   #7
osxpez
Major Leaguer
 
Join Date: May 2002
Location: Sweden
Posts: 282
Creating the multipage PS file could be tricky.. But it might work to create multiple PDF files and convert them with pdf2ps and then ps-merge those PS files. Tried that?
__________________
/PEZ
osxpez is offline   Reply With Quote
Old 11-17-2002, 04:38 PM   #8
kerim
Major Leaguer
 
Join Date: Jan 2002
Posts: 311
Now there is a sick but possibly brilliant idea.

Right now I'm trying jpg2pdf. IT is $65 shareware, so if your method works it could save me some $$$.

I'll report back on both methods...
kerim is offline   Reply With Quote
Old 11-17-2002, 04:43 PM   #9
kerim
Major Leaguer
 
Join Date: Jan 2002
Posts: 311
Well, jpg2pdf gave me this:

Quote:
This is an UNREGISTERED version of jpg2pdf.
Registration fee is $65.
Register NOW via a SECURE SERVER at
http://www.regsoft.net/purchase.php3?productid=10644
or contact SANFACE Software mailto:sanface@sanface.com


jpg2pdf: gray jpegs and cmyk jpegs are supported only by jpg2pdf PRO

So it isn't really shareware - you can't even try it. Moreover, you need the pro version to do greyscale jpgs...
kerim is offline   Reply With Quote
Old 11-17-2002, 04:45 PM   #10
kerim
Major Leaguer
 
Join Date: Jan 2002
Posts: 311
Quote:
Originally posted by osxpez
Creating the multipage PS file could be tricky.. But it might work to create multiple PDF files and convert them with pdf2ps and then ps-merge those PS files. Tried that?


Wait, I read this again - this is what I was trying to do. Do you know how to merge PS files? This is what I needed to know. I couldn'g figure it out. If I can do that then Ghostscript can turn it into a pdf. You see, I don't even need to do pdf2ps because Imagemagick can output in PS, so I already have multiple PS files - I just can't find any way to merge them from the command line!
kerim is offline   Reply With Quote
Old 11-17-2002, 04:57 PM   #11
osxpez
Major Leaguer
 
Join Date: May 2002
Location: Sweden
Posts: 282
The ides with pdf2ps would be to satisfy psmerge's requirement that those PS files should come from the same source. But you're correct that it's a bit icky. However, I might have found a less icky solution for you. Running "fink list" I saw the "libtiff" package and installed it. It comes with a utility that's named tiff2ps, how about that? I used it like this:
Code:
$ tiff2ps *.tiff > tiffs.ps
$ ps2pdf tiffs.ps
Which gave me a file "tiffs.pdf". (Yes, I had to also fink install ghostscript6-nox, but I was about to anyway, now that I have got my Fink install working again.
__________________
/PEZ
osxpez is offline   Reply With Quote
Old 11-17-2002, 05:31 PM   #12
kerim
Major Leaguer
 
Join Date: Jan 2002
Posts: 311
Turns out I already had that installed! Didn't even know it. Boy is it fast! And this seems to be *the* solution - except for a small glitch that can probably be fixed.

The problem I have is that the resulting PDF file was all screwed up. Each page was only showing a portion of the original page. I need to learn how to set ps2pdf to properly align the image in landscape and also to keep the resolution smaller so that the whole TIFF appears on the page.

Thanks a lot - I was about to give up but this gives me renewed hope!
kerim is offline   Reply With Quote
Old 11-17-2002, 06:17 PM   #13
kerim
Major Leaguer
 
Join Date: Jan 2002
Posts: 311
Talking What works!

This seems to work! And it is like a zillion times faster than using ImageMagick.

Code:
tiff2ps -h 8.5 -w 11 *.tiff > tiffs.ps
ps2pdfwr -g7920x6120 tiffs.ps
It is so much faster than ImageMagick, I'm wondering if I cant use some other libtiff utilities to do what I a need to do. Or at least some of the work. I still need ImageMagick for the wonderful filtering it does (Photoshop style "unsharp mask", etc.)

Thanks for your help - this really saves me!
kerim is offline   Reply With Quote
Old 11-18-2002, 12:38 AM   #14
kerim
Major Leaguer
 
Join Date: Jan 2002
Posts: 311
See here for the new script. Seems to be working OK, although I still need to do some tests to make sure that it is working all the time. I had some errors that may just be from corrupted files. Still, the script should be helpful to anyone who is trying to do such conversions, and the commands in this thread should be enough for anyone who just wants to go from TIF to PDF (without doing any batch filtering, cropping, etc.)
kerim is offline   Reply With Quote
Old 11-18-2002, 07:49 AM   #15
osxpez
Major Leaguer
 
Join Date: May 2002
Location: Sweden
Posts: 282
Another way, which may or may not work, could be to use imagemagick to merge the PS files. Like:

% bash
$ for f in *.tiff; do convert [options] $f $f.ps; done
$ convert *.ps merged.ps
$ ps2pdf merged.pdf

The last two steps could be combined:

$ convert *.ps ps:- | ps2pdf - merged.pdf

I'm new to imagemagick as of today so I can't be trusted with advice on it really.
__________________
/PEZ
osxpez is offline   Reply With Quote
Old 11-18-2002, 10:04 AM   #16
kerim
Major Leaguer
 
Join Date: Jan 2002
Posts: 311
Yes, I could use ImageMagick, but the reason I set up this thread is that ImagMagick does not do well with processor use or memory use in OS X. At least not the FINK install of ImageMagick. It is ok when doing one file a time, but when doing a merge it screws up. I see that you have found a way of doing it that doesn't use the imagemagick "-adjoin" command, so it might work better, but I'm quite happy with the alternative method as it seems to be so much faster and less processor intensive than ImageMagick. It is like night and day.
kerim is offline   Reply With Quote
Old 11-18-2002, 05:41 PM   #17
osxpez
Major Leaguer
 
Join Date: May 2002
Location: Sweden
Posts: 282
The -adjoin option is default so it's still involved. But it could be that the memory leaks you experience when merging TIFF files is not present when merging PS files, so it could work.
__________________
/PEZ
osxpez is offline   Reply With Quote
Old 11-18-2002, 07:56 PM   #18
kerim
Major Leaguer
 
Join Date: Jan 2002
Posts: 311
What I've done in my script is to force imagemagick to convert the files one file at a time. It seems to work better this way. Maybe when FINK upgrades to ImageMagick 5.5.x I'll try again!
kerim is offline   Reply With Quote
Reply


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 On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 05:38 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.