Page 1 of 1
GUI file converter app and its commands
Posted: Thu Sep 16, 2021 1:30 pm
by TimothySimon
GUI file Converter App
viewtopic.php?p=653310#p653310
https://github.com/TimothySimon123/file-converter
Commands
TL; DR
Code: Select all
find . -maxdepth 1 -iname '*.pdf' | xargs -I{} pdftoppm {} -jpeg {}
converts all files ending with .pdf (case-insensitive) in the current directory to JPGs (each page is a separate jpg , with the page number in the file name.
if you don't have it installed (MX Linux comes with this by default)
If you don't understand the above, here is the newbie-friendly version:
When you're within the folder containing all PDFs, Right click on the empty space, open terminal here, then type (or Right click -> Paste) this command , followed by an Enter :
Code: Select all
echo "Please wait. Converting......... Do NOT close this terminal" ; find . -maxdepth 1 -iname '*.pdf' | xargs -I{} pdftoppm {} -jpeg {} ; echo "Finished conversion. Please close this Terminal"
The output files are named like this: MyFile.pdf-1.jpg (means Page 1 of MyFile.pdf)
To convert just the first page of each pdf (Ignores all other pages)
Code: Select all
echo "Please wait. Converting......... Do NOT close this terminal" ; find . -maxdepth 1 -iname '*.pdf' | xargs -I{} pdftoppm -singlefile {} -jpeg {} ; echo "Finished conversion. Please close this Terminal"
Long description
This is forked off from
viewtopic.php?p=652929#p652929 .
My original reply was
viewtopic.php?p=652987#p652987 .
Huckleberry Finn wrote: Thu Sep 16, 2021 12:15 pm
This one is really handy , simple, requiring no extra software .. perfect indeed.
I'm also surprised how there's nothing easy to "batch" convert ..
So, maybe you put this in tips & tricks..
................
--- @ Huckleberry Finn
This command just applies
this ( pdftoppm -jpeg ) for all PDF files in that folder (with find piping to pdftoppm via xargs)
More generally, we can use Code: Select all
find <something_to_find> | xargs -I{} some_command {}
to apply some_command (which may be a conversion or something else) to all the files found by find(1)
xargs will replace {} with the paths of matching files (supplied from find's stdout to xarg's stdin)
Even more generally, this is just using xargs -I{}
find -iname means that the match is case-insensitive (matches .PDF , .pdf , .Pdf , .PdF etc.,)
xargs -I{} means to replace all occurences of {} with the current line from stdin (and repeat the command for each line)
Ref: $ man xargs , $ man find
EDIT 1: I learnt from man xargs that -i is deprecated. Edited command to use -I{}
I added the echo's as a "newbie guard" to stop people from closing the terminal thinking the job is over (some people don't know when a command finishes its job), and this command may take a lot of time
Only a very minor drawback -- the output names are something like this: MyFile.pdf.jpg-1.jpg
EDIT:
@Huckleberry Finn fixed that.
EDIT 2: Learnt that there is a similar way on another forum.
EDIT 3: Incorporated good things from that (-maxdepth 1 -type f)
Huckleberry Finn wrote: Fri Sep 17, 2021 10:13 am
So, @TimothySimon : My humble suggestion for next "dot release" :D is:
Replace the main command with @Amigo 's
(And) While you're at it: 2 Options:
"Convert All Pages"
"Convert just First Pages" (of each file)
One with
ls *.pdf | sed 's|\.pdf||' | xargs -I{} pdftoppm {}.pdf -jpeg {}
The other
ls *.pdf | sed 's|\.pdf||' | xargs -I{} pdftoppm -singlefile {}.pdf -jpeg {}
EDIT 4: Incorporated good things from commands given by
@Amigo and
@Huckleberry Finn
Re: Batch convert PDF to JPG (or X file format to Y)
Posted: Thu Sep 16, 2021 1:52 pm
by SwampRabbit
Nice work, this would be really cool as a YAD script. I seem to recall that there might already be something like it (or close to it out there).
Re: Batch convert PDF to JPG (or X file format to Y)
Posted: Thu Sep 16, 2021 2:06 pm
by TimothySimon
SwampRabbit wrote: Thu Sep 16, 2021 1:52 pm
Nice work, this would be really cool as a YAD script. I seem to recall that there might already be something like it (or close to it out there).
Or still better, I dream of a FOSS Qt/C++ GUI app to convert between various formats.
(just for Linux

)
If you want, I'm ready to help with my limited Qt/C++ knowledge.
(It'll also be a good exercise for me -- I'm studying these as part of my coursework)
Re: Batch convert PDF to JPG (or X file format to Y)
Posted: Thu Sep 16, 2021 2:13 pm
by SwampRabbit
TimothySimon wrote: Thu Sep 16, 2021 2:06 pm
If you want, I'm ready to help with my limited Qt/C++ knowledge.
(It'll also be a good exercise for me -- I'm studying these as part of my coursework)
That makes two of us, well the “limited”, not the course work.
Install QtCreator if you haven’t already, that’s at least a start.
Edited for typo
Re: Batch convert PDF to JPG (or X file format to Y)
Posted: Thu Sep 16, 2021 2:19 pm
by TimothySimon
SwampRabbit wrote: Thu Sep 16, 2021 2:13 pm
TimothySimon wrote: Thu Sep 16, 2021 2:06 pm
If you want, I'm ready to help with my limited Qt/C++ knowledge.
(It'll also be a good exercise for me -- I'm studying these as part of my coursework)
That makes two of us, we’ll the “limited”, not the course work.
Install QtCreator if you haven’t already, that’s at least a start.
qtcreator is already installed.
viewtopic.php?f=108&t=66370
viewtopic.php?f=77&t=66324
So here we go ......... (?)
NOTE: I don't know the ways of programing as a team (git etc.,) . I would like to study that too.
Please PM me if you need to.
BTW: It is about 12 midnight in my part of the world (+0530)
Re: Batch convert PDF to JPG (or X file format to Y)
Posted: Thu Sep 16, 2021 2:29 pm
by SwampRabbit
Don’t worry about time, there is no rush for anything.
I PM’d you and can help with what I know and have time for.
Re: Batch convert PDF to JPG (or X file format to Y)
Posted: Fri Sep 17, 2021 7:58 am
by TimothySimon
SwampRabbit wrote: Thu Sep 16, 2021 2:29 pm
Don’t worry about time, there is no rush for anything.
I PM’d you and can help with what I know and have time for.
Here is my simple YAD GUI to convert PDF to JPG:
https://github.com/TimothySimon123/pdf2jpg
Lets call this pdf2jpg version 0.1 alpha
Just download pdf2jpg.sh and pdf2jpg-helper.sh int the same directory.
Launch pdf2jpg.sh to use it.
Features:
- Drag and drop
- Easy bulk conversion
- Progress meter
Please give your valuable suggestions and comments.
Re: Batch convert PDF to JPG (or X file format to Y)
Posted: Fri Sep 17, 2021 9:11 am
by Jerry3904
It works, thanks for posting. I will be able to give good feedback tomorrow, but I'm on the road all day today.
One general observation: I find that the directions could use some editing. For instance, "drag and drop here" seems to mean "click here to select files for conversion." I at least was unable to drag and drop in the usual sense.
Re: Batch convert PDF to JPG (or X file format to Y)
Posted: Fri Sep 17, 2021 9:53 am
by Huckleberry Finn
Just.. drag works but it shows the window empty.. In my case I dragged & dropped, then clicked ok (as if it showed dropped files) :)
Re: Batch convert PDF to JPG (or X file format to Y)
Posted: Fri Sep 17, 2021 10:13 am
by Huckleberry Finn
So, @TimothySimon : My humble suggestion for next "dot release" :D is:
Replace the main command with @Amigo 's
(And) While you're at it: 2 Options:
"Convert All Pages"
"Convert just First Pages" (of each file)
One with
ls *.pdf | sed 's|\.pdf||' | xargs -I{} pdftoppm {}.pdf -jpeg {}
The other
ls *.pdf | sed 's|\.pdf||' | xargs -I{} pdftoppm -singlefile {}.pdf -jpeg {}
Re: Batch convert PDF to JPG (or X file format to Y)
Posted: Fri Sep 17, 2021 10:51 am
by TimothySimon
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 {}
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

