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
- Host: GitHub
- URL: https://github.com/kurama622/efig
- Owner: Kurama622
- Created: 2021-02-05T05:35:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-07T09:15:42.000Z (over 4 years ago)
- Last Synced: 2025-01-11T18:47:07.240Z (9 months ago)
- Language: Python
- Size: 811 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# efig
## Requires
- pdfimages
- python
## Show
## 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):
"""
:efigextract all image from pdf.
Will create a folder named "images" in the current folder.
"""
def execute(self):
from subprocess import callif 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.
