Skip to content

Kurama622/efig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

efig

Requires

  • pdfimages

  • python

Show

efig

Install

git clone https://github.com/demonlord1997/efig

(If you only use it in ranger, you don't need to install it.)

Usage

Use In Shell

you can customize the command named efig in your .bashrc or .zshrc.

alias efig='python <path of efig.py>'

Then, you can use efig to extract images from a pdf.

efig -i <PDF-file>

Use In Ranger

If you want to use efig in ranger, you don't need to clone the repository. I have prepared the class named efig for you:

class efig(Command):
    """
    :efig <fname>

    extract all image from pdf.

    Will create a folder named "images" in the current folder.

    """
    def execute(self):
        from subprocess import call

        if not os.path.exists("images"):
            os.makedirs("images")

        if not self.arg(1):
            input_file = self.fm.thisfile.path
        else:
            input_file = self.rest(1)

        output = input_file[0:-4]
        call(['pdfimages', '-png', input_file, 'images/'+output])

    def tab(self, tabnum):
        return self._tab_directory_content()

You can copy the class into commands.py of ranger. (~/.config/ranger/commands.py)

Then you can input :efig <PDF-file> in ranger.

efig

About

extact image from pdf

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages