> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/zh-tw/zhi-shi-ku/113-optimising-very-large-image-files.md).

# 最佳化超大型影像檔

過大的圖像檔案，或使用不適當檔案格式的圖像檔案，可能會大幅延長編譯過程，並且可能導致編譯逾時。本說明文章概述了一些處理大型圖像檔案，以及選擇適當圖像檔案格式的建議。

對於大型圖像檔案（每個檔案大小皆大於 1MB），我們建議將點陣圖像（包括點陣 PDF 圖像）重新調整大小，例如調整為寬或高 1200px，讓檔案大小更小。你可以使用影像處理程式來做到這點；如果你使用 ImageMagick，也可以使用 [`convert` 命令](http://www.imagemagick.org/Usage/resize)。在 macOS 上， [`sips -Z` 命令](http://lifehacker.com/5962420/batch-resize-images-quickly-in-the-os-x-terminal) 非常實用。

儲存為 `.png` 的攝影影像也可能導致非常大的檔案大小： `.jpg` 通常是更省空間的格式，適合用於 *照片*. *線條繪圖、圖表和示意圖* 通常較適合儲存為 `.png` 或 `.pdf`。 `.pdf` 影像也可以比 `.png` 檔案更快編譯，如果它們的檔案大小相近，因為編譯過程就不需要呼叫 `libpng`.

在 `.eps` 影像的情況下，我們建議將它們轉換為 `.pdf`，因為 PDF 格式通常能在保留線條繪圖向量特性的同時，產生更小的檔案大小。 [`epstopdf` 命令](https://www.ctan.org/pkg/epstopdf) 這個工具很方便；你也需要安裝 GhostScript。

如果你必須在專案中使用 `.eps` 影像，有時候 `.eps` 檔案會因為匯出它們的應用程式出現故障／設定錯誤而變得不必要地龐大。你可以嘗試修改匯出設定；或者只用 GhostScript 重新處理該檔案，並比較檔案大小：

```
gs -o outputfile.eps -sDEVICE=epswrite originalfile.eps
```

如果你想在撰寫文件時稍微節省一些編譯／渲染時間，可以透過寫入 `\documentclass[draft]{…}` 到文件類別宣告中來開啟「草稿」模式，讓你的編譯速度更快。由於不會將影像渲染到 PDF 中（以及其他一些處理），「草稿」選項通常有助於減少編譯時間，這在處理大型文件時很有用。

你也可以針對你正在處理的專案中特定部分，開啟／關閉圖形：

```latex
\setkeys{Gin}{draft=false}
……這裡的任何 \includegraphics 都會完整渲染，因此
你可以檢查文件這一部分的影像..
\setkeys{Gin}{draft}
……這裡的任何 \includegraphics 都只會顯示為空白框。
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/zh-tw/zhi-shi-ku/113-optimising-very-large-image-files.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
