> 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/wen-yu-da/35-how-do-i-specify-the-size-of-an-image-in-latex.md).

# 我該如何在 LaTeX 中指定圖片大小？

要在 Overleaf 文件中插入圖形，你首先必須 [將它上傳到你的專案](/latex/zh-tw/zhi-shi-ku/088-including-images-on-overleaf.md)。假設你已載入了 `graphicx` 套件到你的文件前言：

```latex
\usepackage{graphicx}
```

你可以使用 `scale=...` 選項來指定影像的（排版後）大小： `\includegraphics` 指令：

```latex
\includegraphics[width=0.5\textwidth]{my-uploaded-figure.png}
```

## 範例

* **注意**：以下範例使用了一個圖形檔案（`example-image.pdf`）由 `mwe` 套件提供。這些圖形檔案由 TeX Live 發行，因此儲存在 Overleaf 的伺服器上，可作為圖片預留位置使用，例如下方的範例。

```latex
\documentclass{article}
\usepackage{graphicx}
\begin{document}
影像的原始大小：

\vspace{3pt}
\includegraphics{example-image.pdf}

\vspace{12pt}
影像縮放至 50\%：

\vspace{3pt}
\includegraphics[scale=0.5]{example-image.pdf}

\vspace{12pt}
影像縮放至 25\%：

\vspace{3pt}
\includegraphics[scale=0.25]{example-image.pdf}
\end{document}
```

[在 Overleaf 中開啟這個範例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=How+to+change+the+size+of+an+image\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bgraphicx%7D%0A%5Cbegin%7Bdocument%7D%0ANatural+size+of+the+image%3A%0A%0A%5Cvspace%7B3pt%7D%0A%5Cincludegraphics%7Bexample-image.pdf%7D%0A%0A%5Cvspace%7B12pt%7D%0AImage+scaled+to+50%5C%25%3A%0A%0A%5Cvspace%7B3pt%7D%0A%5Cincludegraphics%5Bscale%3D0.5%5D%7Bexample-image.pdf%7D%0A%0A%5Cvspace%7B12pt%7D%0AImage+scaled+to+25%5C%25%3A%0A%0A%5Cvspace%7B3pt%7D%0A%5Cincludegraphics%5Bscale%3D0.25%5D%7Bexample-image.pdf%7D%0A%5Cend%7Bdocument%7D)

此範例會產生以下輸出：

![如何在 LaTeX 中變更影像大小](/files/c5826826aa770a271d221c7f126e0ce54f60217d)

我們的預設論文範本中也有此範例——你可以試著透過 [建立一篇新論文](https://www.overleaf.com/docs?template=paper) 來看看影像 `frog.jpg` 如何透過寫下以下內容將其縮放為文字寬度的一部分：

```latex
\includegraphics[width=0.3\textwidth]{frog.jpg}
```


---

# 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/wen-yu-da/35-how-do-i-specify-the-size-of-an-image-in-latex.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.
