Giter Club home page Giter Club logo

jpegrescan's Introduction

JPEGrescan: losslessly shrink any JPEG file

JPEGrescan is a perl script that uses jpeg tools to optimise jpeg compression by micro-managing some of the compression math based on research into some of the most common parameters.

NB: MozJPEG has the same optimisation built-in and is faster, so we recommend using MozJPEG when possible.

Usage

$ jpegrescan in.jpg out.jpg

Arguments

  • -s: Removes all Exif data and now all JFIF data as well. A basic 18-byte JFIF segment is added in its place.
  • -i: Allows optimisations that may be "incompatible" with some software. Currently this means removing all JFIF data (saving 18 bytes) and allowing an encoding not supported by Opera before version 11.61.
  • -t: Turns on multithreaded operation. Usually, uses up to 4 threads. Faster, but not four times faster than without -t. So try xargs -n1 -P to shrink a large number of jpegs at the same time.
  • -a: Turns on arithmetic coding. Note this is unsupported by most software.
  • -v: Verbose output.
  • -q: Suppress all output.

Package Availability

JPEGrescan is known to be packaged in the following distributions:

  • Arch's User Repository
  • NixOS

Issues

  • No out.jpg. Install the following:
    • Fedora: yum -y install perl-File-Slurp libjpeg-turbo-utils
    • Debian: aptitude install -y libfile-slurp-perl libjpeg-turbo-progs

Thanks

First, thanks to Loren Merritt who created this script originally. Also, thanks to the people on devshed and lyncd - whose names seem to be lost to the sands of time - who came up with the jfifremove idea and the basic C code.

jpegrescan's People

Contributors

bobmath avatar dileep-p avatar jsoref avatar ken-g6 avatar kornelski avatar kud avatar neheb avatar nemobis avatar ramkromberg avatar smilinghorse avatar toy avatar zvezdochiot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jpegrescan's Issues

Debian Wheezy Slurp Error

Hi!

The following error was reported to me as I'm maintaining a tool that builds upon jpegrescan:

"I installed the program and its dependencies on Debian Wheezy. The Perl Slurp.PM installed by default into /usr/local/share/perl/5.14.2/Slurp.pm, however, line 5 of jpegrescan is "use File::Slurp;" resulting in the following error:

Can't locate File/Slurp.pm in @inc (@inc contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /home/joe/bin/jpegrescan line 5.
BEGIN failed--compilation aborted at /home/joe/bin/jpegrescan line 5.

I was able to resolve the issue by creating /usr/local/share/perl/5.14.2/File and placing a soft link there pointing to /usr/local/share/perl/5.14.2/Slurp.pm. You may want to alter jpegrescan to accommodate this glitch."

Since I'm currently lacking the time to fork & patch this issue myself, I'm putting it up here for the sake of documentation and with the good intention of commiting a fix for it some day.

jpegrescan does not output the file

When I run $ jpegrescan in.jpg out.jpg there is no out.jpg anywhere. The more interesting is that there is no error messages or notices, even when running the script with the -v flag.

Any suggestions?

Fatal error when jpegrescan loops thru an array

I’m a little embarrassed that I have not figured this issue out, but I have looked at it so long that it has become a scenario of “not seeing the forest for all the trees”.

I have a customer that has around 48K+ images that are all within a recursive hierarchy. In order to make things work, I modified your script that you have created to allow for looping thru an array of paths to the images. The first always completes correctly, but the second fails every time. The following is the output that I am seeing.

/virtuals/tmp/media/pickadoll-logo.jpg --> /virtuals/tmp/media2/pickadoll-logo.jpg
...............
12238 --> 11728
-4.17%
/virtuals/tmp/media/images/about_us_main_1.jpg --> /virtuals/tmp/media2/images/about_us_main_1.jpg
................Invalid progressive parameters at scan script entry 5
Died at jpegOptimize.pl line 149.

I have attempted to modify the failing image individually and it is successful. I removed the first result you see in the example, thus making the one in the example that failed the first, and it was successful and the second again fails.

I am assuming that this is something related to variable not clearing from the previous optimization, but I am just not finding it.

Any assistance that can be offered would be sincerely appreciated.

Release tag?

Hi,

I am creating a package for jpegrescan. It would be nice if you could create a release tag. Then you can easily reference a specific tag.

Cheers

Avoid excessive disk usage

Some users reported that jpegrescan becomes I/O-bound (doesn't use 100% CPU, but generates hundreds of MB of disk I/O).

Currently it makes jpegtran write each intermediate/temporary result to disk. Maybe it could use pipes to store result in memory instead?

main::restart warning message

Running jpegrescan now gives the following warning message every time:

Name "main::restart" used only once: possible typo at ./jpegrescan line 132.
usage: jpegrescan in.jpg out.jpg

I don't know perl, but is that an unused variable warning?

No out.jpg

./jpegrescan in.jpg out.jpg
Not generating any out.jpg FYI : OS Amazon Linux.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.