(Yes, normally it takes a bit more time for searching & creating 3 times, but not too long, ignorable imho..)
Re: Batch convert PDF to JPG (or X file format to Y)
Posted: Sat Sep 18, 2021 3:03 pm
by TimothySimon
file-converter
A simple app to convert between various file formats.
- Supports batch conversion of multiple files
- Drag N Drop functionality
- Works on almost any Linux distro
These formats and their equivalents are supported:
1) PDF
- Can be converted (page-by-page) to jpg, png, tiff
- Can also be converted to jpg's containing only the first page
- Uses pdftoppm
2) Images: jpg png tiff bmp heic
- Any of these can be interconverted
- Uses convert-im6.q16
3) Audio: aiff aiffc au amr-nb amr-wb cdda flac gsm mp3 ogg opus sln voc vox wav wv 8svx
- Any of these can be interconverted
- Uses sox
4) Video: 3g2 3gp asf avi m4v mkv mov mp4 nsv rm roq vob webm
- Any of these can be interconverted
- Uses ffmpeg
AppImage at:
https://github.com/TimothySimon123/file ... 4.AppImage
I stopped working on jpg2pdf and I'm now working on file-converter.
Source code and instructions to build AppImage at:
https://github.com/TimothySimon123/file-converter
Let's call this file-converter 0.1 alpha.
Please give your valuable comments and suggestions.
Huckleberry Finn wrote: Fri Sep 17, 2021 10:55 am
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) :)
Made major improvements in appearance.
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 ...
Implemented that.
Huckleberry Finn wrote: Fri Sep 17, 2021 11:53 am
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".
Implemented that too.
BTW: Should this be moved to a new thread ?
Re: Batch convert PDF to JPG (or X file format to Y)
Posted: Sat Sep 18, 2021 3:10 pm
by Huckleberry Finn
TimothySimon wrote: Sat Sep 18, 2021 3:03 pmBTW: Should this be moved to a new thread ?
If you ask for it turned into "file converter" from just pdf to jpg .. Maybe just editing the title (clicking the pencil on 1st post) would be enough ..
Re: Batch convert PDF to JPG (or X file format to Y)
Posted: Sat Sep 18, 2021 3:28 pm
by SwampRabbit
Looking good!
Something that might be helpful is using --tooltip with DND
https://man.archlinux.org/man/community ... ox_options
Its just preference, but you don't have to type "function" for each one, you can use say:
Code: Select all
# some functions
file-converter-pdf2jpg(){
pdftoppm -jpeg "$1" "$(echo "$2" | sed 's/\.jpg$//g')"
}
I believe Jerry and Fehlix use this form, so I've started using it too.
I'll start the Debian packaging for this later, when its packaged all the needed file format dependencies will get installed, that can let you remove those IF statements checking for all that if you want.
Re: Batch convert PDF to JPG (or X file format to Y)
Posted: Mon Sep 20, 2021 4:18 am
by TimothySimon
Created a new release, 0.2 beta.
- Added a GUI progress bar.
- Updated function naming conventions.
- Added deb.
SwampRabbit wrote: Sat Sep 18, 2021 3:28 pm
Its just preference, but you don't have to type "function" for each one, you can use say:
I believe Jerry and Fehlix use this form, so I've started using it too..
Yes. I did it.
Its not just preference. AFAIK, removing "function" also increases POSIX sh compatibility.
SwampRabbit wrote: Sat Sep 18, 2021 3:28 pm
I'll start the Debian packaging for this later, when its packaged all the needed file format dependencies will get installed, that can let you remove those IF statements checking for all that if you want.
I've packaged a deb and given the packaging script in packaging/deb/build-deb.sh
It works, but it may not be good enough (I'm not experienced with deb packaging).
I think the IF statements should be unchanged (thinking of the AppImage).
Those would be just a few extra lines of code is distributed as a deb.
The AppImage contains a self-contained yad, but it still depends on poppler-utils, imagemagick and ffmpeg installed in the system (I don't want a bloated AppImage).
Please give your valuable comments and suggestions on the new version of file-converter.
Thank you all for your guidance and support.
Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 12:15 am
by SwampRabbit
@TimothySimon
Its really good and it works very well for everything I tested. Some minor usability recommendations before I get to the good stuff:
- you might want to hunt down an icon to use specifically for file-converter, using update notifier one can be confusing at least those that use it on MX. MAYBE... someone here on the forums would be interested in making you an icon?
- you have some inconsistency of using then not using the "=" equal sign sometimes, I don't know if was affecting some of the tweaks I was trying to do to get the some of the below working or not. Maybe just go back and make sure some of your dialog items are correct and working as expected.
- I tried to get the --image with --image-on-top to work so you could have a download icon image dead center of the dialog, but wouldn't work for some reason.... this kinda goes back to the previous item
- it would be nice to have some sort of notification that files have been dropped, maybe if even visual count in the dialog (see screenshot), its kinda hard to visually see its working initially and it might help first time users a bit
- on the dialog showing how many files will be converted and for selecting the converted output, if you previously didn't drop any files in it tells you to run it again, then both the cancel and ok buttons just close everything out... one might expect one of them, at least the ok button to take you back to the Drag N Drop dialog. Kinda a pain to open the application again
- on the last dialog showing success of conversion, I think you should have a "Close" button and "View" button rather than "Cancel" and "Ok"
Good stuff now!
- I am ready to do a PR for some minor tweaks and created the debian folder and files needed to package file-converter for our repos when you get to that point.
- Do you want it going to your main branch or do you want to create a "development" branch first and I do the PR to that?
Edit I forgot the link to the screenshot
https://imgur.com/yM7IJyK
Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 12:45 am
by TimothySimon
SwampRabbit wrote: Tue Sep 21, 2021 12:15 am
@TimothySimon
- you have some inconsistency of using then not using the "=" equal sign sometimes, I don't know if was affecting some of the tweaks I was trying to do to get the some of the below working or not. Maybe just go back and make sure some of your dialog items are correcting and working as expected.
I didn't get you. Please explain that inconsistency.
Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 12:46 am
by TimothySimon
SwampRabbit wrote: Tue Sep 21, 2021 12:15 am
@TimothySimon
- I am ready to do a PR for some minor tweaks and created the debian folder and files needed to package file-converter for our repos when you get to that point.
- Do you want it going to your main branch or do you want to create a "development" branch first and I do the PR to that?
I'm not familiar with this. Please explain this too.
Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 12:54 am
by SwampRabbit
line 103
Code: Select all
--text "Welcome to file-converter version ${APP_VERSION}\n\nPlease DRAG AND DROP files here , then CLICK OK\n\nYou need not do anything in the terminal that just came up." \
line 244
Code: Select all
--text="$FILE_COUNT files will be converted. \n Press OK to proceed" || echo "EXIT NOW")
See what I mean about the equal signs?
You're using quotes for the --image, it doesn't seem to be affecting it, but you don't need the quotes here
YAD can often take a lot of whatever you throw at it, but it can also do strange things when you don't do something exactly how YAD expects it.
There were a few other things like that that I saw, but I can't remember where or what they were, maybe it was something good, that I just have no clue about too.

Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 1:03 am
by SwampRabbit
TimothySimon wrote: Tue Sep 21, 2021 12:46 am
SwampRabbit wrote: Tue Sep 21, 2021 12:15 am
@TimothySimon
- I am ready to do a PR for some minor tweaks and created the debian folder and files needed to package file-converter for our repos when you get to that point.
- Do you want it going to your main branch or do you want to create a "development" branch first and I do the PR to that?
I'm not familiar with this. Please explain this too.
You can create a "working/development branch" to do anything with, once it is ready you can push it to your "main" or "stable" branches. Some big applications with lots of developers create a branch for each "release".
This helps you organize and segment work and keep people from messing up something you are working on or others are working on.
You can do it using git commands in the terminal or you can do it in the web interface
https://imgur.com/44BQVHK
Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 1:06 am
by TimothySimon
SwampRabbit wrote: Tue Sep 21, 2021 1:03 am
You can create a "working/development branch" to do anything with, once it is ready you can push it to your "main" or "stable" branches. Some big applications with lots of developers create a branch for each "release".
This helps you organize and segment work and keep people from messing up something you are working on or others are working on.
You can do it using git commands in the terminal or you can do it in the web interface
https://imgur.com/44BQVHK
I'll do that ("development" branch)
SwampRabbit wrote: Tue Sep 21, 2021 12:54 am
line 103
Code: Select all
--text "Welcome to file-converter version ${APP_VERSION}\n\nPlease DRAG AND DROP files here , then CLICK OK\n\nYou need not do anything in the terminal that just came up." \
line 244
Code: Select all
--text="$FILE_COUNT files will be converted. \n Press OK to proceed" || echo "EXIT NOW")
You're using quotes for the --image, it doesn't seem to be affecting it, but you don't need the quotes here
YAD can often take a lot of whatever you throw at it, but it can also do strange things when you don't do something exactly how YAD expects it.
s/--image="info"/--image=info/g
s/--image "info"/--image=info/g
s/--text "/--text="/g
Is this what I'm supposed to do ?

Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 1:10 am
by SwampRabbit
Ok boss, I'll do the Pull Request (PR) in the morning, bed time for me
There really is no right of wrong way, I'm probably the last person to teach you Git and GitHub stuff

Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 1:19 am
by TimothySimon
SwampRabbit wrote: Tue Sep 21, 2021 1:10 am
Ok boss, I'll do the Pull Request (PR) in the morning, bed time for me
There really is no right of wrong way, I'm probably the last person to teach you Git and GitHub stuff
Can you please do the PR now ? (I'm excited what a PR looks like)

Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 1:23 am
by SwampRabbit
TimothySimon wrote: Tue Sep 21, 2021 1:19 am
Can you please do the PR now ? (I'm excited what a PR looks like)
Because you asked nice, and you’re doing a lot of work… yes. Just let me get back to the computer.
Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 1:38 am
by SwampRabbit
@TimothySimon you should see the Pull Request (PR) now
Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 1:46 am
by TimothySimon
Yes. But I'm not getting how to "merge" it (sorry for my inexperience).
EDIT: Now, I have merged the pull request successfully.
Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 4:37 am
by TimothySimon
SwampRabbit wrote: Tue Sep 21, 2021 12:15 am
- you might want to hunt down an icon to use specifically for file-converter, using update notifier one can be confusing at least those that use it on MX. MAYBE... someone here on the forums would be interested in making you an icon?
Done (got an icon online).
SwampRabbit wrote: Tue Sep 21, 2021 12:15 am
- you have some inconsistency of using then not using the "=" equal sign sometimes, I don't know if was affecting some of the tweaks I was trying to do to get the some of the below working or not. Maybe just go back and make sure some of your dialog items are correct and working as expected.
Already done in your PR.
SwampRabbit wrote: Tue Sep 21, 2021 12:15 am
- on the dialog showing how many files will be converted and for selecting the converted output, if you previously didn't drop any files in it tells you to run it again, then both the cancel and ok buttons just close everything out... one might expect one of them, at least the ok button to take you back to the Drag N Drop dialog. Kinda a pain to open the application again
Done.
SwampRabbit wrote: Tue Sep 21, 2021 12:15 am
- on the last dialog showing success of conversion, I think you should have a "Close" button and "View" button rather than "Cancel" and "Ok"
Done.
SwampRabbit wrote: Tue Sep 21, 2021 12:15 am
- I tried to get the --image with --image-on-top to work so you could have a download icon image dead center of the dialog, but wouldn't work for some reason.... this kinda goes back to the previous item
- it would be nice to have some sort of notification that files have been dropped, maybe if even visual count in the dialog (see screenshot), its kinda hard to visually see its working initially and it might help first time users a bit
I don't know how to do these ( Please help.... )
Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 9:46 am
by SwampRabbit
You know you don't have to work so fast right? You can take your time.
The new icon looks nice. One thing about using icons or pictures found online, make sure they are free to use, also you want to reference or provide attribution to the person who created it if you can. A link to the where you got the icon is a good start if anything.
I'll take a look at the development branch in its current state first chance I get, but I have real world work to do, and lots of little MX things to do.
I couldn't get the --image-on-top to work myself, not sure why it doesn't work, but can mess with it some more at some point.
I had previously looked at doing this or having an image on top/under the dnd dialog for something else, but I never found a good solution to that.
As far as the dnd file count showing at the bottom of that main dialog, I tried to use the same file count you use for the next dialog after you click OK on the first, but something wasn't right and it wouldn't display which is why I didn't add it in that PR.
Neither of those suggestions are show stoppers, the application works really well from what I tested.
Keep up the awesome work, this is going to be useful for many users!
Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 10:43 am
by CharlesV
@TimothySimon Hey went to download the latest and a) see your progress and b) do some conversion and its toss'n an error at me.
./file-converter-script.sh: 8: ./file-converter-script.sh: Syntax error: Bad function name
This was downloaded from github this am and into a fresh folder. Once I get some coffee in me I will take another look. (and could be me without any coffee too ;-p )
Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 10:47 am
by CharlesV
Ya.. tis me on no coffee .. Was trying to run the wrong script ;-p .. duh !
Very nice ! Great job on this and it is already saving me a bunch of time on pulling some charts out of PDF's !!
Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 11:13 am
by TimothySimon
CharlesV wrote: Tue Sep 21, 2021 10:47 am
Very nice ! Great job on this and it is already saving me a bunch of time on pulling some charts out of PDF's !!
Thank you !
The latest (development -- unstable) scripts are at
https://github.com/TimothySimon123/file ... evelopment
The latest stable ones are at
https://github.com/TimothySimon123/file-converter
Re: GUI file converter app and its commands
Posted: Tue Sep 21, 2021 2:46 pm
by Amigo
Good day
@TimothySimon,
I created an icon for your app (F->ile & an inverted C->onverter)
If you like it and want to use it, Use it freely. If you don't like it or don't want to use it. It's OK too
https://www.deviantart.com/apiecethatsp ... -892574474
Regards
Attached zip file with the .svg and .png icon
Re: GUI file converter app and its commands
Posted: Wed Sep 22, 2021 12:53 am
by TimothySimon
Amigo wrote: Tue Sep 21, 2021 2:46 pm
Good day @TimothySimon,
I created an icon for your app (F->ile & an inverted C->onverter)
If you like it and want to use it, Use it freely. If you don't like it or don't want to use it. It's OK also
https://www.deviantart.com/apiecethatsp ... -892574474
Regards
Attached zip file with the .svg and .png icon
Thank you so much ........
This is really a forum of VERY helpful people.
You can post/PM about how I should attribute your contribution.

