Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: How to convert a PDF to a JPEG?

  1. #1

    Post How to convert a PDF to a JPEG?

    Howdy, folks. Sorry if this is the wrong forum.

    I looked through the Tutorial forum, Info forum, and the General category forums as well as performing a search on "convert pdf jpeg", but no luck.

    Basically, I'm going to be running the Paizo Curse of the Crimson Throne D&D adventure. I am a Charter subscriber so I have the PDFs of the adventures, but I'm having a problem converting some of the maps into images for use in MapTool.

    For example, there is a page in the Player's Guide that has a map of a city, Korvosa, with text on top labeling the various areas of the map. I want to snapshot that page in high-enough resolution to be able to read the labels when I zoom up.

    Here are the things I've tried so far using Adobe Acrobat Professional 6.0 (yeah, it's old) and why they didn't work:

    Snapshot tool only copies to the clipboard what is visible on the screen. So I get either the whole map or readable labels, but not both.

    Select Image will select the background map but none of the labels. If I can't find a better solution, I'll use this technique and hand-type (ugh) all of the map labels. In addition, I'll need to add the city name to the legend in the bottom right corner, amongst other things.

    Save As... will let me generate a JPEG 2000 (lossless), but the application chooses the dpi and its too low to look good when zoomed.

    I have not tried "printing" the page to a printer that generates images. I have also not tried ImageMagick to convert the pdf to a bunch of images, one per page. I have split the 20-page PDF into individual pages and I'm playing around right now...

    Thanks for any help!

  2. #2
    Community Leader jfrazierjr's Avatar
    Join Date
    Oct 2007
    Location
    Apex, NC USA
    Posts
    3,057

    Post

    Quote Originally Posted by Azhrei View Post
    Howdy, folks. Sorry if this is the wrong forum.

    I looked through the Tutorial forum, Info forum, and the General category forums as well as performing a search on "convert pdf jpeg", but no luck.

    Basically, I'm going to be running the Paizo Curse of the Crimson Throne D&D adventure. I am a Charter subscriber so I have the PDFs of the adventures, but I'm having a problem converting some of the maps into images for use in MapTool.

    For example, there is a page in the Player's Guide that has a map of a city, Korvosa, with text on top labeling the various areas of the map. I want to snapshot that page in high-enough resolution to be able to read the labels when I zoom up.

    Here are the things I've tried so far using Adobe Acrobat Professional 6.0 (yeah, it's old) and why they didn't work:

    Snapshot tool only copies to the clipboard what is visible on the screen. So I get either the whole map or readable labels, but not both.

    Select Image will select the background map but none of the labels. If I can't find a better solution, I'll use this technique and hand-type (ugh) all of the map labels. In addition, I'll need to add the city name to the legend in the bottom right corner, amongst other things.

    Save As... will let me generate a JPEG 2000 (lossless), but the application chooses the dpi and its too low to look good when zoomed.

    I have not tried "printing" the page to a printer that generates images. I have also not tried ImageMagick to convert the pdf to a bunch of images, one per page. I have split the 20-page PDF into individual pages and I'm playing around right now...

    Thanks for any help!
    While I don't have a direct answer (sorry), if you don't find something that does the job soon, keep an I on giveawayoftheday. There is at least one PDF->JPEG converter I have seen a time or two that comes up in the rotation. Bad thing is you have to watch the site every day, so if you miss a day, you may miss the software you want and it may not come back around for months. Likewise, the install only works on that specific day, so if you reinstall you OS, your out of luck. Also, I know you use Mac and linux, so I have no idea how often (or if) they offer non Windows software over there for install.
    My Finished Maps
    Works in Progress(or abandoned tests)
    My Tutorials:
    Explanation of Layer Masks in GIMP
    How to create ISO Mountains in GIMP/PS using the Smudge tool
    ----------------------------------------------------------
    Unless otherwise stated by me in the post, all work is licensed under a Creative Commons Attribution-Noncommercial 3.0 United States License.

  3. #3
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,245
    Blog Entries
    8

    Post

    Its a bit tricky but can be done easily once set up. What you need is GhostScript.

    There are two parts to that. There is the GhostScript engine and the GhostScript viewer. You only need the engine if your ok with working on the command line and you can type some fu in and it will provide it. Otherwise you can also install a viewer which will alow you to look at the pdf and use a UI to ask it to save out the image.

    If you install the engine then you can also install imagemagick which is an incredible piece of code used all over the place. I use that a lot and its used to generate the challenge thumbnails on this site. Well that integrates with GhostScript engine too so then all you have to do is type :-

    convert mypdf.pdf myimage.jpg

    and it fills in all the spoddy parameters for GS for you and then should just work.

    I would test this right now but I don't have GhostScript installed right now as I treat pdf's like they are plague ridden I view them with FoxIt but I dont use them as source material. I have converted some brochures in the past into extremely high DPI images in the past tho.

    You might have to check whether you need to install GhostScript first or last and ImageMagick first or last to make them see each other. Like I say, its not the easiest set up but once done its amazingly simple to actually do the conversion.

    BTW: I write ViewingDale and I have read Trevors response already for why MapTool does not do this and we both agree on the same point. We would both provide converters to import PDFs into our apps but there is no free license to do it. Only Adobe or the GhostScript team can do it and Adobe is full commercial and GhostScript has terms preventing the use of it for completely free. If we wanted to do it then we would have to write our own converters which is an awful lot of work and I dont integrate with 3rd party non ISO format stuff - hence plague ridden !
    Last edited by Redrobes; 10-18-2008 at 09:38 AM.

  4. #4
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,245
    Blog Entries
    8

    Post

    Just downloaded it, installed it and tried it. Actually extremely easy. I had IM installed already so I dont think there is any order to do it.

    I used the 64 bit version of GhostScript. Mmmmmm nice one !

    So the command is :-

    convert -density 600 In.pdf Out.jpg

    where density is the dpi. By default its low - like 100 or so so worth specifying one.

    If you have problems with convert giving some strange stuff then check you are using image magick convert and not the MS file system convert. If you type 'convert' return and it spews a massive list of options about images then its IM, if it says about NTFS to FAT32 etc then its MS. To change then ensure that the IM dir is first on the path by putting the IM dir in the user path via the 'My computer' - properties - advance - environment - path. And reopening a new command shell.

  5. #5

    Post

    Thanks everyone!

    I have GS already installed as I use it for other things as well. But not ImageMagick (I've used the convert program under Linux, but don't have IM on my Mac).

    It turns out that GIMP can import PDF files if you have GS installed! Sweeeet!

    It did take a little playing around to get the import options right. For example, choosing a large canvas size stretches the imported page, but it's the resolution that matters if you want small text to look good and not pixelated. I ended up using a resolution of 1200 and a page size of 6608x9360. Those numbers are 8 times what the default import box came up with in GIMP (826x1170). Of course, that produced a HUGE map, so now I'm probably going to break it into chunks for use in MapTool.

    And having done all this ... I may not use it. After looking at how nice the results turned out, I decided that maybe I didn't want the labels on the map?! Selecting a single image and saving it using Acrobat Pro produced a 280K JPEG, while my GIMP procedure produced a 16MB image! (Probably because of the high resolution I used.)

    Anyway, I wanted to give a recap and say "thanks" for the help!

  6. #6
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,245
    Blog Entries
    8

    Post

    Cool, Maybe you should tell Trevor to use GS as the intermediary step to import PDF's. I would assume that your not in breach of the EULA that way. If MapTool checked for GS and then made a call to it to convert to a temp image just like Gimp or Imagemagick then import that resulting image as a map. Personally I have always done it manually like the way you are describing, tho as you can tell from me not having it installed, its something I do very rarely indeed.

  7. #7

    Default

    Call me silly, but I usethe same Acrobat 6.0 professional. Can't you just go Advanced->Export all Images, which saves out all the images in the file at full size?

    EDIT - Re-reading I see the labels aren't a part of the image... my bad. This won't help.

    -Rob A>

  8. #8

    Default

    Hey, RedRobes. I don't think it's very practical to allow importing of PDFs into MapTool. I see three major issues: PDF is a multi-page format (what do you do about multiple pages?), PDF allows multiple images per page (what do you do when four images are on the same page?), and there are technical issues behind finding and executing Ghostscript not to mention that it takes my dual-core laptop about 45 seconds of CPU time to convert the image the way I wanted it (yes, that's cumulative CPU time). Personally, I'm not pushing for PDF import into MapTool. In the simple cases it would be convenient, but the simple cases are pretty rare.

    RobA, yeah, I tried that. You found the same thing I did. But now that I'm thinking sans labels is the way to go, I may go back and do that again. I get way too many images (backgrounds for tables, charts, and sidebars, for instance) but they are easily deleted.

    I just picked up the Gazeteer for Golarion and now I need to find a good way to extract the post map in the back. This one is a pretty high-level view of the world, so leaving in the labels is probably good. But it's gonna take a huge chunk of time and memory for GS to convert that puppy!

  9. #9
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,245
    Blog Entries
    8

    Post

    I think I agree with you. Doing it by hand is easier and maybe using Gimp would be convenient too. Its not a big deal to find what you need and make an extraction.

    Just to let you know that if you use GS on the command line you can also specify the page to convert so it could do just that back page. You might have to get a bit dirty coming up with the param set for it tho to make it work.

  10. #10
    Guild Adept Notsonoble's Avatar
    Join Date
    Sep 2008
    Location
    Lubbock
    Posts
    333

    Default

    If you haven't upgraded to Adobe reader 9 (or can reinstall 8 ) the selection tool will let you grab an image, then you can "right click" (i think that's option click on a mac, but it's been a while) and chose copy image, then open GIMP and select paste as new.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •