8
\$\begingroup\$

I have 2,300+ pictures that I want to transfer to my phone but on their original size they take up a lot of space (6.44gb) I would like to trim is down to without sacrificing quality or resolution. I know it can be done under linux with something like pgncrush. I currently have access to a windows system and all the files are on jpeg format.

How do I do it?

\$\endgroup\$
13
  • \$\begingroup\$ Will the copies of the images on the phone only be viewed on the phone's screen, or will you want to print/share them from the phone to some other display? \$\endgroup\$
    – Edd
    Dec 14, 2012 at 12:14
  • 3
    \$\begingroup\$ The term "TANSTAAFL" comes to mind here. You can run all of these Linux utilities in Windows with a little work. But in general, they're either going to give only a small savings or else require a reduction in resolution or image quality. \$\endgroup\$
    – mattdm
    Dec 14, 2012 at 12:17
  • 1
    \$\begingroup\$ That's not a duck, that is a swan! \$\endgroup\$
    – user9236
    Dec 15, 2012 at 10:12
  • 1
    \$\begingroup\$ You should always have enough reputation to answer your own question. This answer will probably earn you more reputation. \$\endgroup\$
    – ChrisF
    Dec 15, 2012 at 11:25
  • 2
    \$\begingroup\$ Be aware that uploading to (your favourite image host here) may be affected by them recompressing the image for you, which may make comparisons futile. \$\endgroup\$ Dec 17, 2012 at 12:23

10 Answers 10

18
\$\begingroup\$

File size, quality, resolution - pick any two.

If you had images in an uncompressed format like BMP, then you could make them a bit smaller without sacrificing any quality or resolution by saving them in a compressed format that doesn't do lossy compression, like PNG-24.

JPEG images are already compressed, so with the given quality and resultion they are already as small as they can be. So, if you want a smaller file size you have to sacrifice quality or resolution.

As you are going to show the image on a phone, you might be able to sacrifice a bit of quality without getting any noticable difference. If the JPEG images are saved at quality 100, you could try making a copy using for example quality 80, and see if that is good enough for your needs.

If the resolution of the images is higher than the resolution of the screen on your phone, you would only use that extra resolution if you zoom into the image. In that case reducing the resolution would only limit how much you can zoom.

\$\endgroup\$
5
  • \$\begingroup\$ sometimes zipping or rar'ing them can squeeze the jpgs a bit more. \$\endgroup\$ Jun 13, 2014 at 15:20
  • 1
    \$\begingroup\$ @MichaelNielsen: Then it's probably because it contains some metadata that is not compressed, so saving the image without metadata would make it even smaller. \$\endgroup\$
    – Guffa
    Jun 13, 2014 at 17:20
  • \$\begingroup\$ it would be really stupid to strip the metadata in your own database. \$\endgroup\$ Jun 13, 2014 at 20:36
  • 3
    \$\begingroup\$ @MichaelNielsen: Yes, but you are missing the point. The metadata is the reason that there is any compressable data in the file. \$\endgroup\$
    – Guffa
    Jun 13, 2014 at 20:56
  • \$\begingroup\$ There are other formats beyond JPG that can store more efficiently than can JPG, so by converting to one of those, you can achieve better compression without perceived quality loss. More info in my answer below photo.stackexchange.com/a/79086/4272 \$\endgroup\$ Jun 7, 2016 at 18:21
6
\$\begingroup\$

Let's begin with a notion: compressors are able to reduce the size of something (like a text file) by processing it and representing the same information using less symbols. It's the way Zip makes a text-file smaller. This is lossless compression.

Pictures and audio (and, so, video) uses a very big amount of information: for example, a 5 megapixels picture, in a format that does not compress anything (like TIFF) would take 5 megabytes x 3 colors *RGB) = 15 MB of space.

To reduce the file size, JPEG format makes you loose some information from the picture: be it quality, colors, etc. That's why you can open a JPEG in some photo-editing program (Photoshop, Gimp, etc) and then save it with less quality: it will use less information to represent your image, with a smaller file size, but will loose some quality. If you (or any person) will be able to notice the low quality is a important point when choosing "how much compression" you want.

So: in general, for practical purposes, you will loose a lot of quality to reduce the size of a JPEG picture, because it is already compressed.

But you want to use that in your cell phone, that's right?

You didn't say which cell phone you have. Let's assume that you have a Samsung galaxy s3. You can see it's specifications: the screen resolution is 1280x720 pixels.

So, when you view a picture in it, it doesn't matter the original picture size: you'll be able to see 1280x720 pixels, because that's the maximum amount of pixels that the cell will be able to show.

