Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.io.image
Commits
ef1298bf
Commit
ef1298bf
authored
Jul 27, 2016
by
Manuel Günther
Browse files
Added test cases for different variants of PNG compression
parent
69530508
Changes
4
Hide whitespace changes
Inline
Side-by-side
bob/io/image/data/img_gray_alpha.png
0 → 100644
View file @
ef1298bf
644 Bytes
bob/io/image/data/img_indexed_color_alpha.png
0 → 100644
View file @
ef1298bf
574 Bytes
bob/io/image/data/img_trns.png
0 → 100644
View file @
ef1298bf
360 Bytes
bob/io/image/test.py
View file @
ef1298bf
...
...
@@ -14,26 +14,48 @@ from bob.io.base import load, write, test_utils
# These are some global parameters for the test.
PNG_INDEXED_COLOR
=
test_utils
.
datafile
(
'img_indexed_color.png'
,
__name__
)
PNG_INDEXED_COLOR_ALPHA
=
test_utils
.
datafile
(
'img_indexed_color_alpha.png'
,
__name__
)
PNG_RGBA_COLOR
=
test_utils
.
datafile
(
'img_rgba_color.png'
,
__name__
)
PNG_GRAY_ALPHA
=
test_utils
.
datafile
(
'img_gray_alpha.png'
,
__name__
)
PNG_tRNS
=
test_utils
.
datafile
(
'img_trns.png'
,
__name__
)
def
test_png_indexed_color
():
# Read an indexed color PNG image, and compared with hardcoded values
img
=
load
(
PNG_INDEXED_COLOR
)
assert
img
.
shape
==
(
3
,
22
,
32
)
assert
img
[
0
,
0
,
0
]
==
255
assert
img
[
0
,
17
,
17
]
==
117
def
test_png_rgba_color
():
# Read an indexed color PNG image, and compared with hardcoded values
img
=
load
(
PNG_RGBA_COLOR
)
assert
img
.
shape
==
(
3
,
22
,
32
)
assert
img
[
0
,
0
,
0
]
==
255
assert
img
[
0
,
17
,
17
]
==
117
def
test_png_indexed_color_alpha
():
# Read an indexed color+alpha PNG image, and compared with hardcoded values
img
=
load
(
PNG_INDEXED_COLOR_ALPHA
)
assert
img
.
shape
==
(
3
,
22
,
32
)
assert
img
[
0
,
0
,
0
]
==
255
assert
img
[
0
,
17
,
17
]
==
117
def
test_png_indexed_trns
():
# Read an tRNS PNG image (without alpha), and compared with hardcoded values
img
=
load
(
PNG_tRNS
)
assert
img
.
shape
==
(
3
,
22
,
32
)
assert
img
[
0
,
0
,
0
]
==
255
assert
img
[
0
,
17
,
17
]
==
117
def
test_png_gray_alpha
():
# Read a gray+alpha PNG image, and compared with hardcoded values
img
=
load
(
PNG_GRAY_ALPHA
)
assert
img
.
shape
==
(
22
,
32
)
assert
img
[
0
,
0
]
==
255
assert
img
[
17
,
17
]
==
51
def
transcode
(
filename
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment