Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the name of the output file #27

Closed
rsomani95 opened this issue Sep 12, 2018 · 2 comments
Closed

Changing the name of the output file #27

rsomani95 opened this issue Sep 12, 2018 · 2 comments

Comments

@rsomani95
Copy link

This issue was raised before here, but got closed prematurely.

I wanted to know if there is any way that we can have control over the name of the output image. While I understand there are reasons why the filename is the way it is from your explanation in the previous issue, it would save me a lot of time and resources if I could change the output name.

Thanks!

@Belval
Copy link
Owner

Belval commented Sep 12, 2018

Would you mind describing your process? You can access the filename using Image.filename and every image has a _X suffix where X is the page number.

Don't get me wrong, I am not completely closed to the idea, I simply have trouble picturing a legitimate scenario.

@rsomani95
Copy link
Author

Would you mind describing your process?

Sure, I'm working on a data visualisation project where I prepare the data in Python, run it using Processing on the Terminal, but in order to run it in headless mode, I need to export it to PDF as that's the only case where I can automate the process (I'm working on macOS, there are better solutions for Linux OS). I need to use pdf2image to convert these PDFs back to JPEGs as I'd like to put these together sequentially in a video editor.
Thus, naming them correctly is crucial.

You can access the filename using Image.filename and every image has a _X suffix where X is the page number.

Thank you. I realised I was making the silly error of accessing the list itself, and not the element of the list.
Here's the code for anyone facing a similar issue:

img = convert_from_path(pdf_path = proc_path[0], output_folder = out_path, fmt = 'jpg') img.filename #gives an error: 'list' object has no attribute 'filename'
img[0].filename does the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants