> ## Content Index
> Fetch the complete content index at: https://blog.hinablue.me/llms.txt
> Use this file to discover other available public pages before exploring further.

# [ImageMagick note.] 圖形裁切的微妙差異
- URL: https://blog.hinablue.me/imagemagick-note-about-the-crop-photo-with-golden-section/
- Published: 2011-04-07T07:25:00.000Z
- Updated: 2026-06-25T09:41:20.000Z
- Author: Hina Chen
- Tags: imagemagick, Work

突然想起 [黃金分割](http://zh.wikipedia.org/wiki/%E9%BB%84%E9%87%91%E5%88%86%E5%89%B2?ref=blog.hinablue.me) 比例的問題，所以就用 ImageMagick 來實驗一下。不過，這個作法還是有其限制，如果構圖的方式比較特殊，恐怕就不能這樣做了。至於什麼是 [黃金分割](http://zh.wikipedia.org/wiki/%E9%BB%84%E9%87%91%E5%88%86%E5%89%B2?ref=blog.hinablue.me) 比例，由於我是農夫，所以那三小比例去問問 Google 大神，應該會有很多。

原照片是這樣（黃色的線是黃金分割比例）。

![](https://blog.hinablue.me/content/images/2014/Jun/1796191672.jpg)

這是使用普通的置中裁切所切出來的縮圖。

![](https://blog.hinablue.me/content/images/2014/Jun/3775194789.jpg)

如果我們依照黃金分割比例，然後用小邊去擴大我想要得區塊，大致上會是這樣。

![](https://blog.hinablue.me/content/images/2014/Jun/5216995432.jpg)

所以紅色的地方我可以把他擷取下來。

![](https://blog.hinablue.me/content/images/2014/Jun/3352105075.jpg)

最後再依照小邊擷取成正方形，並縮圖。

![](https://blog.hinablue.me/content/images/2014/Jun/1709838652.jpg)

讓我們再看一次差異，這是一般擷取。

![](https://blog.hinablue.me/content/images/2014/Jun/3775194789.jpg)

這是黃金分割比例的擷取。

![](https://blog.hinablue.me/content/images/2014/Jun/1709838652.jpg)

打完收工（被揍飛）。

擷取依照此照片的尺寸來說，他是 1880x2816。那我需要的黃金分割，長邊依序是 1161（寬），與 1740（高），小邊則是 719（寬），與 1076（高）。所以在切割所需要的尺寸與位移，則是：

> (1161 + 719/2)x(1740 + 1076/2)+(719/2)+(1076/2)

所以整個 -crop 的參數就是：

> \-crop 1520x2278+359+538 +repage

然後在針對短邊做置中 crop：

> \-crop 1520x1520+0+0 +repage

最後縮圖完成。整組指令就是：

> /usr/bin/convert 1.jpg -crop 1520x2278+259+538 +repage -crop 1520x1520+0+0 +repage -resize '100x100' 1\_thumb.jpg

打完收工，指令請勿照抄！