<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Batch processing photos with DOS and ImageMagick</title>
	<atom:link href="http://www.reviewmylife.co.uk/blog/2008/08/07/batch-processing-photos-with-dos-and-imagemagick/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.reviewmylife.co.uk/blog/2008/08/07/batch-processing-photos-with-dos-and-imagemagick/</link>
	<description>Programming, technology, travel and general banter.</description>
	<lastBuildDate>Fri, 12 Mar 2010 18:17:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Anthony</title>
		<link>http://www.reviewmylife.co.uk/blog/2008/08/07/batch-processing-photos-with-dos-and-imagemagick/comment-page-1/#comment-752</link>
		<dc:creator>Anthony</dc:creator>
		<pubDate>Wed, 01 Apr 2009 17:29:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.reviewmylife.co.uk/blog/?p=44#comment-752</guid>
		<description>I have made a couple of changes but have a problem and that is I can not get a negative random number. I was trying to do everything with the batch file.
File saved as poleroid.bat on the F drive and the images are in a folder called Test_images. Usage  = poleroid F:\Test_images 

@echo off

:: ?
setlocal

:: ?
pushd .

:: Jump to skip_functions
goto :skip_functions

:: function name makeThumbs
:makeThumb

:: Set the variable jpg to the first argument = \generated\
set jpg=%1

:: Remove the .jpg	
set jpg=%jpg:~0,-4%

:: Add the path to the image in this case &quot; ..\Test_images\image.jpg &quot;
set jpg=..%DIRECTORY%%jpg%
	
:: I am not sure how to get a negative angle
set /a ANGLE=%random% %% 15 + 3
	
:: Set the IM code for watermarking the image into the variable ANNOTATE
set ANNOTATE=-gravity south -font Arial -pointsize 20 -fill black -annotate +0+20 &quot;www.rubblewebs.co.uk&quot; -fill white -annotate +2+22 &quot;www.rubblewebs.co.uk&quot;

:: Set the IM code for the poleroid modification into the variable POLOROID
set POLOROID=-bordercolor white -border 6 -bordercolor grey60 -border 1 -background none -rotate %ANGLE% -background black ( +clone -shadow 60x4+4+4 ) +swap -background white -flatten

:: Run tha Image magick code
 convert %1 ( +clone -resize 600x -auto-orient %ANNOTATE% -compress JPEG -quality 70 -write %jpg%_full.jpg +delete ) -thumbnail 180x -auto-orient %POLOROID% -compress JPEG -quality 80 -sampling-factor 2x1 %jpg%_th.jpg

:: Goes to the end of the function ?	
goto :EOF

:: Function to create the directory to save the modified images into
:skip_functions

:: Select the drive ?
f:

:: select the folder ?
cd %1\images

:: Create the new directory
md %1\generated

:: variable for use in the thumbs function
SET DIRECTORY=\generated\

:: Call thefunction makethumb for all the images in the folder - added the folder path
for /f %%i in (&#039;dir /b *.jpg&#039;) do call :makeThumb %%i %DIRECTORY%

:: ?
popd

:: ?
endlocal</description>
		<content:encoded><![CDATA[<p>I have made a couple of changes but have a problem and that is I can not get a negative random number. I was trying to do everything with the batch file.<br />
File saved as poleroid.bat on the F drive and the images are in a folder called Test_images. Usage  = poleroid F:\Test_images </p>
<p>@echo off</p>
<p>:: ?<br />
setlocal</p>
<p>:: ?<br />
pushd .</p>
<p>:: Jump to skip_functions<br />
goto :skip_functions</p>
<p>:: function name makeThumbs<br />
:makeThumb</p>
<p>:: Set the variable jpg to the first argument = \generated\<br />
set jpg=%1</p>
<p>:: Remove the .jpg<br />
set jpg=%jpg:~0,-4%</p>
<p>:: Add the path to the image in this case &#8221; ..\Test_images\image.jpg &#8221;<br />
set jpg=..%DIRECTORY%%jpg%</p>
<p>:: I am not sure how to get a negative angle<br />
set /a ANGLE=%random% %% 15 + 3</p>
<p>:: Set the IM code for watermarking the image into the variable ANNOTATE<br />
set ANNOTATE=-gravity south -font Arial -pointsize 20 -fill black -annotate +0+20 &#8220;www.rubblewebs.co.uk&#8221; -fill white -annotate +2+22 &#8220;www.rubblewebs.co.uk&#8221;</p>
<p>:: Set the IM code for the poleroid modification into the variable POLOROID<br />
set POLOROID=-bordercolor white -border 6 -bordercolor grey60 -border 1 -background none -rotate %ANGLE% -background black ( +clone -shadow 60&#215;4+4+4 ) +swap -background white -flatten</p>
<p>:: Run tha Image magick code<br />
 convert %1 ( +clone -resize 600x -auto-orient %ANNOTATE% -compress JPEG -quality 70 -write %jpg%_full.jpg +delete ) -thumbnail 180x -auto-orient %POLOROID% -compress JPEG -quality 80 -sampling-factor 2&#215;1 %jpg%_th.jpg</p>
<p>:: Goes to the end of the function ?<br />
goto :EOF</p>
<p>:: Function to create the directory to save the modified images into<br />
:skip_functions</p>
<p>:: Select the drive ?<br />
f:</p>
<p>:: select the folder ?<br />
cd %1\images</p>
<p>:: Create the new directory<br />
md %1\generated</p>
<p>:: variable for use in the thumbs function<br />
SET DIRECTORY=\generated\</p>
<p>:: Call thefunction makethumb for all the images in the folder &#8211; added the folder path<br />
for /f %%i in (&#8216;dir /b *.jpg&#8217;) do call :makeThumb %%i %DIRECTORY%</p>
<p>:: ?<br />
popd</p>
<p>:: ?<br />
endlocal</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anthony</title>
		<link>http://www.reviewmylife.co.uk/blog/2008/08/07/batch-processing-photos-with-dos-and-imagemagick/comment-page-1/#comment-749</link>
		<dc:creator>Anthony</dc:creator>
		<pubDate>Sun, 29 Mar 2009 17:21:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.reviewmylife.co.uk/blog/?p=44#comment-749</guid>
		<description>I have just started looking at batch scripts and have just tried yours out; I was not sure what I was doing but I got there in the end.

It works very well but I had to hard code an angle for now as I am unsure how to use perl - can you not generate a random number with the batch file ?
I am not a great fan of the poleroid operator and your code generates a nicer image.

A couple of comments:
1/ I am working on my F drive as I didn&#039;t want to mess up anything on my C drive if it went wrong. I had to use: poleroid f:\Test_images If I didn&#039;t add the f:\ to the path the images were saved in the same directory as the originals. and I had extra empty folders.
2/ If you used -thumbnail instead of -resize you would not need the -strip.
3/ Why didn&#039;t you save the new images directly to the new folder rather than moving them later?
4/ As I know nothing about batch scripts I could have done with a few more comments in the code. I have guessed what most of it means but have no idea about things like &quot; setlocal&quot; and &quot;pushd .&quot;.</description>
		<content:encoded><![CDATA[<p>I have just started looking at batch scripts and have just tried yours out; I was not sure what I was doing but I got there in the end.</p>
<p>It works very well but I had to hard code an angle for now as I am unsure how to use perl &#8211; can you not generate a random number with the batch file ?<br />
I am not a great fan of the poleroid operator and your code generates a nicer image.</p>
<p>A couple of comments:<br />
1/ I am working on my F drive as I didn&#8217;t want to mess up anything on my C drive if it went wrong. I had to use: poleroid f:\Test_images If I didn&#8217;t add the f:\ to the path the images were saved in the same directory as the originals. and I had extra empty folders.<br />
2/ If you used -thumbnail instead of -resize you would not need the -strip.<br />
3/ Why didn&#8217;t you save the new images directly to the new folder rather than moving them later?<br />
4/ As I know nothing about batch scripts I could have done with a few more comments in the code. I have guessed what most of it means but have no idea about things like &#8221; setlocal&#8221; and &#8220;pushd .&#8221;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.193 seconds -->
