<?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: Quickly Reducing Image File Sizes	</title>
	<atom:link href="https://blog.xojo.com/2016/09/08/quickly-reducing-image-file-sizes/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.xojo.com/2016/09/08/quickly-reducing-image-file-sizes/</link>
	<description>Blog about the Xojo programming language and IDE</description>
	<lastBuildDate>Wed, 21 Sep 2016 18:17:35 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>
		By: Edwin van den Akker		</title>
		<link>https://blog.xojo.com/2016/09/08/quickly-reducing-image-file-sizes/#comment-98</link>

		<dc:creator><![CDATA[Edwin van den Akker]]></dc:creator>
		<pubDate>Mon, 12 Sep 2016 07:01:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xojo.com/?p=1557#comment-98</guid>

					<description><![CDATA[Great idea. I had some \&quot;Automator\&quot; script, that did this for me. But through Xojo I have more control. I build one app myself, based on your code. But I added the error handling and a progress bar. 
Also, I added a label that shows the status message, including the amount of size reduction. 

Thanks Paul!]]></description>
			<content:encoded><![CDATA[<p>Great idea. I had some \&#8221;Automator\&#8221; script, that did this for me. But through Xojo I have more control. I build one app myself, based on your code. But I added the error handling and a progress bar.<br />
Also, I added a label that shows the status message, including the amount of size reduction. </p>
<p>Thanks Paul!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Paul Lefebvre		</title>
		<link>https://blog.xojo.com/2016/09/08/quickly-reducing-image-file-sizes/#comment-97</link>

		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Fri, 09 Sep 2016 12:43:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xojo.com/?p=1557#comment-97</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://blog.xojo.com/2016/09/08/quickly-reducing-image-file-sizes/#comment-96&quot;&gt;Thomas&lt;/a&gt;.

Code doesn&#039;t seem to format quite right when in comments. I&#039;ve corrected the formatting as best I can.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://blog.xojo.com/2016/09/08/quickly-reducing-image-file-sizes/#comment-96">Thomas</a>.</p>
<p>Code doesn&#8217;t seem to format quite right when in comments. I&#8217;ve corrected the formatting as best I can.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Thomas		</title>
		<link>https://blog.xojo.com/2016/09/08/quickly-reducing-image-file-sizes/#comment-96</link>

		<dc:creator><![CDATA[Thomas]]></dc:creator>
		<pubDate>Fri, 09 Sep 2016 06:39:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xojo.com/?p=1557#comment-96</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://blog.xojo.com/2016/09/08/quickly-reducing-image-file-sizes/#comment-94&quot;&gt;Thomas Tempelmann&lt;/a&gt;.

Unfortunately, my code did not come across well. All those quote chars came prependd with an \&quot;\\\&quot;, which need to be removed again if someone copies my example.. Also, I wrote RuntimeErrror but meant RuntimeException.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://blog.xojo.com/2016/09/08/quickly-reducing-image-file-sizes/#comment-94">Thomas Tempelmann</a>.</p>
<p>Unfortunately, my code did not come across well. All those quote chars came prependd with an \&#8221;\\\&#8221;, which need to be removed again if someone copies my example.. Also, I wrote RuntimeErrror but meant RuntimeException.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Paul Lefebvre		</title>
		<link>https://blog.xojo.com/2016/09/08/quickly-reducing-image-file-sizes/#comment-95</link>

		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Thu, 08 Sep 2016 11:59:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xojo.com/?p=1557#comment-95</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://blog.xojo.com/2016/09/08/quickly-reducing-image-file-sizes/#comment-94&quot;&gt;Thomas Tempelmann&lt;/a&gt;.

Thanks, Thomas. &lt;a href=&quot;http://developer.xojo.com/userguide/exception-handling&quot; rel=&quot;nofollow&quot;&gt;Exception handling&lt;/a&gt; is a great way to easily check for any errors during this processing.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://blog.xojo.com/2016/09/08/quickly-reducing-image-file-sizes/#comment-94">Thomas Tempelmann</a>.</p>
<p>Thanks, Thomas. <a href="http://developer.xojo.com/userguide/exception-handling" rel="nofollow">Exception handling</a> is a great way to easily check for any errors during this processing.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Thomas Tempelmann		</title>
		<link>https://blog.xojo.com/2016/09/08/quickly-reducing-image-file-sizes/#comment-94</link>

		<dc:creator><![CDATA[Thomas Tempelmann]]></dc:creator>
		<pubDate>Thu, 08 Sep 2016 08:40:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xojo.com/?p=1557#comment-94</guid>

					<description><![CDATA[\&quot;There’s no error handling, so the original folder better only contain pictures, but in my case I only needed to do this one time and I knew the folder only had pictures.\&quot;

That is, of course, unless you opened the pictures folder in the OS X Finder and it created a hidden .DS_Store file in it, which it usually does.

Not even adding a simple check for even that common case is not a good way to teach examples to new users. Any example coming from Xojo should make an effort to teach people proper exercises, because Xojo users are usually those with even less experience than your common Xcode user (who usually do this by trade or at least learned it in school, whereas Xojo claims to make it easy even for newbies).

If you leave every such error checking as an \&quot;exercise\&quot; for the inexperienced user, you\&#039;re not helping them, you\&#039;re rather frustrating them. Just look at the forum, finding many questions related to the simplest cases of nil checking that users don\&#039;t understand.

For those who read this and wonder what I\&#039;m talking about...

1. Usually, when getting the FolderItem from a directory (folder) using \&quot;f.Item(i)\&quot;, that result should be checked for nil - which may indicate that the file is there but not accessible. This is a rare case, but it\&#039;s safer to check for that if you\&#039;re writing code you ever want to run as a built app and even give it away to others.

2. In the above code example by Paul, the easiest way to catch all those possible errors is to add a try/catch block inside the loop, like this:

Try
   Dim newPicFile As FolderItem = newFolder.Child(f.Item(i).Name.Replace(&quot;.png&quot;, &quot;.jpg&quot;))
   Dim p As Picture = Picture.Open(f.Item(i))
   p.Save(newPicFile, Picture.SaveAsJPEG, Picture.QualityHigh)
Catch exc as RuntimeException
  &#039; ignore any errors
End Try
]]></description>
			<content:encoded><![CDATA[<p>\&#8221;There’s no error handling, so the original folder better only contain pictures, but in my case I only needed to do this one time and I knew the folder only had pictures.\&#8221;</p>
<p>That is, of course, unless you opened the pictures folder in the OS X Finder and it created a hidden .DS_Store file in it, which it usually does.</p>
<p>Not even adding a simple check for even that common case is not a good way to teach examples to new users. Any example coming from Xojo should make an effort to teach people proper exercises, because Xojo users are usually those with even less experience than your common Xcode user (who usually do this by trade or at least learned it in school, whereas Xojo claims to make it easy even for newbies).</p>
<p>If you leave every such error checking as an \&#8221;exercise\&#8221; for the inexperienced user, you\&#8217;re not helping them, you\&#8217;re rather frustrating them. Just look at the forum, finding many questions related to the simplest cases of nil checking that users don\&#8217;t understand.</p>
<p>For those who read this and wonder what I\&#8217;m talking about&#8230;</p>
<p>1. Usually, when getting the FolderItem from a directory (folder) using \&#8221;f.Item(i)\&#8221;, that result should be checked for nil &#8211; which may indicate that the file is there but not accessible. This is a rare case, but it\&#8217;s safer to check for that if you\&#8217;re writing code you ever want to run as a built app and even give it away to others.</p>
<p>2. In the above code example by Paul, the easiest way to catch all those possible errors is to add a try/catch block inside the loop, like this:</p>
<p>Try<br />
   Dim newPicFile As FolderItem = newFolder.Child(f.Item(i).Name.Replace(&#8220;.png&#8221;, &#8220;.jpg&#8221;))<br />
   Dim p As Picture = Picture.Open(f.Item(i))<br />
   p.Save(newPicFile, Picture.SaveAsJPEG, Picture.QualityHigh)<br />
Catch exc as RuntimeException<br />
  &#8216; ignore any errors<br />
End Try</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
