How about a program to mass-resize jpegs/pngs?
Is there a way to take a whole directory of pictures that are of various dimensions and scale them all down to conform to, say, an 800x600 (or 600x800) boundary?
Better yet is it possible to also ignore and not size-up files that are, say, 400x300? I am command line savvy so if it can be done via some kind of script I'm cool with that. Thanks! |
gm
how about a script using convert?
http://www.linuxquestions.org/questi...ut-how-655591/ |
You can convert them by using GWENVIEW. The resize option does it easy for you !
|
Quote:
But I would like to use convert, too - I don't see a way for convert to intelligently scale the pic like Gwenview does. Has anyone here used irfanview's batch resizer? I'm trying to replace that. |
Quote:
Evo2. |
Quote:
Again, I don't know gwenview, but if it can do the job (change scale of all pics in a directory, right?) then just use whatever is easier for you. It does sound more like something a command/script rather than a GUI would do better though. I'd write a script using "convert -resize 800x600" (GraphicsMagick package) to resize the image, and "identify" to check its resolution just in case I wanted to skip some. All the rest would maybe be a couple of sed or cut sentences. |
Code:
find ./ -maxdepth 1 -exec basename "{}" \; | while read picture; do This uses ImageMagick tools `mogrify` and `identify`, and there are other mogrify options besides "scale" (such as "resize") that you may want to use instead; depends how you want the pictures to turn out. Your mileage might vary -- Back up your pictures first! Test this on a bunch of spare pictures!! Sasha |
Quote:
|
LOL ;) hopefully 'wicked sick' == 'good' and not 'argh! it formatted my HDD!' :p
Good luck, Sasha |
Quote:
Wicked Sick == it worked! :D |
Okay here's a bonus question... how to modify that command to do the same thing across several subdirectories (assuming I ever need that function)?
|
Just omit the "-maxdepth 1" option or change the "1" to however deep you want to go in the directory structure.
Evo2. |
Actually, since I used `basename` you'll have to remove that as well. Remove all of:
Code:
-maxdepth 1 -exec basename "{}" \; |
Quote:
Seriously though, where'd you learn to do this? I've done a mean script or two myself and this is pretty advanced stuff. |
Ahh, no voodoo involved, and honestly, this really isn't very high-tech, but I'm happy that it works for you.
Where to learn this stuff? Just practice and fiddle around. :) I enjoy scripting -- and lots of other folks do too (though you will also have lots of people tell you to not bother, and to learn another language, depending on what exactly you're trying to do), and there are definitely others around here who are far more advanced scripters than I am. Basically, when you want or need something done, and you don't know C or python or Perl or <blah> or <whatever> other language, and you're determined to do it with a shell script, then just try and try again. I never set out on a mission to "learn scripting inside and out" -- so I don't know the half of it -- but I know how to do what I've needed to learn how to do. Eventually you end up knowing lots of neat little things, by playing around.. Cheers, Sasha |
All times are GMT -5. The time now is 07:30 AM. |