<?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>EmanuelDuss.ch. &#187; fotos</title>
	<atom:link href="http://emanuelduss.ch/tag/fotos/feed/" rel="self" type="application/rss+xml" />
	<link>http://emanuelduss.ch</link>
	<description>blog von @mindfuckup</description>
	<lastBuildDate>Thu, 26 Jan 2012 19:08:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Fotos nach Datum umbenennen mit jhead</title>
		<link>http://emanuelduss.ch/2011/02/fotos-umbenennen-mit-jhead/</link>
		<comments>http://emanuelduss.ch/2011/02/fotos-umbenennen-mit-jhead/#comments</comments>
		<pubDate>Sun, 06 Feb 2011 17:10:55 +0000</pubDate>
		<dc:creator>Emanuel Duss</dc:creator>
				<category><![CDATA[Multimedia]]></category>
		<category><![CDATA[Skripts]]></category>
		<category><![CDATA[fotos]]></category>
		<category><![CDATA[jhead]]></category>
		<category><![CDATA[konsole]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://emanuelduss.ch/?p=316</guid>
		<description><![CDATA[
<div class="twitterbutton" style="float: right; padding-left: 5px;"><a href="http://twitter.com/share?url=http://emanuelduss.ch/2011/02/fotos-umbenennen-mit-jhead/&amp;text=Fotos nach Datum umbenennen mit jhead&amp;via=mindfuckup&amp;related=DolcePixel"><img align="right" src="http://emanuelduss.ch/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="" /></a></div>
Digitalkameras speichern Bilder oft unter Dateinamen wie DSC00523.jpg. Mit diesen nicht sprechenden Namen kann ich nicht viel anfangen. Das Datum und die Uhrzeit des Fotos ist für den Dateinamen viel besser geeignet. EXIF-Daten auslesen Die Digitalkamera speichert das Datum und die Uhrzeit in den so genannten EXIF-Tags. Mit jhead kann man diese Tags auslesen und [...]]]></description>
			<content:encoded><![CDATA[
<div class="twitterbutton" style="float: right; padding-left: 5px;"><a href="http://twitter.com/share?url=http://emanuelduss.ch/2011/02/fotos-umbenennen-mit-jhead/&amp;text=Fotos nach Datum umbenennen mit jhead&amp;via=mindfuckup&amp;related=DolcePixel"><img align="right" src="http://emanuelduss.ch/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="" /></a></div>
<p>Digitalkameras speichern Bilder oft unter Dateinamen wie DSC00523.jpg. Mit diesen nicht sprechenden Namen kann ich nicht viel anfangen. Das Datum und die Uhrzeit des Fotos ist für den Dateinamen viel besser geeignet.<br />
<span id="more-316"></span></p>
<p><strong>EXIF-Daten auslesen</strong><br />
Die Digitalkamera speichert das Datum und die Uhrzeit in den so genannten EXIF-Tags. Mit jhead kann man diese Tags auslesen und bearbeiten.</p>
<p>Mit <em>jhead dateiname.jpg</em> kann man sich die EXIF-Tags anzeigen lassen:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">emanuel@discordia:~<br />
$ jhead DSC00523.JPG<br />
File name &nbsp; &nbsp;: DSC00523.JPG<br />
File size &nbsp; &nbsp;: 2277972 bytes<br />
File date &nbsp; &nbsp;: 2011:02:06 13:45:34<br />
Camera make &nbsp;: Canon<br />
Camera model : Canon DIGITAL IXUS 80 IS<br />
Date/Time &nbsp; &nbsp;: 2010:12:27 12:02:37<br />
Resolution &nbsp; : 2592 x 1944<br />
Flash used &nbsp; : No<br />
Focal length : 14.3mm &nbsp;(35mm equivalent: 90mm)<br />
CCD width &nbsp; &nbsp;: 5.72mm<br />
Exposure time: 0.020 s &nbsp;(1/50)<br />
Aperture &nbsp; &nbsp; : f/4.5<br />
Focus dist. &nbsp;: 6.57m<br />
ISO equiv. &nbsp; : 800<br />
Whitebalance : Auto<br />
Metering Mode: pattern</div></div>
<p>In der Zeile <em>Date/Time</em> sieht man, dass das Foto am 27.12.2010 um 12:02:37h erstellt wurde.</p>
<p><strong>Datei umbenennen</strong><br />
Mit <em>jhead</em> kann man nun das Foto nach dem Muster YYYY-mm-dd-HH-MM-SS umbenennen. Dies geschieht mit der Option <em>-nf</em> von <em>jhead</em>.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">emanuel@discordia:~<br />
$ jhead -nf%Y-%m-%d_%H-%M-%S DSC00523.JPG<br />
DSC00523.JPG --&gt; 2010-12-27_12-02-37.jpg</div></div>
<p>Kann das Erstellungsdatum und die Erstelungsuhrzeit nicht aus den EXIF-Daten herausgelesen werden, wird der Zeitstempel der Datei verwendet.</p>
<p>In der Manpage von <em>jhead</em> sieht man, wie sich der Format-String zusammensetzen lässt:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">%H Hour in 24-hour format (00 - 23)<br />
%j Day of year as decimal number (001 - 366)<br />
%m Month as decimal number (01 - 12)<br />
%M Minute as decimal number (00 - 59)<br />
%S Second as decimal number (00 - 59)<br />
%w Weekday as decimal number (0 - 6; Sunday is 0)<br />
%y Year without century, as decimal number (00 - 99)<br />
%Y Year with century, as decimal number</div></div>
<p><strong>Alle Fotos in einem Ordner umbenennen</strong><br />
Mit dem regulären Ausdruck <em>*.[jJ][pP][gG]</em> benennt <em>jhead</em> alle Fotos in einem Ordner um:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">emanuel@discordia:~<br />
$ jhead -nf%Y-%m-%d_%H-%M-%S *.[jJ][pP][gG]</div></div>
<p><strong>Alle Fotos umbenennen</strong><br />
Mit <em>find</em> kann man die gesamte Bildersammlung auf einmal umbenenen:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">emanuel@discordia:~<br />
$ find Daten/Bilder -iname *.jpg -exec jhead -nf%Y-%m-%d_%H-%M-%S {} \;</div></div>
<p>Im Ordner <em>Daten/Bilder</em> sind alle Fotos gespeichert, welche umbenannt werden.</p>
<p><strong>Automatisieren</strong><br />
Damit man nicht jedes mal den Befehl von <em>jhead</em> eingeben muss, kann man sich ein Skript schreiben:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<span style="color: #666666; font-style: italic;">########################################################################</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;"># imagerename</span><br />
<span style="color: #666666; font-style: italic;"># Fotos nach Datum umbenennen</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;"># 2009-01-01; Emanuel Duss; Erste Version</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;">########################################################################</span><br />
<br />
<span style="color: #666666; font-style: italic;">########################################################################</span><br />
<span style="color: #666666; font-style: italic;"># Main</span><br />
jhead -nf<span style="color: #000000; font-weight: bold;">%</span>Y-<span style="color: #000000; font-weight: bold;">%</span>m-<span style="color: #000000; font-weight: bold;">%</span>d_<span style="color: #000000; font-weight: bold;">%</span>H-<span style="color: #000000; font-weight: bold;">%</span>M-<span style="color: #000000; font-weight: bold;">%</span>S <span style="color: #000000; font-weight: bold;">*</span>.<span style="color: #7a0874; font-weight: bold;">&#91;</span>jJ<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>pP<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>gG<span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
<br />
<span style="color: #666666; font-style: italic;"># EOF</span></div></div>
<p>Ist dieses Skript ausführbar unter dem Dateinamen <em>imagerename</em> gespeichert und durch die Variable <em>$PATH</em> auffindbar, kann man in jedem Verzeichnis durch den Aufruf von <em>imagerename</em> alle Bilder im aktuellen Verzeichnis umbenennen.</p>
<p>Man kann sich aber auch einen Alias erstellen, welcher den Befehl ausführt. Folgende Zeile schreibt man sich in die Datei <em>~/.bashrc</em>:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">alias imagerename='jhead -nf%Y-%m-%d_%H-%M-%S *.[jJ][pP][gG]'</div></div>
<p>Auch jetzt kann man im jedem Verzeichnis durch <em>imagerename</em> alle Fotos umbenennen.</p>
 <p><a href="http://emanuelduss.ch/?flattrss_redirect&amp;id=316&amp;md5=29b8322486575385a1aa8642fc9b82e7" title="Flattr" target="_blank"><img src="http://emanuelduss.ch/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://emanuelduss.ch/2011/02/fotos-umbenennen-mit-jhead/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://emanuelduss.ch/?flattrss_redirect&amp;id=316&amp;md5=29b8322486575385a1aa8642fc9b82e7" type="text/html" />
	</item>
		<item>
		<title>Fotos automatisch drehen mit jhead</title>
		<link>http://emanuelduss.ch/2011/01/fotos-automatisch-drehen-mit-jhead/</link>
		<comments>http://emanuelduss.ch/2011/01/fotos-automatisch-drehen-mit-jhead/#comments</comments>
		<pubDate>Sun, 16 Jan 2011 18:56:47 +0000</pubDate>
		<dc:creator>Emanuel Duss</dc:creator>
				<category><![CDATA[Konsolentricks]]></category>
		<category><![CDATA[Multimedia]]></category>
		<category><![CDATA[Skripts]]></category>
		<category><![CDATA[fotos]]></category>
		<category><![CDATA[jhead]]></category>
		<category><![CDATA[konsole]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://emanuelduss.ch/?p=75</guid>
		<description><![CDATA[
<div class="twitterbutton" style="float: right; padding-left: 5px;"><a href="http://twitter.com/share?url=http://emanuelduss.ch/2011/01/fotos-automatisch-drehen-mit-jhead/&amp;text=Fotos automatisch drehen mit jhead&amp;via=mindfuckup&amp;related=DolcePixel"><img align="right" src="http://emanuelduss.ch/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="" /></a></div>
Viele Digitalkameras verfügen über einen Gravitationssensor, der erkennt, wie die Kamera beim erstellen des Bildes gehalten wurde. Diese Information kann man dazu nutzen, um das Bild automatisch richtig zu drehen. Die Information wird im EXIF-Tag &#8220;Orientation&#8221; des Bildes gespeichert. Mit dem Tool jhead kann man diese Information auslesen und das Foto automatisch drehen lassen. EXIF-Daten [...]]]></description>
			<content:encoded><![CDATA[
<div class="twitterbutton" style="float: right; padding-left: 5px;"><a href="http://twitter.com/share?url=http://emanuelduss.ch/2011/01/fotos-automatisch-drehen-mit-jhead/&amp;text=Fotos automatisch drehen mit jhead&amp;via=mindfuckup&amp;related=DolcePixel"><img align="right" src="http://emanuelduss.ch/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="" /></a></div>
<p>Viele Digitalkameras verfügen über einen Gravitationssensor, der erkennt, wie die Kamera beim erstellen des Bildes gehalten wurde. Diese Information kann man dazu nutzen, um das Bild automatisch richtig zu drehen. Die Information wird im EXIF-Tag &#8220;Orientation&#8221; des Bildes gespeichert. Mit dem Tool <em>jhead</em> kann man diese Information auslesen und das Foto automatisch drehen lassen.<br />
<span id="more-75"></span><br />
<strong>EXIF-Daten</strong><br />
Wird <em>jhead</em> keine Option angegeben, werden einige EXIF-Informationen angezeigt:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ jhead foto.jpg <br />
File name &nbsp; &nbsp;: foto.jpg<br />
File size &nbsp; &nbsp;: 2040209 bytes<br />
File date &nbsp; &nbsp;: 2011:01:16 18:22:37<br />
Camera make &nbsp;: Canon<br />
Camera model : Canon DIGITAL IXUS 80 IS<br />
Date/Time &nbsp; &nbsp;: 2011:01:14 23:05:42<br />
Resolution &nbsp; : 2592 x 1944<br />
Orientation &nbsp;: rotate 90<br />
Flash used &nbsp; : Yes (auto)<br />
Focal length : &nbsp;6.2mm &nbsp;(35mm equivalent: 39mm)<br />
CCD width &nbsp; &nbsp;: 5.72mm<br />
Exposure time: 0.017 s &nbsp;(1/60)<br />
Aperture &nbsp; &nbsp; : f/2.8<br />
Focus dist. &nbsp;: 0.48m<br />
ISO equiv. &nbsp; : 250<br />
Whitebalance : Auto<br />
Metering Mode: pattern</div></div>
<p>Das Tag &#8220;Orientation&#8221; sagt, dass das Bild um 90° gedreht wurde. Aber jetzt weiss man immer noch nicht, ob das Bild im Uhrzeigersinn, oder im Gegenuhrzeigersinn gedreht werden muss.</p>
<p>Noch mehr Informationen kann man <em>jhead</em> mit der Option <em>-v</em> entlocken:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ jhead -v foto.jpg &nbsp;| grep -i orientation<br />
&nbsp; &nbsp; Orientation = 6<br />
Orientation &nbsp;: rotate 90</div></div>
<p>Das Orientation-Tag beseitzt den Wert 6. In den Spezifikationen von den EXIF-Tags steht folgendes dazu:</p>
<blockquote><p>The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.</p></blockquote>
<p>Daraus lässt sich schliessen, dass das Bild um 90° im Uhrzeigersinn gedreht werden muss.</p>
<p><strong>Das Foto drehen</strong><br />
Mit der Option <em>-autorot</em> kann <em>jhead</em> das Foto automatisch drehen.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ jhead -autorot foto.jpg <br />
Modified: foto.jpg</div></div>
<p>Das eigentliche Rotieren übernimmt nicht <em>jhead</em>, sondern <em>jpegtran</em>.</p>
<p>Das Orientation-EXIF-Tag besitzt nun den Wert 1. Das Bild muss also nicht mehr gedreht werden.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ jhead -v foto.jpg &nbsp;| grep -i orient<br />
&nbsp; &nbsp; Orientation = 1</div></div>
<p><strong>Orientation-Tag entfernen</strong><br />
Möchte man ein Foto nicht rotieren, aber das Orientation-EXIF-Tag trotzdem entfernen, kann man das mit der Option <em>-norot</em> machen:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ jhead -norot anderesfoto.jpg</div></div>
<p><strong>Alle Fotos in einem Verzeichnis drehen </strong><br />
Meistens will ich alle Fotos in einem Verzeichnis richtig drehen. Das kann man folgendermassen machen:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ jhead -autorot *.[jJ][pP][gG]</div></div>
<p>Die Shell löst den regulären Ausdruck <em>*.[jJ][pP][gG]</em> auf, und übergibt alle passenden Dateinamen an <em>jhead</em> weiter.</p>
<p>Diesen Befehl habe ich in einem Skript, damit ich jederzeit jhead so aufrufen kann:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#!/bin/bash<br />
################################################################<br />
#<br />
# imagerotate<br />
# Dreht Fotos anhand des EXIF-Tag Orientation<br />
#<br />
# 2011-01-16; Emanuel Duss; Erste Version<br />
#<br />
################################################################<br />
<br />
################################################################<br />
# Main<br />
jhead -autorot *.[jJ][pP][gG]<br />
<br />
# EOF</div></div>
<p>Natürlich kann man auch einen Alias in der <em>.bashrc</em> eintragen:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">alias imagerotate=&quot;jhead -autorot *.[jJ][pP][gG]&quot;</div></div>
<p><strong>Alle Fotos drehen</strong><br />
Folgendermassen kann man alle Bilder, welche sich im Ordner &#8220;~/Bilder&#8221; befinden automatisch drehen:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ find ~/Bilder -type f -name *.[jJ][pP][gG] -exec jhead -autorot {} \;</div></div>
<p>Somit ist die gesamte Bildersammlung richtig gedreht.</p>
<p><strong>Links und weitere Informationen</strong></p>
<ul>
<li>EXIF Spezifikationen: <a href="http://www.exif.org/specifications.html" target="_blank">http://www.exif.org/specifications.html</a></li>
<li>Projektseite von <em>jhead</em>: <a href="http://www.sentex.net/~mwandel/jhead/" target="_blank">http://www.sentex.net/~mwandel/jhead/</a>
</ul>
 <p><a href="http://emanuelduss.ch/?flattrss_redirect&amp;id=75&amp;md5=01e5816a7835457288759531f3305806" title="Flattr" target="_blank"><img src="http://emanuelduss.ch/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://emanuelduss.ch/2011/01/fotos-automatisch-drehen-mit-jhead/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://emanuelduss.ch/?flattrss_redirect&amp;id=75&amp;md5=01e5816a7835457288759531f3305806" type="text/html" />
	</item>
		<item>
		<title>Bilder verkleinern mit convert (imagemagick)</title>
		<link>http://emanuelduss.ch/2010/12/bilder-verkleinern-mit-convert-imagemagick/</link>
		<comments>http://emanuelduss.ch/2010/12/bilder-verkleinern-mit-convert-imagemagick/#comments</comments>
		<pubDate>Sun, 12 Dec 2010 16:55:04 +0000</pubDate>
		<dc:creator>Emanuel Duss</dc:creator>
				<category><![CDATA[Multimedia]]></category>
		<category><![CDATA[Skripts]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[fotos]]></category>
		<category><![CDATA[konsole]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://emanuelduss.ch/?p=98</guid>
		<description><![CDATA[
<div class="twitterbutton" style="float: right; padding-left: 5px;"><a href="http://twitter.com/share?url=http://emanuelduss.ch/2010/12/bilder-verkleinern-mit-convert-imagemagick/&amp;text=Bilder verkleinern mit convert (imagemagick)&amp;via=mindfuckup&amp;related=DolcePixel"><img align="right" src="http://emanuelduss.ch/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="" /></a></div>
Wenn man im Internet eine Fotogalerie publizeren will, oder man viele Fotos per E-Mail verschicken will, sollte man die Fotos verkleinern. Ich habe mir ein Skript geschrieben, welches die Auflösung der Bilder verkleinert und die JPEG-Qualitätsstufe heruntersetzt. Somit kann man ganz schnell viele Bilder verkleinern. Mit dem Befehl convert kann ein Bild verkleinert werden. Hierzu [...]]]></description>
			<content:encoded><![CDATA[
<div class="twitterbutton" style="float: right; padding-left: 5px;"><a href="http://twitter.com/share?url=http://emanuelduss.ch/2010/12/bilder-verkleinern-mit-convert-imagemagick/&amp;text=Bilder verkleinern mit convert (imagemagick)&amp;via=mindfuckup&amp;related=DolcePixel"><img align="right" src="http://emanuelduss.ch/wp-content/plugins//easy-twitter-button/i/buttons/en/tweetn.png" style="border: none;" alt="" /></a></div>
<p>Wenn man im Internet eine Fotogalerie publizeren will, oder man viele Fotos per E-Mail verschicken will, sollte man die Fotos verkleinern. Ich habe mir ein Skript geschrieben, welches die Auflösung der Bilder verkleinert und die JPEG-Qualitätsstufe heruntersetzt. Somit kann man ganz schnell viele Bilder verkleinern.<br />
<span id="more-98"></span><br />
Mit dem Befehl <em>convert</em> kann ein Bild verkleinert werden. Hierzu muss das Paket <em>imagemagick</em> installiert sein.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">convert -resize 2048x2048 -quality 60 bild.jpg klein.jpg</div></div>
<p>Man sieht gut, wie sich die Dateigrösse verändert:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">emanuel@discordia:/tmp<br />
$ du -h bild.jpg klein.jpg <br />
1.5M &nbsp; &nbsp;bild.jpg<br />
168K &nbsp; &nbsp;klein.jpg</div></div>
<p>Die Datei wurde durch diesen Vorgang um 90% kleiner.</p>
<p>Um mehrere Bilder in einem Verzeichnis zu verkleinern, habe ich mir ein Skript geschrieben. Dieses Skript erstellt den Unterordner <em>small</em>, verkleinert alle Bilder und gibt aus, wie viele Fotos bereits verkleinert wurden.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<span style="color: #666666; font-style: italic;">########################################################################</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;"># imageshrink</span><br />
<span style="color: #666666; font-style: italic;"># Verkleinert alle Bilder im aktuellen Verzeichnis</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;"># Copyright 2010 Emanuel Duss</span><br />
<span style="color: #666666; font-style: italic;"># Licensed under GNU General Public License</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;"># 2009-10-09; Emanuel Duss; Erste Version</span><br />
<span style="color: #666666; font-style: italic;"># 2010-12-12; Emanuel Duss; Optionen als Variabeln</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;">########################################################################</span><br />
<br />
<span style="color: #666666; font-style: italic;">########################################################################</span><br />
<span style="color: #666666; font-style: italic;"># Variabeln</span><br />
<span style="color: #007800;">COUNT</span>=<span style="color: #000000;">0</span><br />
<span style="color: #007800;">TOTAL</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000; font-weight: bold;">*</span>.<span style="color: #7a0874; font-weight: bold;">&#91;</span>Jj<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>Pp<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>Gg<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> -w<span style="color: #000000; font-weight: bold;">`</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Optionen</span><br />
<span style="color: #007800;">FOLDER</span>=<span style="color: #ff0000;">&quot;small&quot;</span><br />
<span style="color: #007800;">SIZE</span>=<span style="color: #ff0000;">&quot;2048x2048&quot;</span><br />
<span style="color: #007800;">QUALITY</span>=<span style="color: #ff0000;">&quot;60&quot;</span><br />
<br />
<span style="color: #666666; font-style: italic;">########################################################################</span><br />
<span style="color: #666666; font-style: italic;"># Main</span><br />
<br />
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #007800;">$FOLDER</span><br />
<br />
<span style="color: #000000; font-weight: bold;">for</span> datei <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">*</span>.<span style="color: #7a0874; font-weight: bold;">&#91;</span>Jj<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>Pp<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>Gg<span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
<span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; <span style="color: #007800;">COUNT</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">expr</span> <span style="color: #007800;">$COUNT</span> + <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">`</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$datei</span>: Foto <span style="color: #007800;">$COUNT</span> von <span style="color: #007800;">$TOTAL</span> \<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">expr</span> <span style="color: #000000;">100</span> \<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #007800;">$COUNT</span> <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #007800;">$TOTAL</span><span style="color: #000000; font-weight: bold;">`%</span>\<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; convert <span style="color: #660033;">-resize</span> <span style="color: #007800;">$SIZE</span> <span style="color: #660033;">-quality</span> <span style="color: #007800;">$QUALITY</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$datei</span>&quot;</span> <span style="color: #ff0000;">&quot;small/<span style="color: #007800;">$datei</span>&quot;</span> <br />
<span style="color: #000000; font-weight: bold;">done</span><br />
<br />
<span style="color: #666666; font-style: italic;"># EOF</span></div></div>
<p>Die Auflösung und die JPEG-Qualitätsstufe kann in den Variabeln angepasst werden.</p>
 <p><a href="http://emanuelduss.ch/?flattrss_redirect&amp;id=98&amp;md5=af01304fa287f3a01be6bfa2a241d331" title="Flattr" target="_blank"><img src="http://emanuelduss.ch/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://emanuelduss.ch/2010/12/bilder-verkleinern-mit-convert-imagemagick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://emanuelduss.ch/?flattrss_redirect&amp;id=98&amp;md5=af01304fa287f3a01be6bfa2a241d331" type="text/html" />
	</item>
	</channel>
</rss>

