Jump to content

batch resize images


cybormoron

Recommended Posts

i wrote this little story and thought it might be amusing and informative. i hope you enjoy it.ok, the challenge is; batch resize images. i don't know how at this point but i have fun learning. it wasn't too hard to figure out. a little googling and man page reading gets the job done. i'm about to discover the mogrify command. mogrify? is that a word? never heard of it. follow along as i search for clues to batch resize images in linux. the first thing i do is right click the images in konqueror to check the context menu for a batch resizing option. nope, there's a "convert to" option and a "transform image" option and there're 2 options to rename with gwenrename or krename but no resize option, hmmm? let's try gimp. i know how to scale an image with gimp but i can't find an option to scale a batch of about 200 images, hmmm?let's look in my graphics menu. i have many fine graphics programs installed. surely one of them will work. i have the GUI version of imagemagick. i think this is the application i want to use as i hear lots of great reviews about this program. they say it does everything but the little commands module only allows me to open 1 image, hmmm? well it's off to google i go. remember google is your friend, right? (giyf). the first result describes using the mogrify tool from the imagemagick libraries and gives an example. this sample command will be the command i eventually run but i don't quite understand what it means at this point so i investigate further before i run it.the next result mentions the convert tool and provides a link to the command line options page on the imagemagick website. nice website with great documentation about imagemagick but i still don't quite understand what to do. it describes the -resize option but it doesn't say anything about batch images, hmmm? still scratching my head but i'm getting warmer. time to RTFM. (read tux's fine manual) man imagemagick...no manual entry for imagemagick, hmmm?man convert...aha, lots of fine info here. "The convert program is a member of the ImageMagick(1) suite of tools". i think i'm beginning to understand. ImageMagick is a suite of tools. convert and mogrify are 2 of those tools. see-also ImageMagick. (notice the upper case letters).man ImageMagick...aha, more fine info.man mogrify...aha, getting really warm now. great documentation but i'm still not sure what to run. what is the difference between convert and mogrify, hmmm? convert will create the resized images in the present working directory (pwd) without overwriting. mogrify will overwrite. ok, let's try mogrify and see what happens. i'll use mogrify because i'm working from copies and i want every image in the directory overwritten.mogrify [options] input-filethe command = mogrify[options] = -resize 1024x768!. the exclamation point forces size to the geometry specified.input-file = *.jpg. this will do every jpg file in the directory.mogrify -resize 1024x768! *.jpgworks like a charm. i'm impressed. i have just become an afficionado of ImageMagick. it was fun learning how to use it. it really didn't take too long to hunt down information and use it. it was easy really. it took me longer to type this post than it did to learn how to batch resize images. i still can't find "mogrify" in a dictionary though.linkyshttp://www.imagemagick.org/script/index.phphttp://www.imagemagick.org/script/command-...ions.php#resizehttp://www.novell.com/coolsolutions/tip/16524.htmlhttp://www.smokinglinux.com/tutorials/howt...resize-on-linux

Edited by cybormoron
Link to comment
Share on other sites

Hi Steve Running Linux is like walking in a giant wild garden, you keep discovering beautiful exotic flowers. :)A truly great program that imagemagick . . . . I use it all the time, not only to resize and convert but also to take screenshots, see Here and Here ;):thumbsup: Bruno

Link to comment
Share on other sites

i'll give those a try bruno. you mentioned those before but i didn't pay attention. now that i've jumped in the pool the water ain't so bad, lol.i see that mogrify word again, lol.aha, i found the definition. the correct word is transmogrify. http://dictionary.reference.com/search?q=t...amp;x=0&y=0i should have used bruno linux first."mogrify transforms an image or a sequence of images. These transforms include image scaling, image rotation, color reduction, and others. The transmogrified image overwrites the original image."from now on i'll remember bliyf, (bruno linux is your friend)

Edited by cybormoron
Link to comment
Share on other sites

To paraphrase Bruno: Running GNOME is like walking in a giant wild garden, you keep discovering beautiful exotic flowers. :thumbsup:

Link to comment
Share on other sites