Re: GUI file converter app and its commands
Posted: Wed Sep 22, 2021 1:09 am
by SwampRabbit
@TimothySimon you can add lines for that in the copyright file under packaging/debian, pretty clear what to do, but let me know if you have questions
@Amigo I really really like it, but maybe could you bring the bottom of the colored section down to be paralel with the other?
might help make it look more uniform, also don't forget to check how it looks on light and dark themes and at the small size that will show in the panel and menu, sometimes we think something looks great at scale, but when we shrink it it doesn't.... I say this cause I think that black outline might be too thick, but maybe it isn't
Re: GUI file converter app and its commands
Posted: Wed Sep 22, 2021 9:25 am
by Amigo
Good day @SwampRabbit,
OK attached let's call it the V2
maybe could you bring the bottom of the colored section down to be paralel with the other?
- Done!
also don't forget to check how it looks on light and dark themes
- Done! attached a preview of the icon with a dark and light background (if you think a variation is needed please let me know)
and at the small size that will show in the panel and menu, sometimes we think something looks great at scale, but when we shrink it it doesn't.... I say this cause I think that black outline might be too thick, but maybe it isn't
-I decreased the outline. If it's possible to use the .svg image the size it's not a problem the image will scale automatically without loosing the sharpness
Attached an image where i put the .svg image in the panel(22px) just to test it and that is how it will looks
If a .png image it's needed please let me know the requiered messures and i can create it
Please let me know if that can work or if we can improve in other way the icon
Regards
Re: GUI file converter app and its commands
Posted: Wed Sep 22, 2021 10:32 am
by SwampRabbit
@Amigo looks pretty darn good to me!
The svg version can be used.
Re: GUI file converter app and its commands
Posted: Wed Sep 22, 2021 11:18 am
by Amigo
@SwampRabbit
OK then let's leave it that way. Anyway if any change is required please let me know and I will help.
Saludos
Re: GUI file converter app and its commands
Posted: Thu Sep 23, 2021 2:10 pm
by TimothySimon
file-converter
New release: 0.3-beta
https://github.com/TimothySimon123/file-converter
A simple app to convert between various Document, Image, PDF, Video and Audio file formats.
These formats and their equivalents are supported:
1) PDF
- Can be converted (page-by-page) to jpg, png, tiff (Uses pdftoppm).
- Can also be converted to a jpg containing only the first page (Uses pdftoppm).
- Can be converted to html , odg (Uses LibreOffice).
2) Documents: pdf docx xlsx pptx odt ods odp odg odf odb doc ppt rtf xls epub html slk csv txt xml mml .... etc.,
- All formats and conversions supported by LibreOffice.
- Uses LibreOffice
4) Images: jpg png gif tiff bmp heic ico webp
- Any of these can be interconverted
- Uses convert-im6.q16
5) Audio: mp3 ogg wav aiff aac flac voc
- Any of these can be interconverted
- Uses ffmpeg
6) Video: mp4 mkv webm 3gp avi dat flv m4v mov rm
- Any of these can be interconverted
- Uses ffmpeg
Download latest beta version at
https://github.com/TimothySimon123/file ... g/0.3-beta
AppImage:
https://github.com/TimothySimon123/file ... 4.AppImage
deb:
https://github.com/TimothySimon123/file ... 3-beta.deb
Incorporated changes given by
@SwampRabbit
Also used
@Amigo 's icon.
Thank you for your suggestions and your PR.
Also accepted your 2nd PR.
Major changes:
* Added document file support (for all conversions supported by LibreOffice)
* Added option to extract audio from video.
* Use ffmpeg instead of sox for Audio file conversion.
NOTE: Document files can be converted
ONLY if LibreOffice supports the conversion.
Please give all of your valuable comments and suggestions.
Re: GUI file converter app and its commands
Posted: Thu Sep 23, 2021 2:15 pm
by TimothySimon
Please run and test the app and provide your valuable comments and suggestions.
If anyone can suggest improvements in the app, you're welcome.
BTW the Audio & Video part may be a bit lacking , as I'm not so well-versed with that.
Re: GUI file converter app and its commands
Posted: Thu Sep 23, 2021 2:18 pm
by SwampRabbit
Nice work
I'll build this latest one and let you know how the packaging and testing goes first chance I get.
Re: GUI file converter app and its commands
Posted: Thu Sep 23, 2021 2:22 pm
by TimothySimon
SwampRabbit wrote: Thu Sep 23, 2021 2:18 pm
Nice work
I'll build this latest one and let you know how the packaging and testing goes first chance I get.
Thanks.
The sox dependency is removed (ffmpeg for both Audio and Video).
Fact 1: LibreOffice is HUGE.
Fact 2: We need it for document conversion.
What I chose: libreoffice is now "recommended" (is this a good practice ?)
Re: GUI file converter app and its commands
Posted: Thu Sep 23, 2021 5:13 pm
by SwampRabbit
TimothySimon wrote: Thu Sep 23, 2021 2:22 pm
Fact 1: LibreOffice is HUGE.
Fact 2: We need it for document conversion.
What I chose: libreoffice is now "recommended" (is this a good practice ?)
You can have libreoffice as a "recommend", is it a good practice, sure... nothing wrong with that, are there better options... maybe...
I tried to quickly locate what in libreoffice is actually responsible for the conversions, couldn't find it yet.
If it is just one or two components and libraries that are needed, its better to just have those or use something else to provide this. Edit: yeah it appears to all feed off libreoffice needing installed, could be wrong
One option is to convert using smaller tools OR with libreoffice if its installed.
The reason I say that its better is that for people that don't want or need the whole libreoffice suite, they lose this functionality completely. Plus file-converter goes from a small and portable tool to something requiring massive dependencies with even more dependencies.
Maybe some of the tools needed for converting some file formats are installed OOTB in many distros already?
A good example is the antiX/MX base and MX Workbench, file-converter would be great for those, but they don't come with libreoffice OOTB. Why can't I at least convert something from html to .odf if I have a smaller tool that can do it installed already?
I'm not really familiar with document conversion, but I think there are other options, although it might not be as simple as just requiring libreoffice... but...
I think it makes file-converter more attractive to more users, more modular, more portable, and maybe even more useful in the long run.
Maybe someone (we have people here who know this stuff pretty good) else knows of any of viable options to use?
Re: GUI file converter app and its commands
Posted: Fri Sep 24, 2021 4:35 pm
by Amigo
Good day everyone
Congratulations
@TimothySimon and
@SwampRabbit for the New release: 0.3-beta
You two make a great team!
One idea and Improved icon version
- Idea - Replacing LO utilities using pandoc
For document conversions maybe you can use pandoc instead LO (I'm not familiar with this but want to give it a try to know what is it about)
Website
https://pandoc.org/
https://github.com/jgm/pandoc
Examples
https://pandoc.org/demos.html
I tried the MXPI stable repository version (117MB)
I tested some combinations, some worked and some didn't (I think it needs more research).
Below a few results
.odt to .html --> (Worked!)
Code: Select all
pandoc example1.odt -o example1.html
The other way around not
.docx to .odt --> (Worked!)
Code: Select all
pandoc example2.docx -o example2.odt
The other way around not
Convert all the .odt files in a folder into .html --> (Worked!)
Code: Select all
for i in *.odt; do pandoc "$i" -o "${i/.odt/}.html";done;
The same above trying .docx to .html didn't work
NOTE: The conversions that I tried worked only once, Then I just got ">" in the terminal and it didn't do anything (a bug maybe?)
Perhaps you can give it a try.
- Improved icon version
Please find attached the new one (icon) looks much better than the previous
Hope that helps
Saludos
Re: GUI file converter app and its commands
Posted: Fri Sep 24, 2021 6:50 pm
by oops
... Good idea this script.
Can also be a new Thunar action (it's more user friendly into XFCE, for me - than a drag and drop)
Re: GUI file converter app and its commands
Posted: Fri Sep 24, 2021 7:36 pm
by SwampRabbit
oops wrote: Fri Sep 24, 2021 6:50 pm
... Good idea this script.
Can also be a new Thunar action (it's more user friendly into XFCE, for me - than a drag and drop)
I think each type of conversion would have to be it’s own action would it? That’s a ton of custom actions. This allows tons of different types of conversions through a simple small GUI.
Re: GUI file converter app and its commands
Posted: Fri Sep 24, 2021 8:13 pm
by oops
@SwampRabbit I probably don't exactly understand what you mean ... but it's easier for me to select some files into thunar then right click and click to the Thunar action to have the GUI, than select some files then drag and drop to an other window to have the same GUI converter.
Re: GUI file converter app and its commands
Posted: Fri Sep 24, 2021 8:41 pm
by SwampRabbit
oops wrote: Fri Sep 24, 2021 8:13 pm
@SwampRabbit I probably don't exactly understand what you mean ... but it's easier for me to select some files into thunar then right click and click to the Thunar action to have the GUI, than select some files then drag and drop to an other window to have the same GUI converter.
There isn’t a single Thunar action that can convert 50 different file types to 50 other different files types that I am aware of. I don’t thing you can make a Thunar action to do this, it’s have to be a actual Thunar plugin, which in that case, it’s pretty much the same as this.
This isn’t a simple one file type to one file type thing.
Have you even tried what TimothySimon has made?
Re: GUI file converter app and its commands
Posted: Sat Sep 25, 2021 11:31 am
by TimothySimon
Amigo wrote: Fri Sep 24, 2021 4:35 pm
...........
@SwampRabbit
Is there a way to declare EITHER pandoc OR libreoffice as a dependency (the dependency should be satisfied if ANY ONE is installed).
If so, I think I can proceed with this (use pandoc ONLY IF libreoffice isn't available.)
Re: GUI file converter app and its commands
Posted: Sat Sep 25, 2021 12:07 pm
by SwampRabbit
In the packaging you use a pipe, it acts as OR.
So like to change the Recommends to
Then if you need more for different types of conversions it would be like
Code: Select all
libreoffice | pandoc; something | something
In the app code you’d pretty much do the same process except a bit more granular obviously and I’d think the file types would have to be split up a bit because both those can’t convert all the same file types.
Even pandoc is kinda big in the grand scheme of things, not overly big, but for example if you could convert just .doc, .docx, or .odf with something smaller like in the kB range… you could make that a hard runtime dependency and get those “common/most used” that conversion functionality OOTB and for others keep the larger dependencies as Recommends.
Really depends on what you’re aiming for use cases OOTB wise and the audience your targeting.
I’d experiment with having as many small dependencies (maybe not even pandoc OOTB) providing the most core functionality, but if a user already has the larger dependencies those could be used.
For some there’s a big difference between a 5-25MB application (application + dependencies) providing the 100 format conversions that most people need than a 300MB one doing an extra 100 format conversions that most would never use.
Re: GUI file converter app and its commands
Posted: Sat Sep 25, 2021 12:42 pm
by TimothySimon
Thanks for the info.
So, would it be better to keep LO as a recommend and not use pandoc until a lighter alternative is found ?
Re: GUI file converter app and its commands
Posted: Sat Sep 25, 2021 12:53 pm
by SwampRabbit
That depends how much flexibility you want to code into file-converter, but the way you have it now is fine for the time being.
Most Linux Distros have Libreoffice OOTB, not sure about pandoc, can’t check as I’m traveling.
But for core/minimal installs pandoc might be enough of a extra install.
What can LibreOffice convert that pandoc can’t?
Finding (or creating) a matrix of file conversion tools and what they can convert might help identify the “biggest bang for the buck” as they say or identify if say a dozen small dependencies can do the job. Having a matrix like this in the GitHub README or GitHub Wiki of you start one… would be useful to users too.
Re: GUI file converter app and its commands
Posted: Mon Sep 27, 2021 1:53 am
by TimothySimon
SwampRabbit wrote: Sat Sep 25, 2021 12:53 pm
Finding (or creating) a matrix of file conversion tools and what they can convert might help identify the “biggest bang for the buck” as they say or identify if say a dozen small dependencies can do the job. Having a matrix like this in the GitHub README or GitHub Wiki of you start one… would be useful to users too.
Can anyone help us out on a matrix (graph) like this -- X can be converted to Y (with tool Z).
Where X and Y are file formats (extensions) and Z is a conversion tool (like ffmpeg, imagemagick's convert command, libreoffice etc.,).
SwampRabbit wrote: Sat Sep 25, 2021 12:53 pm
What can LibreOffice convert that pandoc can’t?
Input formats that pandoc doesn't support (AFAIK):
abw zabw swf pmd pm3 pm4 pm5 pm6 p65 cwk ase agd fhd kth key numbers pages pdb dxf cdr cmx cgm dif dbf emf fb2 gpl gnm gnumeric hwp plt jtd jtt wk1 wk3 wk4 wks 123 pct met xls xlw xlt xlsx iqy xlsx pxl psw pot pub wps wks wdb wri vsd pgm pbm ppm ods fods odp fodp odg fodg odb sxw stw sxc stc sxi sti sxd std sxm pcx pcd psd qxp wb1 wq1 wq2 sgv 602 sgf rls ras svm slk tga uof uot uos uop wmf wpd wps xbm xpm zmf
Output formats that pandoc doesn't support (spreadsheets, presentations, drawings etc.,):
xlsx ods odp odg odb xls etc.,
Pandoc is mainly about Markup, Tex etc., while LO is mainly about Text documents, Presentations, Spreadsheets, Drawings etc., (more useful for the common man than Markup, Tex etc.,).