<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>itsAnimesh.com &#187; Imagemagick</title>
	<atom:link href="http://itsanimesh.com/tag/imagemagick/feed/" rel="self" type="application/rss+xml" />
	<link>http://itsanimesh.com</link>
	<description>A Techie Gyaan Vyaan Blog.</description>
	<lastBuildDate>Mon, 06 Sep 2010 18:50:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Compress Pictures In Linux(Modified)!!!</title>
		<link>http://itsanimesh.com/2009/02/01/compress-pictures-in-linuxmodified/</link>
		<comments>http://itsanimesh.com/2009/02/01/compress-pictures-in-linuxmodified/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 08:03:10 +0000</pubDate>
		<dc:creator>Animesh Kumar</dc:creator>
				<category><![CDATA[Techi Gyaan]]></category>
		<category><![CDATA[FOSS]]></category>
		<category><![CDATA[Imagemagick]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Softwares]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://itsanimesh.com/?p=156</guid>
		<description><![CDATA[I got the script to move the new compressed images into a new folder that would be located in your home folder. As i explained before you need imagemagick installed on your system to run the script. In ubuntu it can be installed by typing in the terminal sudo apt-get install imagemagick Heres the script [...]]]></description>
			<content:encoded><![CDATA[<p>I got the script to move the new compressed images into a new folder that would be located in your home folder.</p>
<p>As i explained <a href="http://itsanimesh.com/2009/01/26/compress-pictures-in-linux/">before</a> you need <strong>imagemagick</strong> installed on your system to run the script.<br />
In ubuntu it can be installed by typing in the terminal <strong>sudo apt-get install imagemagick</strong></p>
<p>Heres the script :<br />
<code><strong>#!/bin/bash<br />
# A script to resize images.<br />
readonly OUT_FMT=&quot;_new.jpg&quot;<br />
if [ &quot;$#&quot; -eq 0 ] ; then<br />
  echo &quot;A script to resize images &quot;<br />
  echo &quot;How to use : $(basename $0) add_of_image1 add_of_image2 ...&quot;<br />
  exit 1<br />
fi<br />
read -p 'Enter name of Folder where compressed images would be located (would be made in your home folder) : ' fname<br />
mkdir ~/$fname<br />
for pic<br />
do<br />
  # New filename<br />
  out_name=&quot;${pic%.*}$OUT_FMT&quot;<br />
  if [ -e &quot;$out_name&quot; ] ; then<br />
    echo &quot;Output file $out_name exists, Not resizing!!!&quot;<br />
  elif [ &quot;${pic#*$OUT_FMT}&quot; == &quot;&quot; ] ; then<br />
    echo &quot;$pic already resized!!!&quot;<br />
  elif [ ! -r &quot;$pic&quot; ] ; then<br />
    echo &quot;Error : could not access $pic !!!&quot;<br />
  else<br />
    echo -n &quot;$pic -&gt; $out_name&quot;<br />
    convert -quality 80 -resize 800x600 &quot;$pic&quot; &quot;$out_name&quot;<br />
    if [ ! -e &quot;$out_name&quot; ] ; then<br />
      echo &quot; Error .. No output file!!!&quot;<br />
    else<br />
      echo &quot; ($(du -h &quot;$out_name&quot; | cut -f1))&quot;<br />
    fi<br />
  fi<br />
mv "$out_name" ./$fname/<br />
done<br />
</strong></code></p>
<p>I also didn&#8217;t explain the script properly in the previous post so i&#8217;ll that now.<br />
Firstly the script should be copied from here and pasted in a text editor. Then save it as <strong>resize.sh </strong> in your home folder(you can save it any where you wish but then how you call the scritp would change thats why its easier to save it in the home folder <img src='http://itsanimesh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ). Now open a terminal type:<br />
<strong>animesh@animesh-laptop:~$ sudo chmod +x resize.sh</strong></p>
<p>after this do <strong>animesh@animesh-laptop:~$ ./resize.sh aaa.jpg </strong><br />
This would ask a for a folder where new image should be placed<br />
<strong>Enter name of Folder where compressed images would be located (would be made in your home folder) : </strong><br />
Specify the name of a new folder where you wanna save the image.<br />
The new compressed image would be saved in the folder you specified with the name <strong>aaa_new.jpg</strong></p>
<p>You can also convert all pictures of a directory at once by<br />
<strong>animesh@animesh-laptop:~$ ./resize.sh Desktop/linux09/*.JPG</strong><br />
This to would ask for a folder where you would like to save the new compressed images.</p>
<p>Now in the line <strong>convert -quality 80 -resize 800&#215;600 &quot;$pic&quot; &quot;$out_name&quot;</strong> in script the value after <strong>-quality </strong> is the argument specifies the amount of JPEG/MIFF/PNG compression level, the lower the value(meaning 60 or 50) the higher is the compression(change it according to what you want). The <strong>-resize</strong> is used to resize an image, the argument following resize(i.e. 800&#215;600) can be changed to what you want.<br />
Leave a comment if you face any problems. <img src='http://itsanimesh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://itsanimesh.com/2009/02/01/compress-pictures-in-linuxmodified/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Compress Pictures In Linux!!!</title>
		<link>http://itsanimesh.com/2009/01/26/compress-pictures-in-linux/</link>
		<comments>http://itsanimesh.com/2009/01/26/compress-pictures-in-linux/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 14:06:45 +0000</pubDate>
		<dc:creator>Animesh Kumar</dc:creator>
				<category><![CDATA[Techi Gyaan]]></category>
		<category><![CDATA[FOSS]]></category>
		<category><![CDATA[Imagemagick]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Softwares]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://itsanimesh.com/?p=127</guid>
		<description><![CDATA[I have made a script to compress a set of images so that they can be mailed as images taken form a digicam are normally of 10 or 15MB and to upload a set of images is a pain in the ***. Firstly you need to install package Imagemagick&#8230; In ubuntu you can install by [...]]]></description>
			<content:encoded><![CDATA[<p>I have made a script to compress a set of images so that they can be mailed as images taken form a digicam are normally of 10 or 15MB and to upload a set of images is a pain in the ***. <img src='http://itsanimesh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Firstly you need to install package Imagemagick&#8230;<br />
In ubuntu you can install by <strong>sudo apt-get install imagemagick<br />
</strong><br />
Now just copy the attached in an editor:<br />
<code><strong>#!/bin/bash<br />
# A script to resize images.<br />
readonly OUT_FMT=&quot;_new.jpg&quot;<br />
if [ &quot;$#&quot; -eq 0 ] ; then<br />
  echo &quot;A script to resize images &quot;<br />
  echo &quot;How to use : $(basename $0) add_of_image1 add_of_image2 ...&quot;<br />
  exit 1<br />
fi<br />
for pic<br />
do<br />
  # New filename<br />
  out_name=&quot;${pic%.*}$OUT_FMT&quot;<br />
  if [ -e &quot;$out_name&quot; ] ; then<br />
    echo &quot;Output file $out_name exists, Not resizing!!!&quot;<br />
  elif [ &quot;${pic#*$OUT_FMT}&quot; == &quot;&quot; ] ; then<br />
    echo &quot;$pic already resized!!!&quot;<br />
  elif [ ! -r &quot;$pic&quot; ] ; then<br />
    echo &quot;Error : could not access $pic !!!&quot;<br />
  else<br />
    echo -n &quot;$pic -&gt; $out_name&quot;<br />
    convert -quality 80 -resize 800x600 &quot;$pic&quot; &quot;$out_name&quot;<br />
    if [ ! -e &quot;$out_name&quot; ] ; then<br />
      echo &quot; Error .. No output file!!!&quot;<br />
    else<br />
      echo &quot; ($(du -h &quot;$out_name&quot; | cut -f1))&quot;<br />
    fi<br />
  fi<br />
done<br />
</strong></code></p>
<p>Now save it as resize.sh in your home folder.</p>
<p>Now in the terminal type<br />
<strong>animesh@animesh-laptop:~$ sudo chmod +x resize.sh</strong></p>
<p>after this do <strong>animesh@animesh-laptop:~$ ./resize.sh aaa.jpg </strong><br />
This would return a file <strong>aaa_new.jpg</strong></p>
<p>You can also convert all pictures of a directory at once by<br />
<strong>animesh@animesh-laptop:~$ ./resize.sh Desktop/linux09/*.JPG</strong></p>
<p>The only problem with the script is that all the resized pictures would be in the same folder as original pictures. I am not able to move it in a new folder don&#8217;t know why. If you face any problem please leave a comment or if you know the solution to my problem please lemme know&#8230; <img src='http://itsanimesh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<strong><a href="http://itsanimesh.com/2009/02/01/compress-pictures-in-linuxmodified/">This post has being modified.</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://itsanimesh.com/2009/01/26/compress-pictures-in-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
