LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to resize photo for email? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-resize-photo-for-email-650217/)

teachret 06-18-2008 11:11 PM

How to resize photo for email?
 
Just received my new eeePC with Linux and plan to use it for travel. Would like to download pictures and then share with family through email. While I have resized jpgs with Windows for years, I have not figured it out with Linux. Is there a way to change a 570 kb to a 57kb jpeg with Linux or do I need additional software? And if so, what is recommended and easy? Thank you.

pinniped 06-18-2008 11:22 PM

There is probably a better way than what I do, but I open the original in the 'GIMP', select 'save as' choose 'jpeg' and use a "quality factor" of around 32. That can shrink 2MB to 78KB (it really depends on the picture). I find that most times values below 32 give too many artifacts and poor color.

Don't overwrite your originals!

ischi 06-19-2008 12:56 AM

Or you could reduce the Resolution ... in GIMP you would do this by scaling the Image, I dont know from the Top of my head but there is a Option "Scale" in the MEnu somewhere, where you can enter the new resolution and then Save as... Or combine the 2 Scale the Resolution and the Quality.

GIMP would be the right tool so.

jschiwal 06-19-2008 02:19 AM

If you have an ImageMagick package installed you can use the "convert" program to resize photos as well.

This will resize all jpeg pictures in the current directory.
Code:

for photo in *.jpg; do
  convert -resize 25% "${photo}" small-"${photo}"
done

You could instead use "-resize 100x" to resize the photos to a width of 100 pixels, yet keeping the aspect ratio.

Using "-resize "500x>" will reduce the size of pictures that are more than 500 pixels wide, but leave smaller pictures alone.

The ImageMagick package installs html based instructions in /usr/share/doc/ImageMagick-<version>/www or /usr/share/doc/packages/ImageMagick/www, depending on the convention that is used in the eeepc.

nx5000 06-19-2008 05:02 AM

you can also play with the quality. jpegs size decrease very quickly for a small quality decrease, which is not noticeable by a human.
For a compression level of 90:
convert -quality 90 -resize 25% "${photo}" small-"${photo}"

I use convert
-geometry "50%x50%"
but there is also -scale and now I see that there is resize also.. not sure what the difference is.

Quote:

Originally Posted by jschiwal
-resize "500x>"

Thanks for the tip, that's interesting!

tredegar 06-19-2008 05:56 AM

If you are using KDE, there's a beautiful set of scripts called KIM (Kde Image Menu) by Charles Bouveyron.

KIM is a "front-end" to imagemagick: In konqueror R-click in an image file - Actions- KIM Convert (between formats) / Resize (filename is renamed as filename-resized), even publish as html, flash animations etc. It is perfect, and easily customisable / extensible. I like it very much. It is also a good example of how to make your own KDE servicemenus.

Get it here: http://linux.softpedia.com/get/Multi...Kim-2263.shtml

fair_is_fair 06-19-2008 08:40 AM

For emailing photos Picasa is hard to beat. It will automatically resize photos with no hoops to jump - just set the size you need.

I know many do not like the linux version because it is essentially a windows app running via wine but it still rocks.

jschiwal 06-19-2008 09:03 AM

There is a package of image utilities called ImageMagick. One of the programs, convert allows you to easily convert from one format to another or to resize pictures.

example:
convert rose.jpg -resize 50% rose.png

You can easily convert a batch of pictures:
Code:

#lets create a destination directory
mkdir small

#resize all jpeg pictures in the directory to a width of 256 pixels
for picture in *.jpg; do
  convert "${picture}" -resize -x256 "${picture%.jpg}"-s.jpg
done

If you have ImageMagick installed you may have html documentation installed in /usr/share/doc/ImageMagick-<version>/.

teachret 06-19-2008 03:29 PM

Eureka! Resizing Accomplished
 
Using the information sent out, I was able to plod my way through and was able to take a jpg from 557KB to 84KB. This is what I did:
In Photo Manager R-Click on a picture to resize.
Select---External Tools----Kolour Paint
In Paint Select the pull down file "Images"----Resize/Scale
Choose Smooth Scale, "X" Keep Aspect Ratio, Scroll to 50%, "ok"
Under the pull down for File----Save As---Rename the file (I just put an "e" in front of the name to designate it as an emailable file.) It will ask if you really want to: "Yes"
Thanks for the help. Now my little eeePC will be a great addition to our trips.

tredegar 06-19-2008 04:34 PM

Quote:

Eureka! Resizing Accomplished
Why are you insisting on going through all these commands / clicks / hoops and difficulties?

Just install KIM, and all this resizing is one Right-click-away.

The link is above, here (again) http://linux.softpedia.com/get/Multi...Kim-2263.shtml

I also have an "EEE", KIM is installed: It is brilliant, and if you read the scripts it provides, a good educational tool too.

"You can lead a horse to water ..."

'Nuff said. ;)

nx5000 06-20-2008 02:09 AM

"montage" is also very interesting, you can put several pictures on a webpage. This is the script I use:

Code:

montage -size 400x400  'Photos-2008*'  -thumbnail 200x200  -font /usr/X11R6/lib/X11/fonts/TTF/Vera.ttf        -set caption '%t' -bordercolor Lavender -background grey40      -gravity Center      -pointsize 9  -density 144x144  +polaroid  -resize 50%            -set label ''  -background white  -geometry +1+1  -tile 5x            index.html
+polaroid is a very nice effect


All times are GMT -5. The time now is 09:28 PM.