If you take all your pictures, resize them to 1280x720 pixels, and open in your phone, you will see them the same way you would see them with the original resolution. You will be loosing "resolution" from the original image, but it's something that you wouldn't be able to see in your phone anyway...

How yo do that in Windows: use any program you like that is able to edit pictures: Photoshop, Gimp, IrfanView... but since you're talking about doing it in a large amount of files, probably you're thinking about ImageMagick or a similar program, that can perform the same operation in a large amount of files.

Edit: to do it with ImageMagick:

1 - copy all your pictures to a new folder (ex.: Temp1), to avoid loosing the originals

2 - create a new folder where your pictures will be after being resized (ex.: Temp2)

3 - open a cmd window, go to the directory that have the copied pictures (Temp1)

4 - type:

mogrify -path full_path_to_Temp2 -resize 1280x720 *.jpg

\$\endgroup\$
7
  • 1
    \$\begingroup\$ This is what I was looking for. You also guessed my phone right, its an S3. I ma downloading imagemagick right now. what would be the command resize the images of all files in one folder to 1280x720? \$\endgroup\$
    – bran
    Dec 14, 2012 at 12:04
  • 1
    \$\begingroup\$ On wordpress I use a plugin to automatically resize images uploaded It uses a server side utility called littleutils (sourceforge.net/projects/littleutils) I wanted to use something like that. Which makes me believe that it can be possible to compress jpeg farther without losing much quality or reducing resolution. Currently most of my images are 2305x3072 or 2592X1944. \$\endgroup\$
    – bran
    Dec 14, 2012 at 12:11
  • 1
    \$\begingroup\$ I found this on linux manpagez.com/man/1/opt-jpg \$\endgroup\$
    – bran
    Dec 14, 2012 at 12:14
  • 3
    \$\begingroup\$ oh, so you ARE willing to sacrifice resolution? \$\endgroup\$ Dec 14, 2012 at 12:19
  • 4
    \$\begingroup\$ While I agree with everything said here, I'd like to point out that while many people show photos on their phone, they also like to zoom to show parts of the picture in more detail. If you do this but have downsampled your image to just the resolution of the phone screen, you WILL notice the difference as you are now showing a smaller region at the phone resolution, but you have already lost those pixels. Just a thought. \$\endgroup\$ Dec 14, 2012 at 16:24
2
\$\begingroup\$

You can obtain lossless optimization (based on optimizing the Huffman tables). The utility jpegoptim provides this algorithm.

Install it with (on debian):

apt-get install jpegoptim

To run a simulation (no action mode):

jpegoptim -n -p dsc07844.jpg

returns:

dsc07844.jpg 3872x2592 24bit Exif  [OK] 3057132 --> 2518805 bytes (17.61%), optimized.

To optimize:

jpegoptim -p dsc07844.jpg

It preserves the exif metadata

\$\endgroup\$
2
\$\begingroup\$

Ah, well you answered yourself, but changed your requirements. "No loss of quality" and "no loss of quality to the naked eye" are vastly different with images.

Also, PNGcrush and opt-jpg work completely differently; only noting this because you mentioned PNGcrush in your OP. PNGcrush only optimizes metadata about the image, not the image itself. This is why you typically only gain 1-2%.

Frankly, as to the two images in your answer, they do look completely different to my eye. The optimized image is much more washed out and has less black-depth. Since it's a JPEG, this was likely done by condensing the palette, which will make the image look... different.

The answer to your original question is that you cannot reduce file size significantly without affecting some kind of quality (except for the earlier mentioned 1-2% savings by metadata or tag compression.) i.e., by removing EXIF data, et cetera, depending on the format of the file (RAW, TIFF, JPEG).

To reduce file size by any real measure, you must either lose quality or resolution or both. If that wasn't the case, photographer wouldn't bother processing in RAW.

\$\endgroup\$
1
\$\begingroup\$

Given a resolution and quality level, there exist several other image file formats that can give the equivalent, but store the data more compactly than does the old standard JPEG.

Some options include

  • JPEG2000, identified by the .jp2 extension, is a somewhat older format that just never got popular. It uses wavelet transforms rather than jpeg's DCT (discrete cosine transform) which results in artifacts that are less obvious, thus allowing for more compression with a comparable perceived quality. They claim a 20% advantage. https://en.wikipedia.org/wiki/JPEG_2000

  • Google's WebP uses more advanced algorithms (if I understand correctly, it's analogous to today's better H.265 compression for video as compared to MPEG), which they claim can save 40% with equivalent quality. http://www.cnet.com/news/google-offers-jpeg-alternative-for-faster-web/#!

  • BPG (for "better portable graphics") is a new open-source effort. It appears to be similar in approach to WebP, with additional advantages like better bit-depth and dynamic range, but as of today it has less compatibility with various software. http://bellard.org/bpg/

