Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I know that there's a few programs out there to convert a particular image from one filetype (i.e. GIF), to another (JPEG), like the GIMP, but are there any programs that you can mass or rather, "bulk change" the format. That is, do many at a time.
I'm generally looking to change large JPEGs to smaller jpegs, probably of lower quality. Since I have many high-quality images coming from my camera, it would be nice to have a quicker/easier way to make them smaller and put them on the Internet. Is there any program like this for Linux?
Your help is much appreciated. I see that I can quite easily change the size of an image and change it to JPG, but quickly browsing through it, there doesn't seem to be a way to do many at a particular time. Say, wanting it to convert all the images in a folder.
Since, it seems to only allow doing one at a time, and you need ot specify a new name for it each time. Sorry for the hassle.
Re-saving JPG to a much higher compression ratio will make the picture look very blocky. If your camera has a setting to save images as tiff, you can then convert the pictures to jpeg to get better compression ratios. You can use LZW compression (lossless compression) in tiff files if you want the file size to be smaller. Though consumer digital cameras can not handle multiple shots at once when it saving pictures as tiff because both the hardware in the camera and the flash medium can not keep up.
Tinkster, sorry to bother you again, but I'm having problems. Although I really don't know what to do with the bash script ;-), it seems to me as though the settings in there are quite different -- a png with something about 16x16.
I might appear lazy, but I'm really trying to just get this working. I got together with my brother and we managed to make a C++ program to do the job, but it has a few problems, and I'd much rather have it running from a simple "convert".
So, I guess, what I'm looking for is somewhere/thing to get knowledge on bash scripts from; for the moment, just enough to be able to make this thing work. Sorry for the hassle. Any help would be greatly appreciated.
Electro, thanks for the advice, I'll try to check my camera on that later. Though, it's not that good a camera. Don't get me wrong, it does the job, but I just doubt it'll have advanced functions like that. Thanks, anyhow.
I'm on a real low wavelength here, sorry. When we make a bash script, I see we just run it, and it delivers a number of commands. Now I felt stupid for not guessing that. :P
Anyhow, I tried using that command that you suggested, but I had the same problem that I originally had -- not knowing how to use the -exec. The man page was a little useful, but didn't help that much.
When I type out your command in a terminal, I get this returned:
find: missing argument to `-exec'
I don't have to modify the command you suggested in any way, do I? Sorry, I promise to get it soon.
In david_ross script it has little bug. If your jpeg files has spaces in their paths, it will not work. Change the script from
Code:
#!/bin/bash
# Pass the dir to look in as the first argument
for file in `find $1 -name *.png`; do
name=`echo $file | sed 's/\.png/_16x16\.xpm/'`
convert $file $name
done
to
Code:
#!/bin/bash
# Pass the dir to look in as the first argument
for file in `find $1 -name *.png`; do
name="`echo "$file" | sed 's/\.png/_16x16\.xpm/'`"
convert "$file" "$name"
done
The double quotes (") preserves the spaces and tabs. After you create the script, you will have to use chmod to make the file executable or just the command sh follow by the name of the script that you want to run.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.