<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Other on Excelight&#39;s Blog</title>
    <link>https://excelight.github.io/tags/other/</link>
    <description>Recent content in Other on Excelight&#39;s Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Sun, 02 Jul 2017 16:11:07 +0800</lastBuildDate>
    
	<atom:link href="https://excelight.github.io/tags/other/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>一个简单的图片找茬工具</title>
      <link>https://excelight.github.io/posts/python_image_differ/</link>
      <pubDate>Sun, 02 Jul 2017 16:11:07 +0800</pubDate>
      
      <guid>https://excelight.github.io/posts/python_image_differ/</guid>
      <description>大家来找茬应该大部分人都玩过吧，最近网上看到个图片找茬的活动，给出一张jpg图片文件，其中内容是左右两边各一张相似的图片，中间有白色的背景作为间隔，需要找出两张图的不同之处，由于自己眼力不行于是就想通过程序来实现。本文就来介绍一下这个简单的找茬程序，我称之为imageDiffer。源代码可在https://github.com/Excelight/imageDiffer 找到
 需求 根据传入的一张jpg图片(包含左右各一张图)，显示出两张图片的不同之处
工具  语言：python lib: Pillow，一个python图像处理库  流程 1. 图片分割 这一步，我们需要将传入的图片分割成两个大小相同的图片，作为后续找不同的基础。这一步我们使用了最简单的方式就是，直接对半分，可以使用Image.crop函数
from PIL import Image, ImageChops im = Image.open(path) #拆分成左右两个 width, height = im.size imLeft = im.crop(0, 0, width/2, height) imRight = im.crop(width/2, 0, width, height) 2. 背景去除 由于第1步得到的结果存在一些边框，而且左侧图片的边框在右边，右侧图片的边框在左边，这将导致两张图片没有办法直接做比较，所以需要把边框去除，这可以用到ImageChops这个类中的几个方法，我们写一个imageTrim函数，专门用来去除边框
def imageTrim(imageIn, bgColor): # 创建一张纯背景色的图 imBg = Image.new(imageIn.mode, imageIn.size, bgColor) # 生成背景图和目标图的差异图，如果像素点颜色一样，那么差异图中就是纯黑色(0,0,0) diff = ImageChops.difference(imageIn, imBg) # 由于边框的颜色并非纯色，可能有一些早点，add可以用来去除早点 diff = ImageChops.add(diff, diff, scale=2.0, offset=-100) # you may adjust scale or offset here if necessary # 获取包含有内容的边框，即去除了diff中纯黑的边框 bbox = diff.</description>
    </item>
    
    <item>
      <title>Hello Hugo!</title>
      <link>https://excelight.github.io/posts/hello_hugo/</link>
      <pubDate>Sat, 29 Apr 2017 16:05:46 +0800</pubDate>
      
      <guid>https://excelight.github.io/posts/hello_hugo/</guid>
      <description>最近要开始捣腾Golang了，所以从工具入手，无意中看了个Go语言相关的视频，演讲者就是我现在使用的博客工具hugo的作者，所以顺便调研了下，感觉可以为我所用。
 把这篇文章作为新博客的首篇，一来是为了描述下这个博客的来历，二来是为了避免以后写新文章不知道如何操作，毕竟还是需要一些命令的，所以正好记录下，免得经常去翻官网
这里先贴一下hugo的项目地址https://github.com/spf13/hugo
创建一个博客站点 $ cd blog_site $ hugo new site . 基础信息配置 博客的基础信息的配置都在网站更目录下的config.toml中，可根据自己的需求进行修改
新建一篇文章 $ hugo new post/new-article.md 通过上述命令，会在content目录下创建出新的md文件，进去编辑md文件即可 自动创建出来的md文件的顶部会有一些内容，date和title没有什么好解释的，draft的话表示是否是草稿，如果设置为true，则最后发布的文章中并不会出现这篇
About页 $ hugo new about.md about.md用于博客的个人简介
使用主题 如果是第一次使用hugo，由于hugo不自带默认主题，那么还要下载一个主题。主题可以在这里浏览：https://themes.gohugo.io 选择一个喜欢的主题下载，然后根据页面中的说明，修改配置
$ cd themes $ git clone https://github.com/digitalcraftsman/hugo-cactus-theme.git 启动服务 #启动 $ hugo server #启动，包括草稿，即文章中draft设置为true的 $ hugo server --buildDrafts #以watch方式启动，文件如有修改会立即刷新 $ hugo server --buildDrafts --watch 在浏览器打开http://127.0.0.1:1313
其他 写到这里对于日常使用应该是够了，还有其他的问题可以参考：http://blog.coderzh.com/2015/08/29/hugo/</description>
    </item>
    
  </channel>
</rss>