<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Image on Andrew's Memory Blog</title><link>https://andrewmemory.acornwall.net/tags/image/</link><description>Recent content in Image on Andrew's Memory Blog</description><generator>Hugo -- gohugo.io</generator><image><url>https://andrewmemory.acornwall.net/img/rss_image.png</url><title>Image on Andrew's Memory Blog</title><link>https://andrewmemory.acornwall.net/</link></image><language>en</language><managingEditor>andrewmemoryblog@gmail.com (Andrew's Memory Blog)</managingEditor><webMaster>andrewmemoryblog@gmail.com (Andrew's Memory Blog)</webMaster><copyright>Copyright 2009--2025</copyright><lastBuildDate>Sat, 01 Jan 2011 17:32:26 -0700</lastBuildDate><atom:link href="https://andrewmemory.acornwall.net/tags/image/index.xml" rel="self" type="application/rss+xml"/><item><title>Creating thumbnail images with convert</title><link>https://andrewmemory.acornwall.net/blog/2011-01-02-creating-thumbnail-images-with-convert/</link><pubDate>Sat, 01 Jan 2011 17:32:26 -0700</pubDate><author>andrewmemoryblog@gmail.com (Andrew's Memory Blog)</author><guid>https://andrewmemory.acornwall.net/blog/2011-01-02-creating-thumbnail-images-with-convert/</guid><description>&lt;p&gt;A little while ago, I found I had a bunch of images that needed thumbnails that were 100×75. This isn&amp;rsquo;t hard to do - I used convert and a pair of bash for loops.&lt;/p&gt;
&lt;p&gt;The core was a call to convert, which is part of ImageMagick.&lt;/p&gt;
&lt;figure class="highlight"&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-" data-lang=""&gt;convert -thumbnail 100x75 input.jpg thumbnail.jpg&lt;/code&gt;&lt;/pre&gt;
&lt;/figure&gt;
&lt;p&gt;All of my images happened to be 4:3 - if they hadn&amp;rsquo;t, I might have used &lt;code&gt;100x75!&lt;/code&gt; or rotated/resized them.&lt;/p&gt;
&lt;p&gt;Next, all my files had numbers of the form file01..file09 file10 file11&amp;hellip; etc. If you&amp;rsquo;re nuts, you try to figure out how to do this in a single for-loop with a condition for the first 9 elements that start with 0.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re lazy like me, you use two loops, with a cursor-up in bash so you don&amp;rsquo;t have to type as much:&lt;/p&gt;
&lt;figure class="highlight"&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-" data-lang=""&gt;export INFILEPREFIX=file
export OUTFILEPREFIX=file
for i in {1..9}; do convert -thumbnail 100x75 ${INFILEPREFIX}0${i}.jpg ${OUTFILEPREFIX}0${i}t.jpg; done
for i in {10..25}; do convert -thumbnail 100x75 ${INFILEPREFIX}${i}.jpg ${OUTFILEPREFIX}${i}t.jpg; done&lt;/code&gt;&lt;/pre&gt;
&lt;/figure&gt;
&lt;p&gt;For the non-thumbnails, I resized as well, using -resize 800x600.&lt;/p&gt;</description></item></channel></rss>