Saturday, April 27, 2024
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 14049  / 3 Years ago, thu, september 2, 2021, 1:10:12

Back in Windows I would use jpegtran program to process all of the images in a folder.


However, there doesn't seem to be an application in Ubuntu with UI for performing the same task. Obviously, I should do it from the terminal, but I have no idea how to perform a lossless batch operation. All of the tutorials mention cropping etc., but I don't need those operations.


Therefore, my question is:


What should I type in the terminal to perform lossless optimization (i.e. only strip meta data I guess) of the folder with images (e.g. ExampleFolder).


Thank you in advance!


More From » command-line

 Answers
2

Also, if you need jpegtran, you can find it in the libjpeg-turbo-progs package. This has all the optimisation features of its Windows counterpart but you have to use it via the command line and it's frankly, quite a pain to use.



There are other ways of looping over files, but here I'll use find. The following will look for *.jpgs in the current directory. (Note this is not the same as previous versions of this post, for simplicity)



cd /path/with/jpgs
find . -exec jpegtran -optimize -outfile "{}.opti.jpg" "{}" ;


If you want it to save over itself, you can. Change the -outfile argument to "{}".


[#32045] Friday, September 3, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
onomicsiberated

Total Points: 217
Total Questions: 98
Total Answers: 107

Location: Luxembourg
Member since Sun, May 28, 2023
12 Months ago
;