.. _sphinx_img: 图片 #### 说明:: There are two image directives: image and figure. An image is a simple picture. A figure consists of image data (including image options), an optional caption (a single paragraph), and an optional legend (arbitrary body elements). For page-based output media, figures might float to a different position if this helps the page layout. image ===== .. note:: :scale:等配置在图片是http地址时不管用。这是因为当使用外部 URL 引入图片时,sphinx 通过解析本地图片获取大小信息,但对外部图片无法获取大小,所以无法正确应用 scale 设置。 可以采用指定 width 和 height 的绝对值的方法来缩放 Example ------- :: .. image:: ../files/image/photo.jpg .. image:: ../files/image/photo.jpg Example ------- :: .. image:: ../files/image/photo.jpg :scale: 50 % .. image:: ../files/image/photo.jpg :scale: 50 % Example for image usage ----------------------- :: .. image:: picture.jpg :width: 200px :height: 100px :scale: 50 % :alt: alternate text :align: right .. image:: ../files/image/photo.jpg :width: 200px :height: 100px :scale: 50 % :alt: alternate text :align: right 其他示例 -------- :: .. image:: https://travis-ci.org/rtfd/sphinx_rtd_theme.svg?branch=master :target: https://travis-ci.org/rtfd/sphinx_rtd_theme :alt: Build Status .. image:: https://img.shields.io/pypi/l/sphinx_rtd_theme.svg :target: https://pypi.python.org/pypi/sphinx_rtd_theme/ :alt: License .. image:: https://readthedocs.org/projects/sphinx-rtd-theme/badge/?version=latest :target: http://sphinx-rtd-theme.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status figure ====== .. note:: A figure is an image with a caption and/or a legend: Example ------- :: .. figure:: ../files/image/photo.jpg .. figure:: ../files/image/photo.jpg Example ------- :: .. figure:: ../files/image/photo.jpg :scale: 50 % .. figure:: ../files/image/photo.jpg :scale: 50 % Example for figure usage ------------------------ :: .. figure:: picture.png :scale: 50 % :alt: map to buried treasure This is the caption of the figure (a simple paragraph). .. figure:: ../files/image/photo.jpg :scale: 50 % :alt: map to buried treasure This is the caption of the figure (a simple paragraph). 其他示例 -------- :: .. figure:: image/photo.jpg :width: 20%, 12.0cm % image宽度 :figwidth: % 图片宽度 :scale: 50 % :alt: map to buried treasure :align : left, center, or right % 指定「标题」位置 『图片标题』 width说明: +---------------------------+ | figure | | | |<------ figwidth --------->| | | | +---------------------+ | | | image | | | | | | | |<--- width --------->| | | +---------------------+ | | | |The figure's caption should| |wrap at this width. | +---------------------------+ 注释: .. -*- coding:utf-8 -*-