Click here to Skip to main content
14,216,124 members
Click here to Skip to main content
Technical Blog
Posted 10 Aug 2012

Tagged as

Stats

10.8K views

Shell script for converting progressive JPEGs to baseline

,
Rate this:
0.00 (No votes)
Please Sign up or sign in to vote.
0.00 (No votes)
10 Aug 2012     CPOL    
Identify all progressive JPEGs in a directory tree and batch convert them to baseline.

The following Linux shell script will identify all progressive JPEGs, in the directory tree under the directory it resides in, and batch convert them to baseline.

It requires ImageMagick to be installed (on Fedora install it like this: yum install ImageMagick)

for img in `find . -name "*" | egrep *\.jpe?g$`
do
  idout=`identify -verbose $img | grep -i interlace | grep -i none$`

  if [[ -z $idout ]]
  then
    echo "-------------------------"
    echo "$img is progressive"
    echo "....making copy of original with .prog extension"
    /bin/cp -f $img $img.prog
    echo "....converting to baseline"
    convert $img -interlace none $img 
    echo "....done!"
  #else
    #echo "$img is non-progressive"
  fi
done

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Alex Fotios
Software Developer Upwork
South Africa South Africa
I have a keen interest in IT Security, Internet applications, and systems/embedded development. My recent research interests have included secure networks, models of trust, trusted agents, information exchange, and software development methodologies.

http//linkedin.com/in/fotios

Comments and Discussions

 
Questionfolder names with spaces Pin
Member 1395909723-Aug-18 3:12
memberMember 1395909723-Aug-18 3:12 
QuestionThis is great, but fails on whitespaces in filenames. Pin
Member 116733647-May-15 11:44
memberMember 116733647-May-15 11:44 
SuggestionA Tip... Pin
Sandeep Mewara9-Aug-12 18:18
mentorSandeep Mewara9-Aug-12 18:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Layout: fixed | fluid

Article Copyright 2012 by Alex Fotios
Everything else Copyright © CodeProject, 1999-2019

Server Web01
Version 2.8.190619.2