Command to recursivelly optimise all images loslessly

Discussion in 'Site & Server Administration' started by postcd, Oct 10, 2014.

  1. #1
    Hello,

    please kindly is following linux command safe to execute on server? (aim is to optimise losslessly all jpg, gif, png images recursivelly)

    find /home -type f -name "*.jpg" -o -name "*.png" -exec trimage -f {} \;
    Code (markup):
    (http://trimage.org/)

    the /home is around 30Gb big with a websites, can You suggest on how to test it, and execute safelly without images loss, breaking?

    PS: i also found:
    find . -type f -name "*.jpg" -exec jpegoptim {} \;
    Code (markup):
    (but works only for jpg, i would like jpg, png and gif)


    Thank you
     
    postcd, Oct 10, 2014 IP
  2. paullopez

    paullopez Active Member

    Messages:
    102
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    68
    #2
    The command is safe to execute on server and it will optimize your all images, but for a safer side take a full back-up before executing this command. Also, look at http://www.imagemagick.org/.
     
    paullopez, Oct 14, 2014 IP
  3. postcd

    postcd Well-Known Member

    Messages:
    1,043
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    190
    #3
    i tried to install trimage on my CentOS 6.5 x64, but it dont run saying "No module named PyQt4.QtCore". I can do "yum install PyQt4", but it want to:
    "Install 31 Package(s)
    Total download size: 40 M
    Installed size: 133 M"
    Here is list of dependencies: http://pastebin.com/EkKnSCyW

    Thats alot of data and im unsure if its safe to do it and if it wont need more and more dependencies after, please any idea how to install Trimage dependencies cleanly?
     
    Last edited: Oct 16, 2014
    postcd, Oct 16, 2014 IP
  4. paullopez

    paullopez Active Member

    Messages:
    102
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    68
    #4
    Trimage or Imagemagick; these are large and complicated beast and they require many files for configuration and too much modules (dll’s) that only loads as needed for handling different file formats. So you need install all the requirements.

    Check the following two URLs; you will find some handful information. Hopefully helpful!!!

     
    paullopez, Oct 18, 2014 IP
    postcd likes this.
  5. postcd

    postcd Well-Known Member

    Messages:
    1,043
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    190
    #5
    thx, at the end i ended up using jpegoptim for jpg and optipng for pngs, here is tutorial on that. As you say i think trimage is too heavy and while there are other simple tools already in repos.. no need to bother with trimage etc on server probably
     
    postcd, Oct 18, 2014 IP