An open API service indexing awesome lists of open source software.

https://github.com/kurama622/efig

extact image from pdf
https://github.com/kurama622/efig

Last synced: 8 months ago
JSON representation

extact image from pdf

Awesome Lists containing this project

README

          

# efig

## Requires

- pdfimages

- python

## Show
![efig](./screenshot/efig.gif)

## Install
```shell
git clone https://github.com/demonlord1997/efig
```
(If you only use it in [ranger](https://github.com/ranger/ranger), you don't need to install it.)
## Usage

### Use In Shell
you can customize the command named `efig` in your `.bashrc` or `.zshrc`.
```shell
alias efig='python '
```

Then, you can use `efig` to extract images from a pdf.
```shell
efig -i
```

### 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:
```python
class efig(Command):
"""
:efig

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 ` in ranger.

![efig](./screenshot/efig.gif)