File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed
Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 1919
2020from docx .compat import BytesIO , is_string
2121from docx .exceptions import UnrecognizedImageError
22+ from docx .image .gif import Gif
2223from docx .image .jpeg import Exif , Jfif
2324from docx .image .png import Png
2425from docx .opc .constants import CONTENT_TYPE as CT
3031 (Png , 0 , b'\x89 PNG\x0D \x0A \x1A \x0A ' ),
3132 (Jfif , 6 , b'JFIF' ),
3233 (Exif , 6 , b'Exif' ),
34+ (Gif , 0 , b'GIF87a' ),
35+ (Gif , 0 , b'GIF89a' ),
3336)
3437
3538
Original file line number Diff line number Diff line change 1+ # encoding: utf-8
2+
3+ from __future__ import absolute_import , division , print_function
4+
5+ from .image import Image
6+
7+
8+ class Gif (Image ):
9+ """
10+ Image header parser for GIF images. Note that the GIF format does not
11+ support resolution (DPI) information. Both horizontal and vertical DPI
12+ default to 72.
13+ """
Original file line number Diff line number Diff line change 1111from docx .compat import BytesIO
1212from docx .exceptions import UnrecognizedImageError
1313from docx .image import image_cls_that_can_parse , Image_OLD
14+ from docx .image .gif import Gif
1415from docx .image .image import Image
1516from docx .image .jpeg import Exif , Jfif
1617from docx .image .png import Png
@@ -40,6 +41,7 @@ def it_raises_on_unrecognized_image_stream(self):
4041 ('python-icon.png' , Png ),
4142 ('python-icon.jpeg' , Jfif ),
4243 ('exif-420-dpi.jpg' , Exif ),
44+ ('sonic.gif' , Gif ),
4345 ])
4446 def image_cls_lookup_fixture (self , request ):
4547 image_filename , expected_class = request .param
You can’t perform that action at this time.
0 commit comments