{"id":7364,"date":"2004-03-23T01:39:50","date_gmt":"2004-03-22T23:39:50","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/2004\/03\/23\/resizing-or-rotating-a-banch-of-images\/"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T22:00:00","slug":"resizing-or-rotating-a-banch-of-images","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2004\/03\/23\/resizing-or-rotating-a-banch-of-images\/","title":{"rendered":"Resizing or rotating a banch of images"},"content":{"rendered":"<!-- google_ad_section_start -->\n\n<p>It is very often that one has a need to rotate a bunch of images by 90 or 180 degrees clockwise or otherwise, or resize the same bunch of images to a certain size. Read more to learn  how you can do it.\n<\/p>\n<p><!--more-->\t<\/p>\n<p>First of all, you should defenetely install ImageMagick. If you are using any of the modern Linux distributions (like Red Hat Linux 6\/7\/8\/9), most probably you either have it already installed, or it is available on the distribution CD-ROM. If it is not, then you can always download it from http:\/\/www.imagemagick.org\/.<\/p>\n<p>Now for the fun part:<br \/>\n<\/p>\n<div class=\"asis\"><code><br \/>\n<br \/>\n[leonid@home tmp]$ cd \/home\/leonid\/files\/images<br \/>\n<br \/>\n[leonid@home images]$ for IMAGE in *.jpg ; do echo Working with $IMAGE ; mv<br \/>\n<br \/>\n\"$IMAGE\" \"$IMAGE.huge\" ; convert -resize 800x600 \"$IMAGE.huge\" \"$IMAGE\" ; done<br \/>\n<br \/>\n[leonid@home images]$ rm -f *.huge<br \/>\n<br \/>\n<\/code><\/p>\n<\/div>\n<p>Almost the same thing is for rotating. This time, let&#8217;s see how it will look in the script file:<\/p>\n<div class=\"asis\"><code><br \/>\n<br \/>\n#!\/bin\/bash<br \/>\n<br \/>\n# go into directory with images<br \/>\n<br \/>\ncd \/home\/leonid\/files\/images<\/p>\n<p># Repeat steps for each JPEG image in the directory<br \/>\n<br \/>\nfor IMAGE in *.jpg<br \/>\n<br \/>\ndo<br \/>\n<br \/>\n        # Do some noise so that we know that it's working<br \/>\n<br \/>\n\techo Working with $IMAGE<br \/>\n<br \/>\n\t# Move original image to another file<br \/>\n<br \/>\n\tmv \"$IMAGE\" \"$IMAGE.huge\"<br \/>\n<br \/>\n\t# Rotate the backup file and save as original file<br \/>\n<br \/>\n\tconvert -rotate 90 \"$IMAGE.huge\" \"$IMAGE\"<br \/>\n<br \/>\ndone<\/p>\n<p># Remove backup copies<br \/>\n<br \/>\nrm -f *.huge<br \/>\n<br \/>\n<\/code><\/p>\n<\/div>\n<p>That&#8217;s all folks. ImageMagick has a number of other utilities which can do a number of other things. Check them out.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>It is very often that one has a need to rotate a bunch of images by 90 or 180 degrees clockwise or otherwise, or resize the same bunch of images to a certain size. Read more to learn how you can do it.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_links_to":"","_links_to_target":""},"categories":[1,62],"tags":[],"keyring_services":[],"class_list":["post-7364","post","type-post","status-publish","format-standard","hentry","category-general","category-technology"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":7981,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/09\/30\/timestamp_image\/","url_meta":{"origin":7364,"position":0},"title":"timestamp_image","author":"Leonid Mamchenkov","date":"September 30, 2004","format":false,"excerpt":"This is yet another script to deal with images from digital cameras. It will scale (resize preserving the width to height ratio) down the image to the size you've specified and annotate (write on top of the image) it with date time taken from EXIF header of the image. Font\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7893,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/09\/11\/a-primer-on-image-histograms-and-curves\/","url_meta":{"origin":7364,"position":1},"title":"A Primer on Image Histograms and Curves","author":"Leonid Mamchenkov","date":"September 11, 2004","format":false,"excerpt":"\"A Primer on Image Histograms and Curves\" is an excellent tutorial on what does it take to make image perfect. First application of histograms and curves is at scanning images into the computer. There are plenty of others, of course, such as fixing colors, changing the appearence, and creative touch.\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":16134,"url":"https:\/\/mamchenkov.net\/wordpress\/2012\/02\/28\/frankfurt-and-karlsruhe-photos\/","url_meta":{"origin":7364,"position":2},"title":"Frankfurt and Karlsruhe photos","author":"Leonid Mamchenkov","date":"February 28, 2012","format":false,"excerpt":"In November 2009 I went for a PHP conference in Karlsruhe, Germany. \u00a0I've also visited Frankfurt briefly. \u00a0As with most of my travels, I've shot a whole bunch of pictures. \u00a0But unlike my other travel pictures, these ones were waiting for post-processing for way too long. \u00a0Yesterday I abandoned the\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2012\/02\/Licher-Beer.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":8001,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/10\/04\/cd-writing-on-fedora-linux\/","url_meta":{"origin":7364,"position":3},"title":"CD writing on Fedora Linux","author":"Leonid Mamchenkov","date":"October 4, 2004","format":false,"excerpt":"Fedora Linux provides a selection of tools for writing CDs. k3b and xcdroast with nice graphical user interfaces (GUIs). cdrecord and cdrdao for console users. All of these work just fine and have a number of options to fine tune the process. There are few other tools provided in different\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7512,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/05\/18\/fedora-linux-core-2-released\/","url_meta":{"origin":7364,"position":4},"title":"Fedora Linux Core 2 released","author":"Leonid Mamchenkov","date":"May 18, 2004","format":false,"excerpt":"Fedora Linux Coree 2 has been released today by Fedora Project. It features all sorts of tasty things - Linux kernel 2.6, KDE 3.2.2 (GNOME 2.6 for those who prefer it), Xorg 6.7.0, Security Enhanced Linux integration and much more. I am currently downloading it via BitTorrent at 400+ KB\/s.\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":23796,"url":"https:\/\/mamchenkov.net\/wordpress\/2015\/04\/02\/the-cloud-market-the-most-complete-catalog-of-amazon-ec2-images\/","url_meta":{"origin":7364,"position":5},"title":"The Cloud Market &#8211; the most complete catalog of Amazon EC2 images","author":"Leonid Mamchenkov","date":"April 2, 2015","format":"link","excerpt":"The Cloud Market - the most complete catalog of Amazon EC2 images. \u00a0What's even more interesting is their statistics page.","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"the cloud market","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2015\/04\/the-cloud-market-500x306.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/7364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=7364"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/7364\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=7364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=7364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=7364"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=7364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}