Page 2 of 7

Re: Batch convert PDF to JPG (or X file format to Y)

Posted: Fri Sep 17, 2021 10:51 am
by TimothySimon
Huckleberry Finn wrote: Fri Sep 17, 2021 10:13 am ...
Yes. Of course.

I'm also thinking of changing this entire app to something that can change any format to any other format (provided there's a command for it).

What's your opinion ?

I think I should stop this and start working on that.

Re: Batch convert PDF to JPG (or X file format to Y)

Posted: Fri Sep 17, 2021 10:55 am
by Huckleberry Finn
Yes, of course.. Step by step .. Once you make it almost perfect for this one (appearance etc, buttons, showing the list when files dragged etc.) the rest wouldn't be difficult.. Just find more commands for more file types and add .. (imho) :)

Meanwhile: That numbering is not something bad: I mean: Even if it was a perfect software and no matter Windows or Linux: What else would it do to prevent overwriting.. that's very normal and needed no matter Windows or Linux ..

Re: Batch convert PDF to JPG (or X file format to Y)

Posted: Fri Sep 17, 2021 11:00 am
by TimothySimon
Huckleberry Finn wrote: Fri Sep 17, 2021 10:55 am showing the list when files dragged
That's something I really want, but I don't know to do it in yad.
I learnt yad just yesterday, from a link @SwampRabbit PM'ed me ( http://smokey01.com/yad/ ) , and from antiX advert blocker code.

Re: Batch convert PDF to JPG (or X file format to Y)

Posted: Fri Sep 17, 2021 11:02 am
by Huckleberry Finn
Yes, and just like @SwampRabbit said: No need to hurry :)

Re: Batch convert PDF to JPG (or X file format to Y)

Posted: Fri Sep 17, 2021 11:09 am
by Huckleberry Finn
Meanwhile, for the drag & drop thing: You can gain some time till you do it: You can just change the echo message to something like" Please drag files here then click ok" (Or something like that) that the user knows/guesses that it's normal it shows a blank window and they can just go on ignoring that ...

Re: Batch convert PDF to JPG (or X file format to Y)

Posted: Fri Sep 17, 2021 11:21 am
by TimothySimon
Huckleberry Finn wrote: Fri Sep 17, 2021 11:09 am Meanwhile, for the drag & drop thing: You can gain some time till you do it: You can just change the echo message to something like" Please drag files here then click ok" (Or something like that) that the user knows/guesses that it's normal it shows a blank window and they can just go on ignoring that ...
Yes, of course.

Re: Batch convert PDF to JPG (or X file format to Y)

Posted: Fri Sep 17, 2021 11:53 am
by Huckleberry Finn
Just remembered one more thing about that (though that function is not even necessary for me.. just people may want to see):

I don't know which's easier but rather than showing a list of the dropped files (or till then) this may be simpler and lighter:

Just the number of files.. Say: " 18 files will be converted " appears in the window. Then it'll do the job and the user will know that stage is ok... Then you click either to "Convert all" or to "Convert Just 1st Pages" (in place of OK) or "Cancel".

Re: Batch convert PDF to JPG (or X file format to Y)

Posted: Sat Sep 18, 2021 4:31 am
by TimothySimon
Huckleberry Finn wrote: Fri Sep 17, 2021 11:53 am Just the number of files.. Say: " 18 files will be converted " appears in the window. Then it'll do the job and the user will know that stage is ok... Then you click either to "Convert all" or to "Convert Just 1st Pages" (in place of OK) or "Cancel".
Yes. I'm including it in the next app (convert any format to any other compatible one)

Some thoughts:
Huckleberry Finn wrote: Fri Sep 17, 2021 10:13 am ls *.pdf | sed 's|\.pdf||' | xargs -I{} pdftoppm {}.pdf -jpeg {}
ls *.pdf | sed 's|\.pdf||' | xargs -I{} pdftoppm -singlefile {}.pdf -jpeg {}
Benefits:
- Prettier names
- ls | sed may be faster than find -maxdepth 1

Drawbacks:
- Case insensitivity lost (won't convert .PDF , .Pdf etc.,)

I think these will be better, and I'm changing it to these for now (please comment on this):
find . -maxdepth 1 -iname '*.pdf' | xargs -I{} pdftoppm {} -jpeg {}
find . -maxdepth 1 -iname '*.pdf' | xargs -I{} pdftoppm -singlefile {} -jpeg {}

Anyway, our GUI app needs no find(1) , as it already has the dragged and dropped file paths.

Re: Batch convert PDF to JPG (or X file format to Y)

Posted: Sat Sep 18, 2021 4:40 am
by TimothySimon
I think Drag-N-Drop is better than file selection for multiple files.

We can do these in Drag-N-Drop, but not in file selection dialogs (for multiple files):
1) Select files from different folders.
2) Use preferred file manager.
3) Use a "Find" utility (both in the file manager / others like Catfish).

Re: Batch convert PDF to JPG (or X file format to Y)

Posted: Sat Sep 18, 2021 6:19 am
by Huckleberry Finn
TimothySimon wrote: Sat Sep 18, 2021 4:31 amCase insensitivity lost (won't convert .PDF , .Pdf etc.,
Ah, yes. I hadn't tested that.

Code: Select all

ls *.pdf | sed 's|\.pdf||' | xargs -I{} pdftoppm {}.pdf -jpeg {} ; ls *.Pdf | sed 's|\.Pdf||' | xargs -I{} pdftoppm {}.Pdf -jpeg {} ; ls *.PDF | sed 's|\.PDF||' | xargs -I{} pdftoppm {}.PDF -jpeg {}
:biggrin:

Yes, of course there're simpler / smarter "command-fu" ways to make it shorter adding "and/or" .. But (at least, till then) no one will see what the command behind the gui is and no one will care if you do it with just 12 characters or 49 :biggrin: (Yes, normally it takes a bit more time for searching & creating 3 times, but not too long, ignorable imho..)