Steve,If you're a Gnomie, install "Nautilus Image Converter". It'll add "Resize" and "Rotate" entries "under" your right moose button:kuvakaappausresizeimagehf0.pngkuvakaappausrotateimagekj4.pngOr... use a similar G-Script: http://linux.gotfoo.org/resize-multiple-im...ith-a-g-script/ :thumbsup:I :w00t: GNOME... :thumbsup:
A simple enough task if you are running Ubuntu Gutsy. However...I can't seem to find nautilus-image-converter in the Mandriva 2008 repos. I don't want to go off on a web search for the .rpm lest I end up in dependency h***. Any ideas? :w00t:
Link to comment
Share on other sites

Dunno 'bout h***... my (limited) experience is that installing the odd .rpm in Mandriva works just the way you'd install a .deb in Ubuntu... double click on the package icon. As for the package... I found this in the "Cooker", so it might still be a bit hot:http://rpmfind.net/linux/RPM/mandriva/deve...008.1.i586.htmlOr... grab the "G-Script". If I remember correctly, the "basic" Nautilus scripts are in Mandriva's repos, by the way. :)Edit: linky is flaky... here's another: http://rpm.pbone.net/index.php3/stat/4/idp...1.i586.rpm.html

Link to comment
Share on other sites

;) here is a direct link to the rpm:ftp://fr2.rpmfind.net/linux/MandrakeCooke...2008.1.i586.rpmBUT it should be even easier to install with this command:
# urpmi ftp://fr2.rpmfind.net/linux/MandrakeCooker/cooker/i586/media/contrib/release/nautilus-image-converter-0.3.0-1mdv2008.1.i586.rpm

( command is ONE line )B) Bruno

If you try to install either way you run into dependency problems due to a missing library:*A requested package cannot be installed:nautilus-image-converter-0.3.0-1mdv2008.1.i586 (due to unsatisfied libgio-2.0.so.0)Continue installation anyway? (Y/n)*If you install libgio-2.0.so.0 another library is missing.The G Script idea works pretty well in Mandriva so I'll stick with that I guess. Edited by raymac46
Link to comment
Share on other sites

Looks like that cooker package is not suited for 2008 . . . sorry. Maybe it will work on 2008-spring ( next release );) Bruno

Link to comment
Share on other sites

Looks like that cooker package is not suited for 2008 . . . sorry. Maybe it will work on 2008-spring ( next release )B) Bruno
I played around a bit more with packages and did finally get the nautilus-image-converter to install. However it still didn't work. I tried to install the cooker version of ImageMagick and soon got into a recursive dependency where a package had to be removed (for upgrading) but could not because what I wanted to install depended on it. ;) I'm not ready for the bleeding edge yet (if ever). I'd rather wait for a package to show up in the repos when all the dependencies are sorted out. Edited by raymac46
Link to comment
Share on other sites

I played around a bit more with packages and did finally get the nautilus-image-converter to install. However it still didn't work. I tried to install the cooker version of ImageMagick and soon got into a recursive dependency where a package had to be removed (for upgrading) but could not because what I wanted to install depended on it. ;) I'm not ready for the bleeding edge yet (if ever). I'd rather wait for a package to show up in the repos when all the dependencies are sorted out.
One more thing. I re-installed ImageMagick and ImageMagick desktop which gives a nice little GUI for image manipulation. That's the ticket for Mandriva 2008 I think. B) Edited by raymac46
Link to comment
Share on other sites

Cluttermagnet
i see that mogrify word again, lol.aha, i found the definition. the correct word is transmogrify. http://dictionary.reference.com/search?q=t...amp;x=0&y=0
Merriam-Webster online has a similar definition:Transmogrify transitive verb : to change or alter greatly and often with grotesque or humorous effectThere was a novel by science fiction writer Philip K. Dick titled "The Transmogrification of (insert person's name here- I forget it)" It was weird and entertaining, as was all his other crazy stuff. BTW some of you might not know you are seeing PKD's work in the movie "Blade Runner" with Harrison Ford, which was based on one of his novels- "Do Androids Dream of Electric Sheep", if I remember right.Edit: Nope- it was "The Transmigration of Timothy Archer" (1982).transmogrify "to change completely," 1656, apparently a perversion of transmigure, from transmigrate, perhaps influenced by modify. Edited by Cluttermagnet
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...