If you want the nitty gritty details on how these and some others compare, you can see charts and graphs here: https://people.mozilla.org/~josh/lossy_compressed_image_study_july_2014/

\$\endgroup\$
0
\$\begingroup\$

You need to "compress" the folder - There are various ways to do this - the classic one being to "Zip" them.

In windows (XP onwards) right-click on the containing folder, click "send to" then "Compressed folder"

This should reduce the size of the folder, and save it as a .zip file.

HOWEVER - Jpeg files are already compressed in their own encoding - so the final compressed file may actually not be much different at all.

\$\endgroup\$
2
  • \$\begingroup\$ If I zip them I won't be able to view them on my phone where I will be transferring them. I know there are way to do it individually. I need a way to do it in one go. Preferably under windows. \$\endgroup\$
    – bran
    Dec 14, 2012 at 11:14
  • \$\begingroup\$ Ok I see - hmm, if they must be kept as jpg's, without sacrificing quality or resolution I don't think you are going to be able to do it. If you are willing to lower the quality SLIGHTLY so that the difference is not obvious, then you could easily save a good amount of size. \$\endgroup\$ Dec 14, 2012 at 11:18
0
\$\begingroup\$

You can use a program called Moo0 Image Sizer, which allows to resieze many images at once (as of 15 dec 2012, the available formats are jpg, png, bmp and gif).

The program is free for non commercial use.

\$\endgroup\$
1
  • \$\begingroup\$ Hi there E. Fisher, welcome to the site. It would be useful, I think, to flesh out your answer with some more, and confirmed, detail. \$\endgroup\$
    – Joanne C
    Dec 14, 2012 at 19:20
0
\$\begingroup\$

I have found the answer I was looking. The answer is opt-jpg for Linux. I didn't find it on ubuntu repository. So you have to download the source of littleutils (http://sourceforge.net/projects/littleutils/) which has opt-jpg included.

To install from source. Download the Tar with wget and:

tar jxvf littleutils-1.0.27.tar.bz2 && cd littleutils-1.0.24

...

./configure --prefix=/usr && make && make install && make install-extra

You have to be root so sudo su

I used a duck image for example. The un-optimized file is 1.1M after optimization its 991kb without losing any image quality (to naked eye) or changing the resolution of the image. It might not seem like huge difference (a reduction of 108kb) but with 2300+ images and 6.44gb size on average with the same size reduction can add up to a lot of space. enter image description here

You can see the original Duck image uploaded to flickr: enter image description here

And the optimized one: enter image description here

Can naked eye tell the difference?

As for how much space I actually saved. You will have to wait some time because I will have to let it run when I am not using the comp. This will take a while and I will remember to report back.

\$\endgroup\$
8
  • \$\begingroup\$ Just to update on people on how much space I saved. It took about 25 minutes for it to finish and I saved about ~200MB in size. \$\endgroup\$
    – bran
    Dec 17, 2012 at 10:26
  • 1
    \$\begingroup\$ So, a 3% savings overall? \$\endgroup\$
    – mattdm
    Dec 17, 2012 at 12:06
  • 2
    \$\begingroup\$ As an aside, you do know that is a swan, and not a duck, right? \$\endgroup\$ Dec 17, 2012 at 12:19
  • \$\begingroup\$ @mattdm Yes not much but now I know that it can be done and not really a "TANSTAAFL" :) \$\endgroup\$
    – bran
    Dec 19, 2012 at 9:39
  • 1
    \$\begingroup\$ The naked eye can't tell the difference when you reduce the resolution to match the phone, nor if you were to drop the quality from 12 to 8. Those two things together would save you %75, not 3%, of your file size, bringing the whole collection under a gig, with no way to tell without zooming in. (Not sure what quality setting those were originally saved as, but you can usually get an HD size image down to 250kb or so and still look great). \$\endgroup\$
    – wedstrom
    Apr 19, 2016 at 15:36
0
\$\begingroup\$

in windows i use a program called RIOT (Radical image optimization tool). Until now is the best i know of.

http://luci.criosweb.ro/riot/

\$\endgroup\$
0
\$\begingroup\$

"Image Resizer for Windows" is a great free utility in less than 1MB for Windows users. All the images that are 5 MB or 10 MB can be cracked down to less than 200kb, with almost the same clarity. The problem is: these 10 MB images have a resolution of 4000 X 3000, but your phone or computer is only a 3rd of that, making it feel almost same. So unless you are going to print any of these, I will recommend compressing your images using this real-simple tool. Just select all files, right-click and say Resize. It will convert 100 images in less than a minute.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.