Click here to Skip to main content
Click here to Skip to main content

Shell script for converting progressive JPEGs to baseline

, 10 Aug 2012
Rate this:
Please Sign up or sign in to vote.
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$`
  idout=`identify -verbose $img | grep -i interlace | grep -i none$`

  if [[ -z $idout ]]
    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!"
    #echo "$img is non-progressive"


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


About the Author

Alex Fotios
Software Developer Freelancer
Brazil Brazil
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.
Follow on   Twitter

Comments and Discussions

SuggestionA Tip... PinmvpSandeep Mewara9-Aug-12 18:18 

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

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

| Advertise | Privacy | Mobile
Web02 | 2.8.140902.1 | Last Updated 10 Aug 2012
Article Copyright 2012 by Alex Fotios
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid