<?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>Rock Sun's Blog &#187; blog</title>
	<atom:link href="http://rocksun.cn/category/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://rocksun.cn</link>
	<description>Blogger's Blog</description>
	<lastBuildDate>Sun, 05 Feb 2012 18:50:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>最近的一些新网站</title>
		<link>http://rocksun.cn/my-sites-recently/</link>
		<comments>http://rocksun.cn/my-sites-recently/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 17:48:03 +0000</pubDate>
		<dc:creator>rocksun</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[dev2dev]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://rocksun.cn/my-sites-recently/</guid>
		<description><![CDATA[


还记得dev2dev.us吗？现在确实没啥人气，不过已经有了不少注册用户，也收集了不少有意义的文章，至少已经三次辅助我解决问题了，算是一个意外收获。现在又搞了一个http://blog.dev2dev.us/，希望成为一个团队Blog，建立一个中间件的精英团体，不过也是人气不足。即使没有更多的人，现有的人也会坚持下去吧，毕竟也是提高自己的一种手段。有兴趣的朋友，可以联系我加入。
假日期间，帮亲戚做了一个网站: 华彩老年公寓。从申请域名，到搭建Drupal网站，花费了一天的时间，大家可以注意，首页的图片是我修改的，CSS也是调整过的，可见我搭建这类介绍性网站的水平已经达到了相当的高度了。余下的工作交给亲戚了。也欢迎各位朋友找我建这种网站，空间就要续费了，一年100多美元有点小贵，帮我负担下。
再一个网站是一个小实验。也就是daily20.info。这个跟我的网络创收有关，最近的世道不太好啦，大家注意到了Google广告的内容了吗？越来越多的广告出现的是Google Adsense自己的广告，说明什么？说明经济不好，大家都没钱做广告了。与之对应的是广告费的大幅降低，我的网站的广告收入也开始急剧下降，逼不得已，我只好投身英文网站了。希望daily20.info能给我带来些收入，不但能应付主机空间的费用，也能给我一点零花钱。


Related posts:又买书了赎罪



Related posts:<ol><li><a href='http://rocksun.cn/buybooks/' rel='bookmark' title='Permanent Link: 又买书了'>又买书了</a></li><li><a href='http://rocksun.cn/%e8%b5%8e%e7%bd%aa/' rel='bookmark' title='Permanent Link: 赎罪'>赎罪</a></li></ol>

]]></description>
			<content:encoded><![CDATA[<p>还记得<a href="http://dev2dev.us">dev2dev.us</a>吗？现在确实没啥人气，不过已经有了不少注册用户，也收集了不少有意义的文章，至少已经三次辅助我解决问题了，算是一个意外收获。现在又搞了一个<a title="http://blog.dev2dev.us/" href="http://blog.dev2dev.us/">http://blog.dev2dev.us/</a>，希望成为一个团队Blog，建立一个中间件的精英团体，不过也是人气不足。即使没有更多的人，现有的人也会坚持下去吧，毕竟也是提高自己的一种手段。有兴趣的朋友，可以<a href="http://rocksun.cn/contact/">联系我</a>加入。</p>
<p>假日期间，帮亲戚做了一个网站: <a href="http://www.huacaigongyu.com/">华彩老年公寓</a>。从申请域名，到搭建Drupal网站，花费了一天的时间，大家可以注意，首页的图片是我修改的，CSS也是调整过的，可见我搭建这类介绍性网站的水平已经达到了相当的高度了。余下的工作交给亲戚了。也欢迎各位朋友找我建这种网站，空间就要续费了，一年100多美元有点小贵，帮我负担下。</p>
<p>再一个网站是一个小实验。也就是<a href="http://daily20.info/">daily20.info</a>。这个跟我的网络创收有关，最近的世道不太好啦，大家注意到了Google广告的内容了吗？越来越多的广告出现的是Google Adsense自己的广告，说明什么？说明经济不好，大家都没钱做广告了。与之对应的是广告费的大幅降低，我的网站的广告收入也开始急剧下降，逼不得已，我只好投身英文网站了。希望<a href="http://daily20.info/">daily20.info</a>能给我带来些收入，不但能应付主机空间的费用，也能给我一点零花钱。</p>


<p>Related posts:<ol><li><a href='http://rocksun.cn/buybooks/' rel='bookmark' title='Permanent Link: 又买书了'>又买书了</a></li><li><a href='http://rocksun.cn/%e8%b5%8e%e7%bd%aa/' rel='bookmark' title='Permanent Link: 赎罪'>赎罪</a></li></ol></p>
<p></p>]]></content:encoded>
			<wfw:commentRss>http://rocksun.cn/my-sites-recently/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>乐铺助我收集阳光</title>
		<link>http://rocksun.cn/sun-jar-from-lepu/</link>
		<comments>http://rocksun.cn/sun-jar-from-lepu/#comments</comments>
		<pubDate>Sun, 27 Jun 2010 11:41:55 +0000</pubDate>
		<dc:creator>rocksun</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://rocksun.cn/sun-jar-from-lepu/</guid>
		<description><![CDATA[这里首先要向乐铺说一句抱歉，就在乐铺发出乐铺创意礼物免费送博主活动礼品快递的当天，我也开始了一段长差。很遗憾没有看到那个漂亮的瓶子，也无法拍照给大家分享，但是一定还是要写写我的感受。
参加这次活动，我提交了好几次报名（最后一次意识到以前我提交的不对），每次我选了一个不同的礼品。一开始是爱之重拳抱枕-红色，第二次我看上了那个不可思议的木头钟，最后选了这个Sun Jar，因为觉得所有的东西都很喜欢。最后选中的阳光瓶子，是因为和木头钟相比，这个不需要我插电了。
 
因为还要过一段时间才能回家，暂时不能自己拍照了，只能拿一起参加活动的朋友的照片顶一下了，待我回去一定给补上，不枉乐铺如此煞费苦心。虽然还未亲见，但真的很喜欢，在茫茫的黑夜中，有这么一团温暖的阳光，想想也够温馨的。
最后，再次感谢乐铺，希望乐铺的生意的也能蒸蒸日上，也让每个辛苦的人都能在生活中多一点的情趣和快乐。


No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>这里首先要向<a href="http://www.lepu.com/">乐铺</a>说一句抱歉，就在乐铺发出<a href="http://blog.lepu.com/?p=1013">乐铺创意礼物免费送博主</a>活动礼品快递的当天，我也开始了一段长差。很遗憾没有看到那个漂亮的瓶子，也无法拍照给大家分享，但是一定还是要写写我的感受。</p>
<p>参加这次活动，我提交了好几次报名（最后一次意识到以前我提交的不对），每次我选了一个不同的礼品。一开始是<a href="http://www.lepu.com/1050">爱之重拳抱枕-红色</a>，第二次我看上了那个<a href="http://www.lepu.com/364">不可思议的木头钟</a>，最后选了这个<a href="http://www.lepu.com/663">Sun Jar</a>，因为觉得所有的东西都很喜欢。最后选中的阳光瓶子，是因为和木头钟相比，这个不需要我插电了。</p>
<p><img height="399" src="http://public.bay.livefilestore.com/y1p9Udh_kL-3M_NjrNqtB7peaI3Pbl38whCMDRafTjTzvHA0oY88FIpGbG-9ymWSVFsE9B9TGFm6WI5Hz-03iqI4A/IMG01032.JPG?psid=1" width="299" /> </p>
<p>因为还要过一段时间才能回家，暂时不能自己拍照了，只能拿一起参加活动的<a href="http://papu.cn/2010/06/25/sunjar-gift-from-lepu.html">朋友</a>的照片顶一下了，待我回去一定给补上，不枉乐铺如此煞费苦心。虽然还未亲见，但真的很喜欢，在茫茫的黑夜中，有这么一团温暖的阳光，想想也够温馨的。</p>
<p>最后，再次感谢乐铺，希望乐铺的生意的也能蒸蒸日上，也让每个辛苦的人都能在生活中多一点的情趣和快乐。</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://rocksun.cn/sun-jar-from-lepu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>垃圾是怎样转生的？</title>
		<link>http://rocksun.cn/spam-start/</link>
		<comments>http://rocksun.cn/spam-start/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 08:06:18 +0000</pubDate>
		<dc:creator>rocksun</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://rocksun.cn/?p=421</guid>
		<description><![CDATA[前几天在笔记本上装了Ubuntu，写了篇说说Ubuntu的ISO安装，其中提到网络上类似文章的大肆转载，没有想到最具讽刺意味的是，这篇文章也摆脱不了成为垃圾的命运。
看这个搜索结果，我可怜的文章竟然排在第二，Google自信的算法这里是不是失效了？搞不懂第一名到底何方神圣。我也真是受宠若惊，一篇如此简单的文章，怎么会流传成这样，而且可耻的是，没有几篇注明了原始出处。
我决定针对此问题施加措施，要让我的作品能够有规矩的流传下去。


No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>前几天在笔记本上装了Ubuntu，写了篇<a href="http://rocksun.cn/install-ubuntu-with-iso/">说说Ubuntu的ISO安装</a>，其中提到网络上类似文章的大肆转载，没有想到最具讽刺意味的是，这篇文章也摆脱不了成为垃圾的命运。</p>
<p>看这个<a href="http://www.google.cn/search?hl=zh-CN&amp;newwindow=1&amp;rlz=1B3GGGL_zh-CNCN302CN303&amp;q=%22%E8%AF%B4%E8%AF%B4Ubuntu%E7%9A%84ISO%E5%AE%89%E8%A3%85%22&amp;btnG=Google+%E6%90%9C%E7%B4%A2&amp;meta=&amp;aq=f&amp;oq=">搜索结果</a>，我可怜的文章竟然排在第二，Google自信的算法这里是不是失效了？搞不懂第一名到底何方神圣。我也真是受宠若惊，一篇如此简单的文章，怎么会流传成这样，而且可耻的是，没有几篇注明了原始出处。</p>
<p>我决定针对此问题施加措施，要让我的作品能够有规矩的流传下去。</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://rocksun.cn/spam-start/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>一个很好的取色工具</title>
		<link>http://rocksun.cn/adesclrpicker-color-picker/</link>
		<comments>http://rocksun.cn/adesclrpicker-color-picker/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 17:52:16 +0000</pubDate>
		<dc:creator>rocksun</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[picker]]></category>

		<guid isPermaLink="false">http://rocksun.cn/?p=396</guid>
		<description><![CDATA[我经常需要修改Blog的式样，有时候需要根据原来的颜色输入新的CSS样式。这时要么需要查看CSS文件，要么截图，然后到GIMP下抓取颜色，今天看到一个小工具AdesClrPicker，要方便许多，可以直接在屏幕上取色。

另外，这个工具还有一个色库，可以收集一些常用的颜色，以备不时之需。


No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>我经常需要修改Blog的式样，有时候需要根据原来的颜色输入新的CSS样式。这时要么需要查看CSS文件，要么截图，然后到GIMP下抓取颜色，今天看到一个小工具<a href="http://www.adesclrpicker.com/" target="_blank">AdesClrPicker</a>，要方便许多，可以直接在屏幕上取色。</p>
<p><a href="http://www.adesclrpicker.com/" target="_blank"><img src="http://www.webresourcesdepot.com/wp-content/uploads/image/free-color-picker.gif" alt="Free Color Picker" width="480" height="125" /></a></p>
<p>另外，这个工具还有一个色库，可以收集一些常用的颜色，以备不时之需。</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://rocksun.cn/adesclrpicker-color-picker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>以后不中英文混写了</title>
		<link>http://rocksun.cn/no-english-now/</link>
		<comments>http://rocksun.cn/no-english-now/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 12:26:57 +0000</pubDate>
		<dc:creator>rocksun</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[Chinese]]></category>
		<category><![CDATA[english]]></category>

		<guid isPermaLink="false">http://rocksun.cn/?p=388</guid>
		<description><![CDATA[本来为了省事，在这个Blog里既有中文，又有英文，现在觉得有点乱了，所以以后开一个英文blog专门写英文的，这里一般不再写英文blog了。


Related posts:要想热 写插件



Related posts:<ol><li><a href='http://rocksun.cn/write-plugin-for-flow/' rel='bookmark' title='Permanent Link: 要想热 写插件'>要想热 写插件</a></li></ol>

]]></description>
			<content:encoded><![CDATA[<p>本来为了省事，在这个Blog里既有中文，又有英文，现在觉得有点乱了，所以以后开一个<a href="http://rocksun.cn/en/">英文blog</a>专门写英文的，这里一般不再写英文blog了。</p>


<p>Related posts:<ol><li><a href='http://rocksun.cn/write-plugin-for-flow/' rel='bookmark' title='Permanent Link: 要想热 写插件'>要想热 写插件</a></li></ol></p>
<p></p>]]></content:encoded>
			<wfw:commentRss>http://rocksun.cn/no-english-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>你的PageRank还好吗？</title>
		<link>http://rocksun.cn/your-pagerank-changed/</link>
		<comments>http://rocksun.cn/your-pagerank-changed/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 06:32:15 +0000</pubDate>
		<dc:creator>rocksun</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[pagerank]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://rocksun.cn/?p=333</guid>
		<description><![CDATA[今日风传Google更新了PageRank，所以我立马看了我关心的一些PageRank的变化。
我们Subversion中文站小组翻译的Subversion中文FAQ，是新增加的网页，上一期还没有pr，这次一下子跳升到pr6，官方的就是官方的，让我们不服不行。对应的组织这个翻译的google项目svncndoc也从3升至4。不过我最关心的是我们的Subversion专家Blog，我觉得最有技术含量的一部分由1升至2，但还是不是让我很满意，希望各位朋友帮忙捧场，让我们的努力得到更多的关注。Subversion中文站，并无变化还是5，但是我希望重现当年6的日子，还是需要多做一些实事才行。
我个人的Blog，也就是本站，曾经一直在pr4上，后来维护不够变成了pr2，最近十分活跃，希望有所突破，果然成功，从2变成了3。我的别院素布拉，一举突破pr4，让我无法理解，刚刚做了两个月的网站竟然可以如此进展，郁闷郁闷啊。Subversion翻译的战友racoonwise，经营了一所介绍Ubuntu的站点，据说时间不长，但我前一段看到pr为2，深以为奇，本以为这段时间他十分用功，还会有所增长，今日一看却发现已经pr为0，不知何解，喜欢Ubuntu的朋友赶快去顶顶吧，http://xdp.me/。


Related posts:要想热 写插件Resize Image In Context MenuFTP image with Conext Menu



Related posts:<ol><li><a href='http://rocksun.cn/write-plugin-for-flow/' rel='bookmark' title='Permanent Link: 要想热 写插件'>要想热 写插件</a></li><li><a href='http://rocksun.cn/resize-image-in-context-menu/' rel='bookmark' title='Permanent Link: Resize Image In Context Menu'>Resize Image In Context Menu</a></li><li><a href='http://rocksun.cn/ftp-image-with-conext-menu/' rel='bookmark' title='Permanent Link: FTP image with Conext Menu'>FTP image with Conext Menu</a></li></ol>

]]></description>
			<content:encoded><![CDATA[<p>今日风传Google更新了PageRank，所以我立马看了我关心的一些PageRank的变化。</p>
<p>我们Subversion中文站小组翻译的<a href="http://subversion.tigris.org/faq.zh.html">Subversion中文FAQ</a>，是新增加的网页，上一期还没有pr，这次一下子跳升到pr6，官方的就是官方的，让我们不服不行。对应的组织这个翻译的google项目<a href="http://code.google.com/p/svncndoc/">svncndoc</a>也从3升至4。不过我最关心的是我们的<a href="http://www.subversion.org.cn/submerged/">Subversion专家Blog</a>，我觉得最有技术含量的一部分由1升至2，但还是不是让我很满意，希望各位朋友帮忙捧场，让我们的努力得到更多的关注。<a href="http://www.subversion.org.cn/">Subversion中文站</a>，并无变化还是5，但是我希望重现当年6的日子，还是需要多做一些实事才行。</p>
<p>我个人的Blog，也就是本站，曾经一直在pr4上，后来维护不够变成了pr2，最近十分活跃，希望有所突破，果然成功，从2变成了3。我的别院<a href="http://subula.cn/">素布拉</a>，一举突破pr4，让我无法理解，刚刚做了两个月的网站竟然可以如此进展，郁闷郁闷啊。Subversion翻译的战友<a title="Ubuntu Geeker" href="http://www.xdp.me/">racoonwise</a>，经营了一所介绍Ubuntu的站点，据说时间不长，但我前一段看到pr为2，深以为奇，本以为这段时间他十分用功，还会有所增长，今日一看却发现已经pr为0，不知何解，喜欢Ubuntu的朋友赶快去顶顶吧，<a href="http://xdp.me/">http://xdp.me/</a>。</p>


<p>Related posts:<ol><li><a href='http://rocksun.cn/write-plugin-for-flow/' rel='bookmark' title='Permanent Link: 要想热 写插件'>要想热 写插件</a></li><li><a href='http://rocksun.cn/resize-image-in-context-menu/' rel='bookmark' title='Permanent Link: Resize Image In Context Menu'>Resize Image In Context Menu</a></li><li><a href='http://rocksun.cn/ftp-image-with-conext-menu/' rel='bookmark' title='Permanent Link: FTP image with Conext Menu'>FTP image with Conext Menu</a></li></ol></p>
<p></p>]]></content:encoded>
			<wfw:commentRss>http://rocksun.cn/your-pagerank-changed/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>RockSun的script-fu教程</title>
		<link>http://rocksun.cn/rocksun-script-fu-tutorial/</link>
		<comments>http://rocksun.cn/rocksun-script-fu-tutorial/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 11:50:40 +0000</pubDate>
		<dc:creator>rocksun</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[GIMP]]></category>
		<category><![CDATA[scheme]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[script-fu]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://rocksun.cn/?p=317</guid>
		<description><![CDATA[前面的文章中我介绍了许多GIMP的自动化脚本，其中很多是修改自一些现成的脚本，只有最后的剪切脚本算是从头一点点写出来的，从中也摸索出来了编写这种脚本的一些思路。我发现，打好基础非常重要。
在这些脚本中使用的语言称为script-fu，而script-fu实际就是scheme语言，而scheme语言则出自非常有名的LISP语言。虽然scheme语言知道的人不多，但的确是一个拥有悠久历史的语言。以前敦促自己每年要学几门语言，没想到在这年末里可以小学一下scheme，或者说是script-fu。
首先说一下调试的环境，安装GIMP后，在启动的界面上运行“滤镜-&#62;Script-Fu-&#62;Console”，然后在弹出的窗口中输入“(+ 3 5)”，如果看到输出“8”，那么我们就完成了script-fu的第一个脚本。
语言的基本结构
通过前面的例子我们对script-fu的基本结构有了最基本的了解，所有的scritp-fu语句都是类似如下的结构：

(+ 3 5)

语句要用“(”和“)”包起来，这是必须的，这规定了语句的范围。在小括号中首先出现的是命令字，或者称为方法或函数名，后面跟的是参数，在上面的例子中是参数就是3和5。要实现4*(3+5)我们应该写为：
(* 4  (+ 3 5))
定义变量和函数
使用“let*”方法来定义变量，如下就是一个例子：

(let*
    (
         (a 1)
         (b 2)
    )
    (+ a b)
)

上面的脚本中定义了两个变量a和b，所有定义的变量都要放到let*后面的第一个小括号中，这个小括号中的每一个小括号都是一个变量的定义；而let*的结果则放在第二个括号里，上例中就是“(+ a b)”。要注意，变量a和b的有效范围只是在这第二个括号中，所以你使用a和b的代码就要全部放到这个括号里。
逻辑判断
(if (&#60; n 0)
        (&#8230;)
        (&#8230;)
)
逻辑判断是编程语言不可缺少的一部分，在script-fu中也比较简单，上面的结构就是一个例子。if是语句名，后面紧跟三个小括号，第一个应该包含一个逻辑表达式，第二个括号则是表达式为true的时执行的语句，第三个括号则是表达式为false的时候执行的语句。
实践
根据上述信息和一些GIMP的知识，就可以写出我前面说的剪切脚本了，我们先看代码：

(define (script-fu-rs-center-crop filename outfilename width height)

  (let* [...]


Related posts:<ol><li><a href='http://rocksun.cn/gimp-crop-script/' rel='bookmark' title='Permanent Link: Gimp Crop Script'>Gimp Crop Script</a></li><li><a href='http://rocksun.cn/resize-image-in-context-menu/' rel='bookmark' title='Permanent Link: Resize Image In Context Menu'>Resize Image In Context Menu</a></li><li><a href='http://rocksun.cn/ftp-image-with-conext-menu/' rel='bookmark' title='Permanent Link: FTP image with Conext Menu'>FTP image with Conext Menu</a></li></ol>

]]></description>
			<content:encoded><![CDATA[<p>前面的文章中我介绍了许多GIMP的自动化脚本，其中很多是修改自一些现成的脚本，只有最后的<a href="http://rocksun.cn/gimp-crop-script/">剪切脚本</a>算是从头一点点写出来的，从中也摸索出来了编写这种脚本的一些思路。我发现，打好基础非常重要。</p>
<p>在这些脚本中使用的语言称为script-fu，而script-fu实际就是scheme语言，而scheme语言则出自非常有名的LISP语言。虽然scheme语言知道的人不多，但的确是一个拥有悠久历史的语言。以前敦促自己每年要学几门语言，没想到在这年末里可以小学一下scheme，或者说是script-fu。</p>
<p>首先说一下调试的环境，安装GIMP后，在启动的界面上运行“滤镜-&gt;Script-Fu-&gt;Console”，然后在弹出的窗口中输入“(+ 3 5)”，如果看到输出“8”，那么我们就完成了script-fu的第一个脚本。</p>
<h3>语言的基本结构</h3>
<p>通过前面的例子我们对script-fu的基本结构有了最基本的了解，所有的scritp-fu语句都是类似如下的结构：</p>
<blockquote>
<pre class="programlisting">(+ 3 5)</pre>
</blockquote>
<p>语句要用“(”和“)”包起来，这是必须的，这规定了语句的范围。在小括号中首先出现的是命令字，或者称为方法或函数名，后面跟的是参数，在上面的例子中是参数就是3和5。要实现4*(3+5)我们应该写为：</p>
<blockquote><p>(* 4  (+ 3 5))</p></blockquote>
<h3>定义变量和函数</h3>
<p>使用“let*”方法来定义变量，如下就是一个例子：</p>
<blockquote>
<pre class="programlisting">(let*</pre>
<pre class="programlisting">    (
         (a 1)
         (b 2)
    )
    (+ a b)
)</pre>
</blockquote>
<p>上面的脚本中定义了两个变量a和b，所有定义的变量都要放到let*后面的第一个小括号中，这个小括号中的每一个小括号都是一个变量的定义；而let*的结果则放在第二个括号里，上例中就是“(+ a b)”。要注意，变量a和b的有效范围只是在这第二个括号中，所以你使用a和b的代码就要全部放到这个括号里。</p>
<h3>逻辑判断</h3>
<blockquote><p>(if (&lt; n 0)<br />
        (&#8230;)<br />
        (&#8230;)<br />
)</p></blockquote>
<p>逻辑判断是编程语言不可缺少的一部分，在script-fu中也比较简单，上面的结构就是一个例子。if是语句名，后面紧跟三个小括号，第一个应该包含一个逻辑表达式，第二个括号则是表达式为true的时执行的语句，第三个括号则是表达式为false的时候执行的语句。</p>
<h3>实践</h3>
<p>根据上述信息和一些GIMP的知识，就可以写出我前面说的剪切脚本了，我们先看代码：</p>
<blockquote>
<pre lang="schema">(define (script-fu-rs-center-crop filename outfilename width height)

  (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
          (drawable (car (gimp-image-get-active-layer image))))
          (let* ((original-width (car (gimp-image-width image)))
               (original-height (car (gimp-image-height image)))
          )

               (if (&lt;= (/ original-width original-height) (/ width height))
                   (gimp-image-crop image original-width (* original-width (/ height width)) 0 (/ (- original-height (* original-width (/ height width))) 2) )
                   (gimp-image-crop image (* original-height (/ width height)) original-height (/ (- original-width (* original-height (/ width height))) 2) 0)
               )
           )

  (set! drawable (car (gimp-image-get-active-layer image)))

(gimp-file-save RUN-NONINTERACTIVE image drawable outfilename outfilename)
     (gimp-image-delete image)))</pre>
</blockquote>
<p>最外面是一个define语句，他后面的第一个括号就是执行这个脚本的参数，在这个例子中参数分别是处理的图片名、输出的图片名、期望比例的宽度和期望比例的长度。然后我们用let*定义了一些变量，分别是image和drawable，因为我们后面处理图片主要针对的就是drawable对象。</p>
<p>请注意第二个let*就是外面let*的值，而在第二个let*中我们又定义了两个参数，图片的长和宽。然后最后输出的值就是if语句的作用了，其中会判断图片和目标比例的关系，通过切割调整为目标比例。</p>
<p>看起来还比较简单的，如果要处理比较复杂的图像，在基本语言部分可能还需要学会使用数组，而在GIMP方面还需要知道图层，以及其他复杂的API。通过上面的介绍，希望大家就能看懂基本的script-fu脚本，并修改为自己所需要的功能了。</p>
<h3>参考材料</h3>
<ul>
<li>GIMP的script-fu教程：<a href="http://docs.gimp.org/en/gimp-using-script-fu-tutorial.html">http://docs.gimp.org/en/gimp-using-script-fu-tutorial.html</a></li>
<li>Schema语言的一本书：<a href="http://www.scheme.com/tspl2d/index.html">http://www.scheme.com/tspl2d/index.html</a></li>
</ul>


<p>Related posts:<ol><li><a href='http://rocksun.cn/gimp-crop-script/' rel='bookmark' title='Permanent Link: Gimp Crop Script'>Gimp Crop Script</a></li><li><a href='http://rocksun.cn/resize-image-in-context-menu/' rel='bookmark' title='Permanent Link: Resize Image In Context Menu'>Resize Image In Context Menu</a></li><li><a href='http://rocksun.cn/ftp-image-with-conext-menu/' rel='bookmark' title='Permanent Link: FTP image with Conext Menu'>FTP image with Conext Menu</a></li></ol></p>
<p></p>]]></content:encoded>
			<wfw:commentRss>http://rocksun.cn/rocksun-script-fu-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用Inkscape做logo</title>
		<link>http://rocksun.cn/logo-with-inkscape/</link>
		<comments>http://rocksun.cn/logo-with-inkscape/#comments</comments>
		<pubDate>Mon, 22 Dec 2008 14:59:27 +0000</pubDate>
		<dc:creator>rocksun</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[GIMP]]></category>
		<category><![CDATA[inkscape]]></category>
		<category><![CDATA[logo]]></category>
		<category><![CDATA[svg]]></category>

		<guid isPermaLink="false">http://rocksun.cn/?p=309</guid>
		<description><![CDATA[在介绍了许多GIMP的自动化能力后，现在我们说一下GIMP的好搭档Inkscape。正如Illustrator对于Photoshop，Inkscape也是用来制作矢量图的。何谓矢量图？简单来说就是用线条描述的图像，而不是象素组成的图像。矢量图可以无限放大，很多logo之类的图像就是这样制做的，例如这个。
当然，虽然我很会Illustrator，但是对于Inkscape和设计我不太懂，这里有一份很好的教程，上面的logo就是根据这个教程制作的。当然Inkscape似乎没有执行自动化脚本的必要，因为它的许多操作应该是创造性的，是脚本代替不了的。


Related posts:Gimp Crop Script要想热 写插件Watermark: With GIMP Script



Related posts:<ol><li><a href='http://rocksun.cn/gimp-crop-script/' rel='bookmark' title='Permanent Link: Gimp Crop Script'>Gimp Crop Script</a></li><li><a href='http://rocksun.cn/write-plugin-for-flow/' rel='bookmark' title='Permanent Link: 要想热 写插件'>要想热 写插件</a></li><li><a href='http://rocksun.cn/watermark-with-gimp-script/' rel='bookmark' title='Permanent Link: Watermark: With GIMP Script'>Watermark: With GIMP Script</a></li></ol>

]]></description>
			<content:encoded><![CDATA[<p>在介绍了许多GIMP的自动化能力后，现在我们说一下GIMP的好搭档Inkscape。正如Illustrator对于Photoshop，<a href="http://www.inkscape.org/">Inkscape</a>也是用来制作矢量图的。何谓矢量图？简单来说就是用线条描述的图像，而不是象素组成的图像。矢量图可以无限放大，很多logo之类的图像就是这样制做的，例如这个。</p>
<div class="wp-caption aligncenter" style="width: 210px"><img title="Logo" src="/wp-content/uploads/logo.jpg" alt="Logo" width="200" height="200" /><p class="wp-caption-text">Logo</p></div>
<p>当然，虽然我很会Illustrator，但是对于Inkscape和设计我不太懂，<a href="http://linuxdesktop.cn/2008/11/30/how-to-use-inkscape-to-make-a-glass-style-logo.html">这里</a>有一份很好的教程，上面的logo就是根据这个教程制作的。当然Inkscape似乎没有执行自动化脚本的必要，因为它的许多操作应该是创造性的，是脚本代替不了的。</p>


<p>Related posts:<ol><li><a href='http://rocksun.cn/gimp-crop-script/' rel='bookmark' title='Permanent Link: Gimp Crop Script'>Gimp Crop Script</a></li><li><a href='http://rocksun.cn/write-plugin-for-flow/' rel='bookmark' title='Permanent Link: 要想热 写插件'>要想热 写插件</a></li><li><a href='http://rocksun.cn/watermark-with-gimp-script/' rel='bookmark' title='Permanent Link: Watermark: With GIMP Script'>Watermark: With GIMP Script</a></li></ol></p>
<p></p>]]></content:encoded>
			<wfw:commentRss>http://rocksun.cn/logo-with-inkscape/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gimp Crop Script</title>
		<link>http://rocksun.cn/gimp-crop-script/</link>
		<comments>http://rocksun.cn/gimp-crop-script/#comments</comments>
		<pubDate>Sun, 21 Dec 2008 12:06:35 +0000</pubDate>
		<dc:creator>rocksun</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[recommend]]></category>
		<category><![CDATA[crop]]></category>
		<category><![CDATA[GIMP]]></category>
		<category><![CDATA[resize]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[script-fu]]></category>

		<guid isPermaLink="false">http://rocksun.cn/?p=297</guid>
		<description><![CDATA[Look at this photo.
It seems a little fat? In my previouse post, I had introduced the resize script. The method resize script used was a direct resize. If the ratio of the original file is not same as the target file, the file will get into distortion.  I write a script can automatically crop the image to the [...]


Related posts:<ol><li><a href='http://rocksun.cn/watermark-with-gimp-script/' rel='bookmark' title='Permanent Link: Watermark: With GIMP Script'>Watermark: With GIMP Script</a></li><li><a href='http://rocksun.cn/resize-image-in-context-menu/' rel='bookmark' title='Permanent Link: Resize Image In Context Menu'>Resize Image In Context Menu</a></li><li><a href='http://rocksun.cn/rocksun-script-fu-tutorial/' rel='bookmark' title='Permanent Link: RockSun的script-fu教程'>RockSun的script-fu教程</a></li></ol>

]]></description>
			<content:encoded><![CDATA[<p>Look at this photo.</p>
<div class="wp-caption aligncenter" style="width: 210px"><img title="Fat Girl?" src="http://rocksun.cn/wp-content/uploads/cape7small.jpg" alt="Fat Girl?" width="200" height="120" /><p class="wp-caption-text">Fat Girl?</p></div>
<p>It seems a little fat? In my previouse post, I had introduced the <a title="Resize with gimp script" href="http://rocksun.cn/resize-image-in-context-menu/">resize script</a>. The method <a title="Resize with gimp script" href="http://rocksun.cn/resize-image-in-context-menu/">resize script</a> used was a direct resize. If the ratio of the original file is not same as the target file, the file will get into distortion.  I write a script can automatically crop the image to the target ratio. The new result is here.</p>
<div class="wp-caption aligncenter" style="width: 510px"><img title="Croped Image" src="/wp-content/uploads/cape7-2.jpg" alt="Croped Image" width="500" height="300" /><p class="wp-caption-text">Cropped Image</p></div>
<p>This script crop the top and bottom part of the image, so the result image can fit my favorite ratio, compare the images below.</p>
<div class="wp-caption aligncenter" style="width: 210px"><img title="Not Cropped" src="http://rocksun.cn/wp-content/uploads/cape7small.jpg" alt="Not Cropped" width="200" height="120" /><p class="wp-caption-text">Not Cropped</p></div>
<div class="wp-caption aligncenter" style="width: 210px"><img title="Cropped" src="http://rocksun.cn/wp-content/uploads/cape7-2small.jpg" alt="Not Cropped" width="200" height="120" /><p class="wp-caption-text">Cropped</p></div>
<p>The girl become slim again.</p>
<p>Now let&#8217;s see the gimp script <a href="http://gimp-script.googlecode.com/svn/trunk/rs-center-crop/rs-center-crop.scm">rs-center-crop.scm</a>:</p>
<blockquote>
<pre lang="shema">(define (script-fu-rs-center-crop filename outfilename width height)

  (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
          (drawable (car (gimp-image-get-active-layer image))))
          (let* ((original-width (car (gimp-image-width image)))
               (original-height (car (gimp-image-height image)))
               (new-width original-width)
               (new-height original-height)
               (offset-x 0)
               (offset-y 0))

               (if (&lt;= (/ original-width original-height) (/ width height))
                   (gimp-image-crop image original-width (* original-width (/ height width)) 0 (/ (- original-height (* original-width (/ height width))) 2) )
                   (gimp-image-crop image (* original-height (/ width height)) original-height (/ (- original-width (* original-height (/ width height))) 2) 0)
               )
           )

  (set! drawable (car (gimp-image-get-active-layer image)))

(gimp-file-save RUN-NONINTERACTIVE image drawable outfilename outfilename)
     (gimp-image-delete image)))</pre>
</blockquote>
<p>Copy the <a href="http://gimp-script.googlecode.com/svn/trunk/rs-center-crop/rs-center-crop.scm">rs-center-crop.scm</a> to “D:\Program Files\GIMP-2.0\share\gimp\2.0\scripts”(If your GIMP installed at D:\Program Files\GIMP-2.0 ). Now we can write a bat <a href="http://gimp-script.googlecode.com/svn/trunk/rs-center-crop/rs-center-crop.bat">rs-center-crop.bat</a>  to run this script. </p>
<blockquote>
<pre lang="bat">set str=%1
set str=%str:\=/%
set str2=%2
set str2=%str2:\=/%
"D:\Program Files\GIMP-2.0\bin\gimp-2.6.exe" -i --verbose -b "(script-fu-rs-center-crop \"%str%\" \"%str2%\" 200 120)" -b "(gimp-quit 0)"</pre>
</blockquote>
<p>In the last line, &#8220;200&#8243; and &#8220;100&#8243; is the target ratio. Because my file will resize to 200*120, so I set the ratio as 200 and 120. At last, we add it into the context menu, we write the reg file <a href="http://gimp-script.googlecode.com/svn/trunk/rs-center-crop/rs-center-crop.reg">rs-center-crop.reg</a>.</p>
<blockquote>
<pre lang="reg">Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\RSGimpCrop]
@="Crop as 200*120"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\RSGimpCrop\command]
@="F:\\rocksun\\gimp-script\\rs-center-crop\\rs-center-crop.bat \"%1\" \"%1\""</pre>
</blockquote>
<p>All files you can download or checkout with subversion from<a onclick="javascript:pageTracker._trackPageview('/outbound/article/gimp-script.googlecode.com');" href="http://gimp-script.googlecode.com/svn/trunk/rs-center-crop/"> http://gimp-script.googlecode.com/svn/trunk/rs-center-crop/</a> . I create this project to collect and produce gimp script, you can join it.</p>


<p>Related posts:<ol><li><a href='http://rocksun.cn/watermark-with-gimp-script/' rel='bookmark' title='Permanent Link: Watermark: With GIMP Script'>Watermark: With GIMP Script</a></li><li><a href='http://rocksun.cn/resize-image-in-context-menu/' rel='bookmark' title='Permanent Link: Resize Image In Context Menu'>Resize Image In Context Menu</a></li><li><a href='http://rocksun.cn/rocksun-script-fu-tutorial/' rel='bookmark' title='Permanent Link: RockSun的script-fu教程'>RockSun的script-fu教程</a></li></ol></p>
<p></p>]]></content:encoded>
			<wfw:commentRss>http://rocksun.cn/gimp-crop-script/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>自己动手简化图片处理</title>
		<link>http://rocksun.cn/use-gimp-to-handle-photos/</link>
		<comments>http://rocksun.cn/use-gimp-to-handle-photos/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 17:16:00 +0000</pubDate>
		<dc:creator>rocksun</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[GIMP]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[script-fu]]></category>

		<guid isPermaLink="false">http://rocksun.cn/?p=275</guid>
		<description><![CDATA[连续用英文写了几篇blogger处理图片的文章：生成水印、缩放和右键直接上传。下面我觉得还是用中文在总体说明一下我的方法，现在我们还是从GIMP开始。  GIMP是一个开源的图像处理软件，虽然与Photoshop相比在易用性上还有一定的缺陷，但是足以应付一般的图像处理。它也支持使用脚本来自动化某些操作，虽然它支持很多较为高级的语言，例如python，但是它的文档中介绍的脚本语言是script-fu。script-fu的语法确实很古怪，它的嵌套让我很是费解，不过既然是官方支持的，我们也以它为脚本语言。  一切从安装GIMP下载开始，我们后面的内容都是在windows下进行的，我们首先安装windows版本的GIMP，可以从http://www.gimp.org/windows/下载安装程序，直接运行安装即可，我的安装位置是：D:\Program Files\GIMP-2.0\  我们从生成水印开始，首先编写GIMP的生成水印的脚本，网上并没有满足我需要的版本，所以根据需要我修改了一份rs-watermark.scm，你可以直接下载复制到“D:\Program Files\GIMP-2.0\share\gimp\2.0\scripts”，当然要根据你的情况改变路径。然后编写一个bat文件，在我的设置中为rs-watermark.bat，内容如下：
set str=%1
set str=%str:\=/%
"D:\Program Files\GIMP-2.0\bin\gimp-2.6.exe" -i --verbose -b "(script-fu-rs-watermark \"%str%\" \"RockSun's Blog\" \"Century Gothic\" 20 3 50)" -b "(gimp-quit 0)"
各项参数说明如下：

script-fu-rs-watermark:  前面所说的rs-watermark.scm中的名字。
\&#8221;%str%\&#8221;： 就是要处理的文件。
\&#8221;RockSun&#8217;s Blog\&#8221;： 水印的字符。
\&#8221;Century Gothic\&#8221;： 水印的字体。
20： 水印的大小，20px。
3： 水印的位置，3指的是右上角，可以选择0,1,2。
50： 水印的透明度。

根据你的情况，可以选择不同的参数使用。在命令行中执行“rs-watermark.bat test.jpg”就可以实现对test.jpg添加水印的动作。效果如下：   
最后，为了更加方便，我们希望把这个操作添加到右键菜单中，为此我写了这个rs-watermark.reg，内容如下：
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\RSGimpWatermark]
@="Make RockSun Watermark"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\RSGimpWatermark\command]
@="F:\\rocksun\\gimp-script\\rs-watermark\\rs-watermark.bat \"%1\""
其中“Make RockSun Watermark”是右键菜单的名字，而F:\\rocksun\\gimp-script\\rs-watermark\\rs-watermark.bat \&#8221;%1\&#8221;是执行我们的批处理命令的执行，直接运行并导入注册表文件后，效果如下图所示：
 
关于水印的介绍到这里就结束了。对于文件大小的改动按照同样的模式，可以在http://gimp-script.googlecode.com/svn/trunk/rs-resize/得到所有的文件，这里就不再多说了。
最后我们说说直接用右键上传文件到服务器上，这也是有自己主机的blogger经常用的一个操作，通过我们的设置，以后这个操作就不必再启动ftp客户端了，一个右键就可以了。编写一个rs-ftp.bat，内容如下：

echo open 208.97.171.116 &#62;ftp.txt
echo user username userpassword [...]


Related posts:<ol><li><a href='http://rocksun.cn/watermark-with-gimp-script/' rel='bookmark' title='Permanent Link: Watermark: With GIMP Script'>Watermark: With GIMP Script</a></li><li><a href='http://rocksun.cn/ftp-image-with-conext-menu/' rel='bookmark' title='Permanent Link: FTP image with Conext Menu'>FTP image with Conext Menu</a></li><li><a href='http://rocksun.cn/resize-image-in-context-menu/' rel='bookmark' title='Permanent Link: Resize Image In Context Menu'>Resize Image In Context Menu</a></li></ol>

]]></description>
			<content:encoded><![CDATA[<p>连续用英文写了几篇blogger处理图片的文章：<a href="http://rocksun.cn/watermark-with-gimp-script/">生成水印</a>、<a href="http://rocksun.cn/resize-image-in-context-menu/">缩放</a>和<a href="http://rocksun.cn/ftp-image-with-conext-menu/">右键直接上传</a>。下面我觉得还是用中文在总体说明一下我的方法，现在我们还是从GIMP开始。  GIMP是一个开源的图像处理软件，虽然与Photoshop相比在易用性上还有一定的缺陷，但是足以应付一般的图像处理。它也支持使用脚本来自动化某些操作，虽然它支持很多较为高级的语言，例如python，但是它的文档中介绍的脚本语言是script-fu。script-fu的语法确实很古怪，它的嵌套让我很是费解，不过既然是官方支持的，我们也以它为脚本语言。  一切从安装GIMP下载开始，我们后面的内容都是在windows下进行的，我们首先安装windows版本的GIMP，可以从<a href="http://www.gimp.org/windows/">http://www.gimp.org/windows/</a>下载安装程序，直接运行安装即可，我的安装位置是：D:\Program Files\GIMP-2.0\  我们从生成水印开始，首先编写GIMP的生成水印的脚本，网上并没有满足我需要的版本，所以根据需要我修改了一份<a href="http://gimp-script.googlecode.com/svn/trunk/rs-watermark/rs-watermark.scm">rs-watermark.scm</a>，你可以直接下载复制到“D:\Program Files\GIMP-2.0\share\gimp\2.0\scripts”，当然要根据你的情况改变路径。然后编写一个bat文件，在我的设置中为<a href="http://gimp-script.googlecode.com/svn/trunk/rs-watermark/rs-watermark.bat">rs-watermark.bat</a>，内容如下：</p>
<pre lang="bat">set str=%1
set str=%str:\=/%
"D:\Program Files\GIMP-2.0\bin\gimp-2.6.exe" -i --verbose -b "(script-fu-rs-watermark \"%str%\" \"RockSun's Blog\" \"Century Gothic\" 20 3 50)" -b "(gimp-quit 0)"</pre>
<p>各项参数说明如下：</p>
<ul>
<li>script-fu-rs-watermark:  前面所说的<a href="http://gimp-script.googlecode.com/svn/trunk/rs-watermark/rs-watermark.scm">rs-watermark.scm</a>中的名字。</li>
<li>\&#8221;%str%\&#8221;： 就是要处理的文件。</li>
<li><span style="font-family: 'Courier New'; line-height: 18px; white-space: pre;">\&#8221;RockSun&#8217;s Blog\&#8221;： 水印的字符。</span></li>
<li><span style="font-family: 'Courier New'; line-height: 18px; white-space: pre;">\&#8221;Century Gothic\&#8221;： 水印的字体。</span></li>
<li><span style="font-family: 'Courier New'; line-height: 18px; white-space: pre;">20： 水印的大小，20px。</span></li>
<li><span style="font-family: 'Courier New'; line-height: 18px; white-space: pre;">3： 水印的位置，3指的是右上角，可以选择0,1,2。</span></li>
<li><span style="font-family: 'Courier New'; line-height: 18px; white-space: pre;">50： 水印的透明度。</span></li>
</ul>
<p>根据你的情况，可以选择不同的参数使用。在命令行中执行“rs-watermark.bat test.jpg”就可以实现对test.jpg添加水印的动作。效果如下：   </p>
<div class="wp-caption aligncenter" style="width: 310px"><img title="黄浦江" src="http://rocksun.cn/wp-content/uploads/2008/12/huangpu-300x224.jpg" alt="黄浦江" width="300" height="224" /><p class="wp-caption-text">黄浦江</p></div>
<p>最后，为了更加方便，我们希望把这个操作添加到右键菜单中，为此我写了这个<a href="http://gimp-script.googlecode.com/svn/trunk/rs-watermark/rs-watermark.reg">rs-watermark.reg</a>，内容如下：</p>
<pre lang="reg">Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\RSGimpWatermark]
@="Make RockSun Watermark"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\RSGimpWatermark\command]
@="F:\\rocksun\\gimp-script\\rs-watermark\\rs-watermark.bat \"%1\""</pre>
<p>其中“Make RockSun Watermark”是右键菜单的名字，而F:\\rocksun\\gimp-script\\rs-watermark\\rs-watermark.bat \&#8221;%1\&#8221;是执行我们的批处理命令的执行，直接运行并导入注册表文件后，效果如下图所示：</p>
<p> </p>
<div class="wp-caption aligncenter" style="width: 210px"><img title="右键菜单" src="http://rocksun.cn/wp-content/uploads/2008/12/contextmenu.jpg" alt="右键菜单" width="200" height="200" /><p class="wp-caption-text">右键菜单</p></div>
<p>关于水印的介绍到这里就结束了。对于文件大小的改动按照同样的模式，可以在<a href="http://gimp-script.googlecode.com/svn/trunk/rs-resize/">http://gimp-script.googlecode.com/svn/trunk/rs-resize/</a>得到所有的文件，这里就不再多说了。</p>
<p>最后我们说说直接用右键上传文件到服务器上，这也是有自己主机的blogger经常用的一个操作，通过我们的设置，以后这个操作就不必再启动ftp客户端了，一个右键就可以了。编写一个<a href="http://gimp-script.googlecode.com/svn/trunk/rs-ftp/rs-ftp.bat">rs-ftp.bat</a>，内容如下：</p>
<blockquote>
<pre>echo open 208.97.171.116 &gt;ftp.txt
echo user username userpassword &gt;&gt;ftp.txt
echo cd /rocksun.cn/wp-content/uploads/ &gt;&gt;ftp.txt
echo prompt off &gt;&gt;ftp.txt
echo put %1 &gt;&gt;ftp.txt
echo bye &gt;&gt;ftp.txt
echo quit &gt;&gt;ftp.txt
echo exit &gt;&gt;ftp.txt
ftp -n -s:ftp.txt
del ftp.txt</pre>
</blockquote>
<p>其中你要修改ip、用户名（username）和用户密码（userpassword）以及上传的路径（/rocksun.cn/wp-content/uploads/），然后我们再创建注册表文件<a href="http://gimp-script.googlecode.com/svn/trunk/rs-ftp/rs-ftp.reg">rs-ftp.reg</a>，内容如下：</p>
<pre lang="reg">Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\RSUpload]

@="Upload to rocksun"
 

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\RSUpload\command]

@="F:\\rocksun\\gimp-script\\rs-ftp\\rs-ftp.bat \"%1\""</pre>
<p>将这个文件导入后，我们就可以在文件上右键-&gt;Upload to rocksun，就完成了文件的上传。欢迎大家提供更多的想法和脚本，如果你有更好的参数也可以提供给我。</p>


<p>Related posts:<ol><li><a href='http://rocksun.cn/watermark-with-gimp-script/' rel='bookmark' title='Permanent Link: Watermark: With GIMP Script'>Watermark: With GIMP Script</a></li><li><a href='http://rocksun.cn/ftp-image-with-conext-menu/' rel='bookmark' title='Permanent Link: FTP image with Conext Menu'>FTP image with Conext Menu</a></li><li><a href='http://rocksun.cn/resize-image-in-context-menu/' rel='bookmark' title='Permanent Link: Resize Image In Context Menu'>Resize Image In Context Menu</a></li></ol></p>
<p></p>]]></content:encoded>
			<wfw:commentRss>http://rocksun.cn/use-gimp-to-handle-photos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

