Add sources of images, remove copyrighted image

This commit is contained in:
Sachin Kelkar
2017-02-12 01:19:36 +05:30
parent ccca04b450
commit 245e24dcf3
8 changed files with 42 additions and 11 deletions

View File

@@ -73,10 +73,8 @@ def parse_jpeg(data: bytes) -> Metadata:
if segment.marker._name_ == 'com':
parts.append(('comment', str(segment.data)))
if segment.marker._name_ == 'app1':
try:
if hasattr(segment.data, 'body'):
for field in segment.data.body.data.body.ifd0.fields:
if field.data is not None:
parts.append((field.tag._name_, field.data.decode('UTF-8').strip('\x00')))
except AttributeError:
pass
return parts

View File

@@ -8,7 +8,7 @@ def test_view_image():
for img in [
"mitmproxy/data/image.png",
"mitmproxy/data/image.gif",
"mitmproxy/data/image-err1.jpg",
"mitmproxy/data/all.jpeg",
"mitmproxy/data/image.ico"
]:
with open(tutils.test_data.path(img), "rb") as f:

View File

@@ -136,16 +136,32 @@ def test_parse_gif(filename, metadata):
('Size', '717 x 558 px')
],
# check multiple segments
"mitmproxy/data/image_parser/image-err1.jpg": [
"mitmproxy/data/image_parser/all.jpeg": [
('Format', 'JPEG (ISO 10918)'),
('jfif_version', '(1, 1)'),
('jfif_density', '(72, 72)'),
('jfif_density', '(300, 300)'),
('jfif_unit', '1'),
('image_description', '<<enter caption here>> on December 4, 2009 in Washington, DC.'),
('make', 'Canon'), ('model', 'Canon EOS-1D Mark III'),
('artist', 'Alex Wong'),
('primary_chromaticities', '@\x00\x00\x00d'),
('copyright', '2009 Getty Images')
('comment', 'b\'BARTOLOMEO DI FRUOSINO\\r\\n(b. ca. 1366, Firenze, d. 1441, '
'Firenze)\\r\\n\\r\\nInferno, from the Divine Comedy by Dante (Folio 1v)'
'\\r\\n1430-35\\r\\nTempera, gold, and silver on parchment, 365 x 265 mm'
'\\r\\nBiblioth\\xe8que Nationale, Paris\\r\\n\\r\\nThe codex in Paris '
'contains the text of the Inferno, the first of three books of the Divine '
'Comedy, the masterpiece of the Florentine poet Dante Alighieri (1265-1321).'
' The codex begins with two full-page illuminations. On folio 1v Dante and '
'Virgil stand within the doorway of Hell at the upper left and observe its '
'nine different zones. Dante and Virgil are to wade through successive '
'circles teeming with images of the damned. The gates of Hell appear in '
'the middle, a scarlet row of open sarcophagi before them. Devils orchestrate'
' the movements of the wretched souls.\\r\\n\\r\\nThe vision of the fiery '
'inferno follows a convention established by <A onclick="return OpenOther'
'(\\\'/html/n/nardo/strozzi3.html\\\')" HREF="/html/n/nardo/strozzi3.html">'
'Nardo di Cione\\\'s fresco</A> in the church of Santa Maria Novella, Florence.'
' Of remarkable vivacity and intensity of expression, the illumination is '
'executed in Bartolomeo\\\'s late style.\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n'
'--- Keywords: --------------\\r\\n\\r\\nAuthor: BARTOLOMEO DI FRUOSINO'
'\\r\\nTitle: Inferno, from the Divine Comedy by Dante (Folio 1v)\\r\\nTime-line:'
' 1401-1450\\r\\nSchool: Italian\\r\\nForm: illumination\\r\\nType: other\\r\\n\''),
('Size', '750 x 1055 px')
],
}.items())
def test_parse_jpeg(filename, metadata):

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

View File

@@ -0,0 +1,17 @@
# Sources of the images used
## PNG
`aspect.png` - http://pngimg.com/upload/water_PNG3290.png
All other PNGs are from the [PNGTestSuite](http://www.schaik.com/pngsuite/)
# GIF
All the GIFs are from the Pillow repository [here](https://github.com/python-pillow/Pillow/tree/master/Tests/images)
# JPEG
`app1.jpeg` - https://commons.wikimedia.org/wiki/File:PT05_ubt.jpeg
`all.jpeg` - https://commons.wikimedia.org/wiki/Category:Dante's_Inferno#/media/File:Bartolomeo_Di_Fruosino_-_Inferno,_from_the_Divine_Comedy_by_Dante_(Folio_1v)_-_WGA01339.jpg
`comment.jpg` has been taken from [here](https://commons.wikimedia.org/wiki/File:JPEG_example_image.jpg) and has a comment added locally
All other JPEGs are from the Pillow repository [here](https://github.com/python-pillow/Pillow/tree/master/Tests/images)

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB