Giter Club home page Giter Club logo

jpeg-archive's Introduction

JPEG Archive Build Status Build status Version License

Utilities for archiving photos for saving to long term storage or serving over the web. The goals are:

  • Use a common, well supported format (JPEG)
  • Minimize storage space and cost
  • Identify duplicates / similar photos

Approach:

  • Command line utilities and scripts
  • Simple options and useful help
  • Good quality output via sane defaults

Contributions to this project are very welcome.

Download

You can download the latest source and binary releases from the JPEG Archive releases page. Windows binaries for the latest commit are available from the Windows CI build server.

If you are looking for an easy way to run these utilities in parallel over many files to utilize all CPU cores, please also download Ladon or GNU Parallel. You can then use the jpeg-archive command below or use ladon directly. Example:

# Re-compress JPEGs and replace the originals
ladon "Photos/**/*.jpg" -- jpeg-recompress FULLPATH FULLPATH

# Re-compress JPEGs into the new directory 'Comp'
ladon -m Comp/RELDIR "Photos/**/*.jpg" -- jpeg-recompress FULLPATH Comp/RELPATH

Utilities

The following utilities are part of this project. All of them accept a --help parameter to see the available options.

jpeg-archive

Compress RAW and JPEG files in a folder utilizing all CPU cores. This is a simple shell script that uses the utilities below. It requires:

# Compress a folder of images
cd path/to/photos
jpeg-archive

# Custom quality and metric
jpeg-archive --quality medium --method smallfry

jpeg-recompress

Compress JPEGs by re-encoding to the smallest JPEG quality while keeping perceived visual quality the same and by making sure huffman tables are optimized. This is a lossy operation, but the images are visually identical and it usually saves 30-70% of the size for JPEGs coming from a digital camera, particularly DSLRs. By default all EXIF/IPTC/XMP and color profile metadata is copied over, but this can be disabled to save more space if desired.

There is no need for the input file to be a JPEG. In fact, you can use jpeg-recompress as a replacement for cjpeg by using PPM input and the --ppm option.

The better the quality of the input image is, the better the output will be.

Some basic photo-related editing options are available, such as removing fisheye lens distortion.

Demo

Below are two 100% crops of Nikon's D3x Sample Image 2. The left shows the original image from the camera, while the others show the output of jpeg-recompress with the medium quality setting and various comparison methods. By default SSIM is used, which lowers the file size by 88%. The recompression algorithm chooses a JPEG quality of 80. By comparison the veryhigh quality setting chooses a JPEG quality of 93 and saves 70% of the file size.

JPEG recompression comparison

Why are they different sizes? The default quality settings are set to average out to similar visual quality over large data sets. They may differ on individual photos (like above) because each metric considers different parts of the image to be more or less important for compression.

Image Comparison Metrics

The following metrics are available when using jpeg-recompress. SSIM is the default.

Name Option Description
MPE -m mpe Mean pixel error (as used by imgmin)
SSIM -m ssim Structural similarity DEFAULT
MS-SSIM* -m ms-ssim Multi-scale structural similarity (slow!) (2008 paper)
SmallFry -m smallfry Linear-weighted BBCQ-like (original project, 2011 BBCQ paper)

Note: The SmallFry algorithm may be patented so use with caution.

Subsampling

The JPEG format allows for subsampling of the color channels to save space. For each 2x2 block of pixels per color channel (four pixels total) it can store four pixels (all of them), two pixels or a single pixel. By default, the JPEG encoder subsamples the non-luma channels to two pixels (often referred to as 4:2:0 subsampling). Most digital cameras do the same because of limitations in the human eye. This may lead to unintended behavior for specific use cases (see #12 for an example), so you can use --subsample disable to disable this subsampling.

Example Commands

# Default settings
jpeg-recompress image.jpg compressed.jpg

# High quality example settings
jpeg-recompress --quality high --min 60 image.jpg compressed.jpg

# Slow high quality settings (3-4x slower than above, slightly more accurate)
jpeg-recompress --accurate --quality high --min 60 image.jpg compressed.jpg

# Use SmallFry instead of SSIM
jpeg-recompress --method smallfry image.jpg compressed.jpg

# Use 4:4:4 sampling (disables subsampling).
jpeg-recompress --subsample disable image.jpg compressed.jpg

# Remove fisheye distortion (Tokina 10-17mm on APS-C @ 10mm)
jpeg-recompress --defish 2.6 --zoom 1.2 image.jpg defished.jpg

# Read from stdin and write to stdout with '-' as the filename
jpeg-recompress - - <image.jpg >compressed.jpg

# Convert RAW to JPEG via PPM from stdin
dcraw -w -q 3 -c IMG_1234.CR2 | jpeg-recompress --ppm - compressed.jpg

# Disable progressive mode (not recommended)
jpeg-recompress --no-progressive image.jpg compressed.jpg

# Disable all output except for errors
jpeg-recompress --quiet image.jpg compressed.jpg

jpeg-compare

Compare two JPEG photos to judge how similar they are. The fast comparison method returns an integer from 0 to 99, where 0 is identical. PSNR, SSIM, and MS-SSIM return floats but require images to be the same dimensions.

# Do a fast compare of two images
jpeg-compare image1.jpg image2.jpg

# Calculate PSNR
jpeg-compare --method psnr image1.jpg image2.jpg

# Calculate SSIM
jpeg-compare --method ssim image1.jpg image2.jpg

jpeg-hash

Create a hash of an image that can be used to compare it to other images quickly.

jpeg-hash image.jpg

Building

Dependencies

Ubuntu

Ubuntu users can install via apt-get:

sudo apt-get install build-essential autoconf pkg-config nasm libtool
git clone https://github.com/mozilla/mozjpeg.git
cd mozjpeg
autoreconf -fiv
./configure --with-jpeg8
make
sudo make install

Mac OS X

Mac users can install it via Homebrew:

brew install mozjpeg

FreeBSD

pkg install mozjpeg
git clone https://github.com/danielgtaylor/jpeg-archive.git
cd jpeg-archive/
gmake
sudo gmake install

Windows

The Makefile should work with MinGW/Cygwin/etc and standard GCC. Patches welcome.

To get everything you need to build, install these:

Run Github for windows. In the settings, set Git Bash as the shell. Open Git Shell from the start menu.

# Update PATH to include MinGW/NASM bin folder, location on your system may vary
export PATH=/c/mingw/mingw32/bin:/c/Program\ Files \(x68\)/nasm:$PATH

# Build mozjpeg or download https://www.dropbox.com/s/98jppfgds2xjblu/libjpeg.a
git clone https://github.com/mozilla/mozjpeg.git
cd mozjpeg
cmake -G "MSYS Makefiles" -D CMAKE_C_COMPILER=gcc.exe -D CMAKE_MAKE_PROGRAM=mingw32-make.exe  -D WITH_JPEG8=1
mingw32-make
cd ..

# Build jpeg-archive
git clone https://github.com/danielgtaylor/jpeg-archive
cd jpeg-archive
CC=gcc mingw32-make

JPEG-Archive should now be built.

Compiling (Linux and Mac OS X)

The Makefile should work as-is on Ubuntu and Mac OS X. Other platforms may need to set the location of libjpeg.a or make other tweaks.

make

Installation

Install the binaries into /usr/local/bin:

sudo make install

Links / Alternatives

License

All are released under an MIT license.

http://dgt.mit-license.org/

jpeg-archive's People

Contributors

afettes avatar aidin36 avatar chregu avatar danielgtaylor avatar dt1973 avatar felixbuenemann avatar ganego avatar hadashia avatar jpenney avatar lfos avatar maxicus avatar nolanlawson avatar rikonor avatar szepeviktor avatar toy avatar tseven avatar tssajo 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  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

jpeg-archive's Issues

Remove bundled iqa

This is a big headache for packaging jpeg-archive unless it has changes that cannot be merged upstream

FreeBSD: Missing dependency operator

Hi,

I'm trying to compile jpeg-archive as part of a greater effort to get image_optim (https://github.com/toy/image_optim) working on FreeBSD (https://gist.github.com/murkfletcher/36f662a1c0ab59ea0eac), but I'm getting:

# make
make: "/usr/home/freebsd/jpeg-archive/Makefile" line 10: Missing dependency operator
make: "/usr/home/freebsd/jpeg-archive/Makefile" line 19: Need an operator
make: "/usr/home/freebsd/jpeg-archive/Makefile" line 31: Need an operator
make: Fatal errors encountered -- cannot continue
make: stopped in /usr/home/freebsd/jpeg-archive

Anybody know?

Thanks!

Can jpeg-archive compress file from buffer?

Is it possible to compress a file that is not written to the disk? Like, use it in an AWS lambda process so I could compress uploaded files? When you download a file from S3 to use it in lambda all i have is their buffer. I could write it to disk, then compress and upload but that would add processing time that could be saved.

thanks in advance.

JPEG Lossy

I have an idea on optimization of JPEG Lossy

What is JPEG progressive? Actually it is a number of images where quality of each following image is higher previous the image.

We will take this image

content

JPEG Scan Killer project.

We receive 16 images:

File butteraugli dssim Size
scan_002 5,630772 0.15174437 15 871
scan_003 5,862817 0.05783141 22 461
scan_004 4,675802 0.03125192 31 356
scan_005 2,387352 0.00364845 109 247
scan_006 2,327576 0.00254360 152 963
scan_007 2,271701 0.00243935 160 207
scan_008 2,240952 0.00250675 194 622
scan_009 1,813344 0.00151375 200 877
scan_010 1,234480 0.00071220 222 874
scan_011 1,031184 0.00029957 274 295
scan_012 0,978295 0.00030116 305 552
scan_013 0,909136 0.00025336 329 976
scan_014 0,754250 0.00006819 392 083
scan_015 0,595898 0.00004337 439 168
scan_016 0,000000 0.00000000 480 790

How it is possible to create with the help -scans technology of optimization of JPEG lossy?

JPEG consists of blocks of 8х8 pixels. Perhaps, there is a sense to segment the image and to optimize each part separately. Later to connect parts of the image in the uniform optimized image. Principle of work of the betterjpeg program.

I wanted to learn, your opinion on the matter.

[jpeg-recompress] Support for baseline JPEG

I want to compress an image into baseline JPEG.
What do you think about adding -b --baseline option to create baseline JPEG file (and disable progressive coding)?

Actually, mozjpeg supports -baseline option.

[ jpeg-recompress ] output has lower quality then expected

Hi!

When I have ran jpeg-recompress with the following paramters:

jpeg-recompress --accurate --ppm --method smallfry --strip --min 60 --max 100 input.ppm output.jpg

I got:

Final optimized smallfry at q=94: 101.582809

However, if I check the output with identify -verbose, it says that the quality of the output is only 85.
Also, when using other compression tools, I got a comparable file size at quality 85.
Has anybody experienced this issue?
With thanks,
Laszlo

[Request] Please allow more arguments to the "--subsample" switch

Please allow more arguments to the "--subsample" switch.

Currently only 2x2 (default) and 1x1 (disable) is supported,
but there are plenty cameras available, that outputs 2x1 or 1x2 jpegs.
Transcoding these jpegs via jpeg-recompress are always too big (1x1),
or look often too ugly (2x2) (structure in red color areas, anti-aliasing, flat gradient etc.).

Sure, 2x2 is for the most jpegs enough quality, or simple not noticeable, so 2x2 can be still the default value.

So please, let us choose the correct sampling method, or autodetect it from the original.

Regards,
Biozynotiker

Quiet mode for jpeg-recompress

Would be quite nice to be able to disable output to stderr when optimizing images (if there isn't an error). Or write the information shown when optimizing to stdout and not to stderr.

Some JPG break jpeg-recompress with -smallfry

Hi,
I have a few JPG that break jpeg recompress with I use the method smallfry. I am running the windows executable V2.1.1. No error message: just a windows popup that jpeg-recompress has stopped running.
It breaks just after displaying "Metadata size is xx kb".

If I use ssim as a method on the same files it's OK.
This happened on about 15 to 20% of tested files.

jpeg-archive.sh missing from jpeg-archive-2.1.1-win.zip

I've run into #16, and I was looking to upgrade my version of jpeg-archive to release v2.1.1 to see if it would fix the issue. I might be confused, but it seems that the Windows zip for v2.1.1 is missing jpeg-archive.sh, which was included with v2.1.0.

I believe this is not an issue in my case, since I just use jpeg-recompress directly, but I wanted to bring it to your attention in case the omission was accidental.

Thanks again for the great tool!

WebP / PNG support (making jpeg-recompress more generic)

Hi!

  1. I would like to have something like jpeg-recompress that maintain the perceived visual quality, but for WebP and also for PNG.

  2. I'm also thinking of something not only like webp-recompress and png-recompress, but in addition something bigger,
    that could for example given a jpeg-recompress --auto-format option and a fixed SSIM,
    choose automatically between a JPEG or PNG8 based on the resulting file size and quality.

What do you think?

When compiling on Windows : undefined reference error

Hi,
followed your tutorial on how to compile on windows.
At the last command:

CC=gcc mingw32-make1

I get about 20 errors such as:
src/util.o:util.c:(.text+0x192): undefined reference to `jpeg_std_error'

and finally:
collect2.exe: error: ld returned 1 exit status

Add lossless image format support for jpeg-compare

Thanks for nice tool.

It would be great if jpeg-compare could also read any lossless format like PNG or TIFF, using it as a "baseline". For example, I would like to compare the original image with two different derived JPGs. Now I have to convert PNG into JPG with quality=100 and use it as a "baseline".

bug : progressive jpeg

If image-recompress fails to find a better quality for a given image, the resulting image is not encoded in progressive mode even if the option has been set.

The expected behavior is to get a progressive image as a result with the same quality.

app-archive doesn't build on Gentoo Linux

I think the issue is that the Gentoo mozjpeg ebuild doesn't install include files... (while libjpeg-turbo does but app-archive doesn't use them).

$ make
cc -std=c99 -Wall -O3 -I/opt/mozjpeg/include -c -o src/util.o src/util.c
src/util.c: In function 'encodeJpeg':
src/util.c:145:13: warning: implicit declaration of function 'jpeg_c_int_param_supported' [-Wimplicit-function-declaration]
         if (jpeg_c_int_param_supported(&cinfo, JINT_COMPRESS_PROFILE)) {
             ^
src/util.c:145:48: error: 'JINT_COMPRESS_PROFILE' undeclared (first use in this function)
         if (jpeg_c_int_param_supported(&cinfo, JINT_COMPRESS_PROFILE)) {
                                                ^
src/util.c:145:48: note: each undeclared identifier is reported only once for each function it appears in
src/util.c:146:13: warning: implicit declaration of function 'jpeg_c_set_int_param' [-Wimplicit-function-declaration]
             jpeg_c_set_int_param(&cinfo, JINT_COMPRESS_PROFILE, JCP_FASTEST);
             ^
src/util.c:146:65: error: 'JCP_FASTEST' undeclared (first use in this function)
             jpeg_c_set_int_param(&cinfo, JINT_COMPRESS_PROFILE, JCP_FASTEST);
                                                                 ^
src/util.c:155:13: warning: implicit declaration of function 'jpeg_c_bool_param_supported' [-Wimplicit-function-declaration]
         if (jpeg_c_bool_param_supported(&cinfo, JBOOLEAN_TRELLIS_QUANT)) {
             ^
src/util.c:155:49: error: 'JBOOLEAN_TRELLIS_QUANT' undeclared (first use in this function)
         if (jpeg_c_bool_param_supported(&cinfo, JBOOLEAN_TRELLIS_QUANT)) {
                                                 ^
src/util.c:156:13: warning: implicit declaration of function 'jpeg_c_set_bool_param' [-Wimplicit-function-declaration]
             jpeg_c_set_bool_param(&cinfo, JBOOLEAN_TRELLIS_QUANT, FALSE);
             ^
src/util.c:158:49: error: 'JBOOLEAN_TRELLIS_QUANT_DC' undeclared (first use in this function)
         if (jpeg_c_bool_param_supported(&cinfo, JBOOLEAN_TRELLIS_QUANT_DC)) {
                                                 ^
src/util.c:167:49: error: 'JBOOLEAN_OPTIMIZE_SCANS' undeclared (first use in this function)
         if (jpeg_c_bool_param_supported(&cinfo, JBOOLEAN_OPTIMIZE_SCANS)) {
                                                 ^
make: *** [Makefile:57: src/util.o] Error 1

Remove Makefile assumptions

Currently the makefile assumes lib64 is a part of the filesystem, on debian with multiarch and other multiarch distros lib64 doesn't exist. There are also other issues such as no DESTDIR and assuming mozjpeg is in /opt. I currently just sed -i '/^ifeq/,/^endif/d' and LIBJPEG=$PREFIX/lib/lib...

Possible to add support for Three-component SSIM ?

According to wikipedia, this algorithm is a variation of SSIM that has following advantages

Three-component SSIM (3-SSIM) is a form of SSIM that takes into account the fact that the human eye can see differences more precisely on textured or edge regions than on smooth regions.[4] The resulting metric is calculated as a weighted average of SSIM for three categories of regions: edges, textures, and smooth regions. ...
This SSIM variant gives results which are more consistent with human subjective perception

Adding this would help in cases when preserving the image texture is important.

Add support for TIFF input

Thanks for this great tool! Would it be possible to add support for using TIFFs as the input? I'm a web developer at an art museum, working on automating image conversion for our website. It's pretty much the universal standard in the museum world to use TIFF as the archival format for object images. I could convert TIFFs to PPM and take it from there, but I'm running into some color balancing issues (which I'll fix shortly), and I feel like other folks out there might also appreciate the option to use TIFFs as a default, so that there's no need to bring in other utilities into the tool chain.

Cheers, and thanks again!

Edit: For the record, I fixed my issue with ImageMagick by extracting the color profile(s) from the TIFF before conversion to PPM, converting PPM to JPEG using jpeg-recompress, then applying the saved profile(s) to the JPEG. Here's the sequence of commands:

convert in.tif profile.icc
convert in.tif temp.ppm
jpeg-recompress --ppm temp.ppm out.jpg
convert out.jpg -profile profile.icc out-with-profile.jpg

I'll work on making this more efficient, but this is a valid work around for the moment.

imagemin-jpeg-recompress returns Error when compressing

´´´´
$ npm install imagemin-jpeg-recompress
npm WARN package.json [email protected] No repository field.
|

[email protected] postinstall C:\sites_testes\node_modules\imagemin-j
peg-recompress\node_modules\jpeg-recompress-bin
node lib/install.js

√ jpeg-recompress pre-build test passed successfully

[email protected] node_modules\imagemin-jpeg-recompress
├── [email protected]
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected])

C:>grunt imagemin
Running "imagemin:main" (imagemin) task
Warning: Error: Premature end of JPEG file
Bogus Huffman table definition
in file _images/mee.jpg Use --force to continue.

Aborted due to warnings.
´´´´

my task config is this:

´´´´
var imageCompressEngine = require('imagemin-jpeg-recompress');

var globalConfig = {

imagemin: {
  main: {
    options: {
      optimizationLevel: 7,
      pngquant: true,
      progressive: true,
      use: [imageCompressEngine()]
    },
    files: [
      {
        expand: true,
        cwd: '<%= cfg.root %><%= cfg.src.images %>',
        src: ['**/*.{png,jpg,jpeg,gif,ico}'],
        dest: '<%= cfg.root %><%= cfg.dest.images %>'
      }
    ]
  }
},

});
´´´´
My dependences are the latest versions of
"grunt-contrib-imagemin": "^0.9.2", and "imagemin-jpeg-recompress": "^4.0.0".

I'm working on windows OS, if i use another plugin, like imagemin-mozjpeg, it works perfectly.
I want to use this plugin, because it as a better compression.

Best regards, Mário Silva

subsampling automatically detected

I consider using jpeg-recompress at Fasterize. Fasterize automatically optimizes images from various websites.

So, images at the input may be uncompressed or already compressed at different levels.

1 - I wonder if there is a way to know if an image has already been compressed at a chroma subsampling 4:2:0 ?

2 - If my understanding is correct, jpeg-recompress picks the "right" quality score based on an image comparison. Is jpeg-recompress able to know which chroma subsampling is suitable for a given image ?
I think that if the input image is already with a subsampling 4:2:0, no more subsampling should be done.

Using jpeg-recompress with cmyk color system doesn't works

We detected that jpeg images in the CYMK color system were not supported by jpeg-recompress.
However, mozjpeg seems to support this color system.

jpeg-recompress -Q --quality medium -m mpe -S disable ~/Desktop/3346470422995_patch.jpeg test.jpg
Unsupported color conversion request

I tried to use jpegoptim on the same image that also leverages on mozjpeg and jpegoptim correctly compresses the image.

I think that the right color system is not correctly detected by jpeg-recompress and thus jpeg-recompress doesn't correctly call mozjpeg methods.

Support for SSIMulacra?

The SSIMulacra metric promises significant Improvements over MS-SSIM. Among other things, it might finally solve the issue where images with a big, uniform background and a small, detailed object in the foreground get way too high scores, despite the foreground object being horribly garbled.

Any chance of this being implemented in jpeg-recompress?

http://cloudinary.com/blog/detecting_the_psychovisual_impact_of_compression_related_artifacts_using_ssimulacra

https://github.com/cloudinary/ssimulacra

Failed to detect 64-bit system

Debian wheezy 64-bit, inside VMWare Workstation (64-bit host OS)

When building jpeg-archive it can't detect the bitness of the OS and it tries to load the 32 bit library instead:

cc: error: /opt/libmozjpeg/lib/libjpeg.a: No such file or directory

I edited the Makefile and changed the UNAME_P variable to call uname -m instead of uname -p. Then jpeg-archive built perfectly! 👍

I don't know about compatibility of this change in other systems, here's what I see:

# uname -a
Linux machinename 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u1 x86_64 GNU/Linux
# uname -m
x86_64
# uname -p
unknown

Add support for JPEG2000

Hi!
Would it be possible to add support for JPG2K?
At least supporting also libjpeg alongside with mozjpeg.

Thank you!

Generic image-compare

Please consider allowing jpeg-compare to take two (instead of one) uncompressed PPM images.
This would make it much more flexible and for comparing other image compressors.

Compatibility with libjpeg-turbo

https://gist.github.com/sergejmueller/088dce028b6dd120a16e

Lossless and progressive optimization of multiple (random picked, less than 1 MB) JPEG images with mozjpeg 2.0 and libjpeg-turbo.

Original Size mozjpeg Size libjpeg-turbo Size mozjpeg Speed libjpeg-turbo Speed
621 KB 612 KB 615 KB 0.658 s 0.297 s
505 KB 475 KB 477 KB 0.481 s 0.204 s
391 KB 376 KB 385 KB 0.846 s 0.441 s
888 KB 780 KB 794 KB 0.786 s 0.346 s
700 KB 668 KB 670 KB 0.765 s 0.320 s
425 KB 408 KB 415 KB 0.700 s 0.270 s
322 KB 309 KB 314 KB 0.389 s 0.164 s
Both libraries are called with:
time jpegtran -copy none -progressive img.jpg > compressed.jpg

Summary

  • mozjpeg generates 1,18% smaller* files as libjpeg-turbo
  • mozjpeg is 2,3x slower* as libjpeg-turbo

* Average based on table entries

Can jpeg-archive replace files?

Whenever I run jpeg-archive, it puts everything into a Comp folder. Is there a way to have it replace the images it's recompressing?

Segfaults in jpeg-compare

Two test cases:

  • jpeg-compare right_move_bg.jpg right_move_bg.jpg
    Segmentation fault
    Download: right_move_bg.jpg

  • jpeg-compare line.jpg line.jpg
    *** Error in jpeg-compare: free(): invalid pointer: 0x8055b220 ***
    ======= Backtrace: =========
    /lib/i386-linux-gnu/libc.so.6(+0x6929b)[0xb761429b]
    /lib/i386-linux-gnu/libc.so.6(+0x6f527)[0xb761a527]
    /lib/i386-linux-gnu/libc.so.6(+0x6fcd1)[0xb761acd1]
    jpeg-compare(+0x293b)[0x8009693b]
    jpeg-compare(+0x17f4)[0x800957f4]
    jpeg-compare(main+0x14a)[0x8009555a]
    /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf7)[0xb75c3517]
    jpeg-compare(+0x15a5)[0x800955a5]
    Aborted
    Download: line.jpg

More granularity for the strip option

I need for some images to keep the color profile (ICC) in order to avoid color degradation. The original images is in AdobeRBG (rather than sRGB).

I see that jpegoptim has this kind of choice :

-s, --strip-all   strip all markers from output file
  --strip-none      do not strip any markers
  --strip-com       strip Comment markers from output file
  --strip-exif      strip Exif markers from output file
  --strip-iptc      strip IPTC/Photoshop (APP13) markers from output file
  --strip-icc       strip ICC profile markers from output file
  --strip-xmp       strip XMP markers markers from output file

Do you know if keeping the ICC profile is easily feasible in jpeg-recompress ?

Text gets blurry after recompress

Hi there,

first of all, thanks for that great work. We're considering jpeg-recompress to use in production, but we experience strange behavior when we have text in that image.

I've tried all different compression methods, but text gets blurry with all of them. See attached images. I even tried to use best quality and accurate settings:

jpeg-recompress --accurate --quality veryhigh --min 100 image.jpg image_recompress.jpg

You have any ideas what to do to to get this text sharp? (Adept.sh and jpeg-mini gets it sharp anyway)

Image before recompress:
skyscraper_xenofit_v4

After recompress:
skyscraper_xenofit_v4_recompress

-bash: /usr/local/bin/jpeg-recompress: cannot execute binary file

Hey all,

I am on 32 bit Ubuntu. I have the latest mozjpeg and jpeg-archive. I copied the jpeg-archives binaries into /usr/local/bin/ and made sure there are +x.

However when I try jpeg-compress on an image it get: -bash: /usr/local/bin/jpeg-recompress: cannot execute binary file.

Is anyone else experiencing this?

version `glibc_2.14' not found centos

i am getting error version `glibc_2.14' not found centos when i checked with yum it shows 2.12 .i tried to change version no in bash file but it is unreadable. can you please tell which release uses 2.12 glibs .i am using centos 6.8 and i checked the latest release through yum update and in their repo. its 2.12 only.
i can see only bash file that too without .sh extension. plz tell i have to make frm source or jpeg-archive-2.1.1-linux.tar.bz2
plz help

compile error with mozjpeg 3.0

jpeg-archive works with mozjpeg 2.1 but not with 3.0 released a few days ago:

tpetry-macbook:jpeg-archive-2.0.1 tpetry$ make
cc -std=c99 -Wall -O3 -I/usr/local/Cellar/mozjpeg/include -c -o src/util.o src/util.c
src/util.c:128:15: error: no member named 'use_moz_defaults' in 'struct jpeg_compress_struct'
        cinfo.use_moz_defaults = TRUE;
        ~~~~~ ^
src/util.c:137:15: error: no member named 'optimize_scans' in 'struct jpeg_compress_struct'
        cinfo.optimize_scans = FALSE;
        ~~~~~ ^
2 errors generated.
make: *** [src/util.o] Error 1

The main problem is that homebrew has updated the mozjpeg formula to 3.0 and now you have to compile mozjpeg by your own to be able to compile jpeg-archive.

PPM pipe

hi,

I have a problem with compressing images from standard input using jpeg-recompress.exe. The source files are different, so I have to use a program that opens various image files, eg. ffmpeg. + I use an additional program BATCHENC. The problem occurs when streaming ppm to jpeg-recompress.

example

ffmpeg.exe -i <infile> -f image2pipe -vcodec ppm - | jpeg-recompress.exe --ppm - out.jpg

there is an error

Incorrect image size! 374 vs. 5992721
av_interleaved_write_frame(): Broken pipe
frame=    1 fps=0.0 q=0.0 Lsize=    5852kB time=00:00:00.04 bitrate=1198544.2kbits/s
video:5852kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Conversion failed!

example 2
ImageMagick also does not work

convert.exe <infile> ppm:- | jpeg-recompress.exe --method smallfry --ppm - out.jpg

there is an error

Incorrect image size! 491 vs. 5992721

Am I doing something wrong?

How can I use ladon or jpeg-archive in windows?

Hi,
I was unable to find a ladon or a jpeg-archive windows executable. Could you please kindly add the instructions so that I can execute your very promising jpeg-recompress on multiple recursive JPG in windows?
I saw a while a ago one of your users proposed a branch to allow recursive processing directly in jpeg-recompress: was this never adopted?
thanks and keep up the good work!

Error while compiling jpeg-archive

I am trying to build jpeg-archive on Mac OS X Yosemite 10.10.2, and it is throwing me the following error.

cc -std=c99 -Wall -O3 -I/opt/mozjpeg/include -c -o src/util.o src/util.c
src/util.c:133:13: warning: implicit declaration of function 'jpeg_c_bool_param_supported' is invalid in C99 [-Wimplicit-function-declaration]
        if (jpeg_c_bool_param_supported(&cinfo, JBOOLEAN_OPTIMIZE_SCANS)) {
            ^
src/util.c:133:49: error: use of undeclared identifier 'JBOOLEAN_OPTIMIZE_SCANS'
        if (jpeg_c_bool_param_supported(&cinfo, JBOOLEAN_OPTIMIZE_SCANS)) {
                                                ^
src/util.c:134:13: warning: implicit declaration of function 'jpeg_c_set_bool_param' is invalid in C99 [-Wimplicit-function-declaration]
            jpeg_c_set_bool_param(&cinfo, JBOOLEAN_OPTIMIZE_SCANS, FALSE);
            ^
src/util.c:134:43: error: use of undeclared identifier 'JBOOLEAN_OPTIMIZE_SCANS'
            jpeg_c_set_bool_param(&cinfo, JBOOLEAN_OPTIMIZE_SCANS, FALSE);
                                          ^
2 warnings and 2 errors generated.
make: *** [src/util.o] Error 1

Any ideas, may I missing any dependency ?

Max bit depth is 24 (i.e. 8 bits per channel)

Sorry, this isn't a bug per se, just a heads-up to anyone else who might encounter this issue. If the image you are trying to convert is more than 8 bits per channel, jpeg-recompress will throw an error: Unsupported bit depth #####!.

This is definitely something to watch out for when you are batch-converting with a custom script. I tried converting PPMs generated from 16 bpc TIFFs, and the image numbers just didn't match up. Took me a couple days to realize what was going on.

You can solve this problem with ImageMagick by specifying a depth parameter:

convert in.tif profile.icc
convert in.tif -depth 8 temp.ppm
jpeg-recompress --ppm temp.ppm out.jpg
convert out.jpg -profile profile.icc out-with-profile.jpg

Additionally, it seems that TIFFs might store their bit depth as a floating point value, not an integer, which is why the error I saw read out as Unsupported bit depth 65535!. I'm not completely certain this is the case, just a hunch. Cheers!

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.