View Full Version : [SOLVED] How reduce picture file size in linux

11th March 2010, 06:54 PM
Hello I'm all new to linux.
I've got Fedora core 12 - I'm ex windows user.
I have these 3 websites to maintain:
These are in finnish language. So called pikalaina sites:
pikalainat (http://www.pikalainatheti.com)
pikavipit (http://www.pikavippinyt.com)
vipit (http://www.vippinyt.com)

And I have to add pictures to these pages. I don't know how to do even that I don't know web programming or HTML :(

But my images are about 1 mb in file size - I use to have windows and photoshop and there is this save for web feature where file size is reduced.

I have this GIMP -program now - it's terrible compared to photoshop, but it's free.
In GIMP there is no feature how to reduce file size for ex. 1mb to 20 Kb....
How do I do this ? Do you know any good program to do it ?

11th March 2010, 07:30 PM
To reduce file-size you usually need to reduce the image size. Alternatively to can convert to another format like gif jpg or png, but if the image is already in one of these formats it might not help with filesize. (Just open in something like gThumb image viewer and choose save as..)

If you have huge images which you need to reduce in size then an easy command line tool is 'convert' from ImageMagick package

su -c 'yum install ImageMagick'

Then to reduce an image size by 50% do:

convert image.jpg -resize 50% image_new.jpg

To reduce a whole load of images in a directory do

for i in *.jpg; do convert "$i" -resize 50% "${i%%.jpg*}_new.jpg"; done

or for subdirectory recursion and filenames with spaces do

find . -type f -name "*.jpg" | while read i; do convert "$i" -resize 50% "${i%%.jpg*}_new.jpg"; done

11th March 2010, 07:56 PM
Okay I had a finnish version, but found it thanx

11th March 2010, 08:14 PM
You mean gimp or ImageMagick?

Both are very powerful packages, convert is command line but has a huge number or options (see man page), obviously use Gimp for anything more than just machine like reformatting:

To mimic photoshop's convert for web you might want to play with

convert <image> -quality XX -depth 8 -type palette result.jpg

where XX <= 100

or for gifs, you can reduce the colours with:

convert <image> -depth 8 -colors YY -type palette result.gif

where YY<256

11th March 2010, 08:22 PM
The quick-and-dirty method in the GIMP: load the image, select SAVE AS from the file menu, select JPEG, and you will see a dialogue that lets you select image quality. Lowering this percentage will reduce the size of the saved file. I always change the file name to preserve the original. If I reduce the percentage to 50%, I put 50 in the new filename, then examine the results.

As Dan's Guide says, image quality can degrade quickly. But starting with a size ~1 meg, I can usually reduce it by 50% without noticing much difference, and the resulting file size will be in the 100-300k range, acceptable for emailing and web use.

12th March 2010, 05:43 AM
I just happened to do exactly what you're asking last night in Gimp, though I reduced a .gif file from 68kb to 40.4kb by opening it and saving it as a .jpg, then when I opened the jpg it tells you right on right side of the screen (preview) the image size and pixels. I then reduced the jpg of 385x588 pixels to 70x107 pixels at 3kb size.

Select open, then when it's on the desktop, select >image > scale image and it'll let you select a new dimension in pixels (you probably want to copy the original image first!), if you just enter the new smaller width, and tab or enter it'll automatically re-do the length to keep the scale in proportion. (If you want to change the proportion, you'll have to unlink the chain beside the pixel dimensions...) you can also select percent, inches (centimeters), or points instead of pixels if you want.

You can also then change the resolution underneath that. When you're in the main gimp window with the image open it'll have a file size, or some sort of size; it's not accurate as far as file size though. Save your result and then use your file browser to find the new file size -- at least that's what I did.

12th March 2010, 06:49 AM
fotoxx is a simple tool very friendly, although the name is not that great.

12th March 2010, 08:41 AM
I understood the OP to be asking about reducing the size of an image file, and to do that with the GIMP you don't need to scale it - just SAVE AS (and JPEG) under the file menu. Whether you change the file name or not, a sub-requester opens up with a QUALITY meter on top, as well as a section of ADVANCED OPTIONS. Simply by lowering the quality from 100% the file size will be greatly reduced.

Just tried this, and a 925k photo was reduced in size to 132.5k by reducing the Quality setting to 50%. Side by side in the GIMP I cannot tell the two images apart at normal viewing.

12th March 2010, 03:27 PM
Folks ... there's a better than average chance we've been suckered and spammed here. I'm closing this and marking it solved.

Also, if the OP hasn't PMed me by the end of the day with a lot better explanation, it gets summarily deleted and I hand him over to the tender mercies of Spam Wars Sam. - Dan