PDA

View Full Version : Capturing images from PDF docs



Phystus
January 24th, 2016, 04:06
I'm trying to grab some images from a PDF so I can put them into a FG adventure. I can seemingly copy the image from the PDF, but when I paste it into a graphics program (I have tried MS paint and Paint Shop Pro) the pasted image is just a black square.

Any ideas on how to get the actual image?

Thanks!

~P

LordEntrails
January 24th, 2016, 04:15
I don't know why it's pasting as a black square.

There are also programs that can extract images from PDF files. Not sure what they are called, bu tI do remember a thread about it months and months ago.

Also, you can try a screen capture. The resolution will depend upon your screen resolution and the size of the image on your screen when you capture it, but it might be good enough for what you need.

Trenloe
January 24th, 2016, 04:39
The black square will be a layer within the PDF. This all depends how the PDF was put together. For example, unknowingly, Paizo changed their PDF creation application over a year ago and their PDF products suddenly exhibited the behaviour you mention. After a few months they changed their process again and the black layer went away.

You can get around it with some other PDF editors (try NitroPDF - you can get a 30 day trial), or, as LordEntrails mentions, by using Windows snipping tool or something similar to take a screenshot.

Phystus
January 24th, 2016, 05:28
Ah-ha! Good to know the cause. I did do try snipping, and it seems to work OK. Good tip about trying another product too, I may do that.

Thanks fellows!

~P

Nylanfs
January 24th, 2016, 16:46
PDF XChange works also
https://www.tracker-software.com/product/pdf-xchange-viewer

Andraax
January 25th, 2016, 04:58
Just open the PDF in GIMP, then export the images as JPEG or PNG.

Trenloe
January 25th, 2016, 05:09
Just open the PDF in GIMP, then export the images as JPEG or PNG.
This works, but it's not ideal as it imports the whole page into GIMP, not just the image/s on that page - of course you can then crop it down so it's not much different from using a screengrab. It also brings in the text/labels (which you may not want).

Being able to export the image directly from the PDF has a number of advantages: you get the native image resolution and the labels don't usually come with the image so you get a player map ready for immediate use (no editing to remove numbers etc.).

Ken L
January 25th, 2016, 05:47
All those tools you mentioned are wrappers around FOSS toolsets or binaries, wither or not they wish to admit it. (Hah, and they have the nerve to charge a buck for developing crappy UI around it, learn algorithms a**holes)

MuPDF can extract all images within a PDF, but you'll need to reconstruct their alpha layer manually.

in linux:

mutool extract <file path>

https://manpages.ubuntu.com/manpages/trusty/man1/mutool.1.html

https://i.imgur.com/4mIuXco.jpg

edit: fixed CLI args.

damned
January 25th, 2016, 12:45
Question for you Ken L
Why dont you open the image, open the mask, drag the mask layer on to the image, select the black on the mask layer, select the image layer and delete?
Im not positive but it seems to me that would be much quicker than doing the alpha layers thing.

Ken L
January 25th, 2016, 19:08
The black mask is representative of the alpha layer as pdfs seperate the alpha layer from the image. They however aren't well connected enough logically so you need to manually associate them.

I use color to alpha to preserve the transparency if there is any. In this particular image there is none but often there is, and the ability to preserve the original transparency is useful for image applications.

Edit: example
https://i.imgur.com/etENQfa.png
https://i.imgur.com/fr2LWqe.png
https://i.imgur.com/YxGr7v0.png