2 // Copyright 2013 Christian Henning
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 //#define BOOST_TEST_MODULE png_read_test_module
9 #define BOOST_GIL_IO_ADD_FS_PATH_SUPPORT
10 #define BOOST_GIL_IO_ENABLE_GRAY_ALPHA
11 #define BOOST_FILESYSTEM_VERSION 3
13 #include <boost/gil/extension/io/png.hpp>
15 #include <boost/test/unit_test.hpp>
21 #include "scanline_read_test.hpp"
22 #include "unit_test_utility.hpp"
25 using namespace boost
;
27 using namespace boost::gil::detail
;
28 namespace fs
= boost::filesystem
;
30 using tag_t
= png_tag
;
32 BOOST_AUTO_TEST_SUITE( gil_io_png_tests
)
34 using gray_alpha8_pixel_t
= pixel
<uint8_t, gray_alpha_layout_t
>;
35 using gray_alpha8_image_t
= image
<gray_alpha8_pixel_t
, false>;
37 using gray_alpha16_pixel_t
= pixel
<uint16_t, gray_alpha_layout_t
>;
38 using gray_alpha16_image_t
= image
<gray_alpha16_pixel_t
, false>;
40 template< typename Image
>
41 void test_file( string filename
)
45 image_read_settings
< png_tag
> settings
;
46 settings
._read_file_gamma
= true;
47 settings
._read_transparency_data
= true;
50 using backend_t
= get_reader_backend
<std::string
const, tag_t
>::type
;
52 backend_t backend
= read_image_info( png_in
+ filename
56 read_image( png_in
+ filename
62 #ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
63 image_write_info
< png_tag
> write_info
;
64 write_info
._file_gamma
= backend
._info
._file_gamma
;
66 write_view( png_out
+ filename
71 read_image( png_out
+ filename
77 BOOST_CHECK( equal_pixels( const_view( src
)
81 #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
84 template< typename Image
>
85 void test_png_scanline_reader( string filename
)
87 test_scanline_reader
<Image
, png_tag
>( string( png_in
+ filename
).c_str() );
90 BOOST_AUTO_TEST_CASE( read_header_test
)
92 using backend_t
= get_reader_backend
<std::string
const, tag_t
>::type
;
94 backend_t backend
= read_image_info( png_filename
98 BOOST_CHECK_EQUAL( backend
._info
._width
, 1000u );
99 BOOST_CHECK_EQUAL( backend
._info
._height
, 600u );
101 BOOST_CHECK_EQUAL( backend
._info
._num_channels
, 4 );
102 BOOST_CHECK_EQUAL( backend
._info
._bit_depth
, 8 );
103 BOOST_CHECK_EQUAL( backend
._info
._color_type
, PNG_COLOR_TYPE_RGBA
);
105 BOOST_CHECK_EQUAL( backend
._info
._interlace_method
, PNG_INTERLACE_NONE
);
106 BOOST_CHECK_EQUAL( backend
._info
._compression_method
, PNG_COMPRESSION_TYPE_BASE
);
107 BOOST_CHECK_EQUAL( backend
._info
._filter_method
, PNG_FILTER_TYPE_BASE
);
110 BOOST_CHECK_EQUAL( backend
._info
._file_gamma
, 1 );
113 #ifdef BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES
115 BOOST_AUTO_TEST_CASE( read_pixel_per_meter
)
117 image_read_settings
< png_tag
> settings
;
118 settings
.set_read_members_true();
120 using backend_t
= get_reader_backend
<std::string
const, tag_t
>::type
;
122 backend_t backend
= read_image_info( png_base_in
+ "EddDawson/36dpi.png"
126 BOOST_CHECK_EQUAL( backend
._info
._pixels_per_meter
, png_uint_32( 1417 ));
129 BOOST_AUTO_TEST_CASE(read_with_trns_chunk_color_type_0
)
131 // PNG 1.2: For color type 0 (grayscale), the tRNS chunk contains a single gray level value,
132 // stored in the format:
134 // Gray: 2 bytes, range 0 .. (2^bitdepth)-1
136 auto const png_path
= png_in
+ "tbbn0g04.png";
137 image_read_settings
<png_tag
> settings
;
138 settings
.set_read_members_true();
139 auto backend
= read_image_info(png_path
, settings
);
140 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
141 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
142 BOOST_CHECK_EQUAL(backend
._info
._bit_depth
, 4);
143 BOOST_CHECK_EQUAL(backend
._info
._num_channels
, 1u);
144 BOOST_CHECK_EQUAL(backend
._info
._color_type
, PNG_COLOR_TYPE_GRAY
);
146 gray_alpha8_image_t img
;
147 read_image(png_path
, img
, settings
);
148 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
149 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
150 BOOST_TEST(const_view(img
).front() == gray_alpha8c_pixel_t(255, 0));
151 BOOST_TEST(const_view(img
)[78] == gray_alpha8c_pixel_t(221, 255));
152 BOOST_TEST(const_view(img
)[79] == gray_alpha8c_pixel_t(204, 255));
153 BOOST_TEST(const_view(img
)[975] == gray_alpha8c_pixel_t(238, 255));
154 BOOST_TEST(const_view(img
)[976] == gray_alpha8c_pixel_t(221, 255));
155 BOOST_TEST(const_view(img
).back() == gray_alpha8c_pixel_t(255, 0));
158 auto const png_path
= png_in
+ "tbwn0g16.png";
159 image_read_settings
<png_tag
> settings
;
160 settings
.set_read_members_true();
161 auto backend
= read_image_info(png_path
, settings
);
162 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
163 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
164 BOOST_CHECK_EQUAL(backend
._info
._bit_depth
, 16);
165 BOOST_CHECK_EQUAL(backend
._info
._num_channels
, 1u);
166 BOOST_CHECK_EQUAL(backend
._info
._color_type
, PNG_COLOR_TYPE_GRAY
);
168 gray_alpha16_image_t img
;
169 read_image(png_path
, img
, settings
);
170 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
171 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
172 BOOST_TEST(const_view(img
).front() == gray_alpha16c_pixel_t(65535, 0));
173 BOOST_TEST(const_view(img
)[78] == gray_alpha16c_pixel_t(58339, 65535));
174 BOOST_TEST(const_view(img
)[79] == gray_alpha16c_pixel_t(51657, 65535));
175 BOOST_TEST(const_view(img
)[975] == gray_alpha16c_pixel_t(62965, 65535));
176 BOOST_TEST(const_view(img
)[976] == gray_alpha16c_pixel_t(58339, 65535));
177 BOOST_TEST(const_view(img
).back() == gray_alpha16c_pixel_t(65535, 0));
181 BOOST_AUTO_TEST_CASE(read_with_trns_chunk_color_type_2
)
183 // PNG 1.2: For color type 2 (truecolor), the tRNS chunk contains a single RGB color value,
184 // stored in the format:
186 // Red: 2 bytes, range 0 .. (2^bitdepth)-1
187 // Green: 2 bytes, range 0 .. (2^bitdepth)-1
188 // Blue: 2 bytes, range 0 .. (2^bitdepth)-1
190 auto const png_path
= png_in
+ "tbbn2c16.png";
191 image_read_settings
<png_tag
> settings
;
192 settings
.set_read_members_true();
193 auto backend
= read_image_info(png_path
, settings
);
194 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
195 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
196 BOOST_CHECK_EQUAL(backend
._info
._bit_depth
, 16);
197 BOOST_CHECK_EQUAL(backend
._info
._num_channels
, 3u);
198 BOOST_CHECK_EQUAL(backend
._info
._color_type
, PNG_COLOR_TYPE_RGB
);
201 read_image(png_path
, img
, settings
);
202 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
203 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
204 BOOST_TEST(const_view(img
).front() == rgba16c_pixel_t(65535, 65535, 65535, 0));
205 BOOST_TEST(const_view(img
)[78] == rgba16c_pixel_t(58339, 58339, 58339, 65535));
206 BOOST_TEST(const_view(img
)[79] == rgba16c_pixel_t(51657, 51657, 51657, 65535));
207 BOOST_TEST(const_view(img
)[975] == rgba16c_pixel_t(62965, 62965, 62965, 65535));
208 BOOST_TEST(const_view(img
)[976] == rgba16c_pixel_t(58339, 58339, 58339, 65535));
209 BOOST_TEST(const_view(img
).back() == rgba16c_pixel_t(65535, 65535, 65535, 0));
212 auto const png_path
= png_in
+ "tbgn2c16.png";
213 image_read_settings
<png_tag
> settings
;
214 settings
.set_read_members_true();
215 auto backend
= read_image_info(png_path
, settings
);
216 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
217 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
218 BOOST_CHECK_EQUAL(backend
._info
._bit_depth
, 16);
219 BOOST_CHECK_EQUAL(backend
._info
._num_channels
, 3u);
220 BOOST_CHECK_EQUAL(backend
._info
._color_type
, PNG_COLOR_TYPE_RGB
);
223 read_image(png_path
, img
, settings
);
224 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
225 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
226 BOOST_TEST(const_view(img
).front() == rgba16c_pixel_t(65535, 65535, 65535, 0));
227 BOOST_TEST(const_view(img
)[78] == rgba16c_pixel_t(58339, 58339, 58339, 65535));
228 BOOST_TEST(const_view(img
)[79] == rgba16c_pixel_t(51657, 51657, 51657, 65535));
229 BOOST_TEST(const_view(img
)[975] == rgba16c_pixel_t(62965, 62965, 62965, 65535));
230 BOOST_TEST(const_view(img
)[976] == rgba16c_pixel_t(58339, 58339, 58339, 65535));
231 BOOST_TEST(const_view(img
).back() == rgba16c_pixel_t(65535, 65535, 65535, 0));
234 auto const png_path
= png_in
+ "tbrn2c08.png";
235 image_read_settings
<png_tag
> settings
;
236 settings
.set_read_members_true();
237 auto backend
= read_image_info(png_path
, settings
);
238 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
239 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
240 BOOST_CHECK_EQUAL(backend
._info
._bit_depth
, 8);
241 BOOST_CHECK_EQUAL(backend
._info
._num_channels
, 3u);
242 BOOST_CHECK_EQUAL(backend
._info
._color_type
, PNG_COLOR_TYPE_RGB
);
245 read_image(png_path
, img
, settings
);
246 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
247 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
248 BOOST_TEST(const_view(img
).front() == rgba8c_pixel_t(255, 255, 255, 0));
249 BOOST_TEST(const_view(img
)[78] == rgba8c_pixel_t(227, 227, 227, 255));
250 BOOST_TEST(const_view(img
)[79] == rgba8c_pixel_t(201, 201, 201, 255));
251 BOOST_TEST(const_view(img
)[975] == rgba8c_pixel_t(245, 245, 245, 255));
252 BOOST_TEST(const_view(img
)[976] == rgba8c_pixel_t(227, 227, 227, 255));
253 BOOST_TEST(const_view(img
).back() == rgba8c_pixel_t(255, 255, 255, 0));
257 BOOST_AUTO_TEST_CASE(read_with_trns_chunk_color_type_3
)
259 // PNG 1.2: For color type 3 (indexed color), the tRNS chunk contains a series of one-byte
260 // alpha values, corresponding to entries in the PLTE chunk:
262 // Alpha for palette index 0: 1 byte
263 // Alpha for palette index 1: 1 byte
266 auto const png_path
= png_in
+ "tbbn3p08.png";
267 image_read_settings
<png_tag
> settings
;
268 settings
.set_read_members_true();
269 auto backend
= read_image_info(png_path
, settings
);
270 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
271 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
272 BOOST_CHECK_EQUAL(backend
._info
._bit_depth
, 8);
273 BOOST_CHECK_EQUAL(backend
._info
._num_channels
, 1u);
274 BOOST_CHECK_EQUAL(backend
._info
._color_type
, PNG_COLOR_TYPE_PALETTE
);
277 read_image(png_path
, img
, settings
);
278 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
279 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
280 BOOST_TEST(const_view(img
).front() == rgba8c_pixel_t(255, 255, 255, 0));
281 BOOST_TEST(const_view(img
)[78] == rgba8c_pixel_t(227, 227, 227, 255));
282 BOOST_TEST(const_view(img
)[79] == rgba8c_pixel_t(201, 201, 201, 255));
283 BOOST_TEST(const_view(img
)[975] == rgba8c_pixel_t(246, 246, 246, 255));
284 BOOST_TEST(const_view(img
)[976] == rgba8c_pixel_t(227, 227, 227, 255));
285 BOOST_TEST(const_view(img
).back() == rgba8c_pixel_t(255, 255, 255, 0));
288 auto const png_path
= png_in
+ "tbgn3p08.png";
289 image_read_settings
<png_tag
> settings
;
290 settings
.set_read_members_true();
291 auto backend
= read_image_info(png_path
, settings
);
292 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
293 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
294 BOOST_CHECK_EQUAL(backend
._info
._bit_depth
, 8);
295 BOOST_CHECK_EQUAL(backend
._info
._num_channels
, 1u);
296 BOOST_CHECK_EQUAL(backend
._info
._color_type
, PNG_COLOR_TYPE_PALETTE
);
299 read_image(png_path
, img
, settings
);
300 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
301 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
302 BOOST_TEST(const_view(img
).front() == rgba8c_pixel_t(255, 255, 255, 0));
303 BOOST_TEST(const_view(img
)[78] == rgba8c_pixel_t(227, 227, 227, 255));
304 BOOST_TEST(const_view(img
)[79] == rgba8c_pixel_t(201, 201, 201, 255));
305 BOOST_TEST(const_view(img
)[975] == rgba8c_pixel_t(246, 246, 246, 255));
306 BOOST_TEST(const_view(img
)[976] == rgba8c_pixel_t(227, 227, 227, 255));
307 BOOST_TEST(const_view(img
).back() == rgba8c_pixel_t(255, 255, 255, 0));
310 auto const png_path
= png_in
+ "tp1n3p08.png";
311 image_read_settings
<png_tag
> settings
;
312 settings
.set_read_members_true();
313 auto backend
= read_image_info(png_path
, settings
);
314 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
315 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
316 BOOST_CHECK_EQUAL(backend
._info
._bit_depth
, 8);
317 BOOST_CHECK_EQUAL(backend
._info
._num_channels
, 1u);
318 BOOST_CHECK_EQUAL(backend
._info
._color_type
, PNG_COLOR_TYPE_PALETTE
);
321 read_image(png_path
, img
, settings
);
322 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
323 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
324 BOOST_TEST(const_view(img
).front() == rgba8c_pixel_t(255, 255, 255, 0));
325 BOOST_TEST(const_view(img
)[78] == rgba8c_pixel_t(227, 227, 227, 255));
326 BOOST_TEST(const_view(img
)[79] == rgba8c_pixel_t(201, 201, 201, 255));
327 BOOST_TEST(const_view(img
)[975] == rgba8c_pixel_t(246, 246, 246, 255));
328 BOOST_TEST(const_view(img
)[976] == rgba8c_pixel_t(227, 227, 227, 255));
329 BOOST_TEST(const_view(img
).back() == rgba8c_pixel_t(255, 255, 255, 0));
332 auto const png_path
= png_in
+ "tm3n3p02.png";
333 image_read_settings
<png_tag
> settings
;
334 settings
.set_read_members_true();
335 auto backend
= read_image_info(png_path
, settings
);
336 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
337 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
338 BOOST_CHECK_EQUAL(backend
._info
._bit_depth
, 2);
339 BOOST_CHECK_EQUAL(backend
._info
._num_channels
, 1u);
340 BOOST_CHECK_EQUAL(backend
._info
._color_type
, PNG_COLOR_TYPE_PALETTE
);
343 read_image(png_path
, img
, settings
);
344 BOOST_CHECK_EQUAL(backend
._info
._width
, 32u);
345 BOOST_CHECK_EQUAL(backend
._info
._height
, 32u);
346 BOOST_TEST(const_view(img
).front() == rgba8c_pixel_t(0, 0, 255, 0));
347 BOOST_TEST(const_view(img
)[16] == rgba8c_pixel_t(0, 0, 255, 85));
348 BOOST_TEST(const_view(img
)[511] == rgba8c_pixel_t(0, 0, 255, 85));
349 BOOST_TEST(const_view(img
)[1007] == rgba8c_pixel_t(0, 0, 255, 170));
350 BOOST_TEST(const_view(img
).back() == rgba8c_pixel_t(0, 0, 255, 255));
354 #endif // BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES
356 #ifdef BOOST_GIL_IO_USE_PNG_TEST_SUITE_IMAGES
358 BOOST_AUTO_TEST_CASE( BASIc_format_test
)
360 // Basic format test files (non-interlaced)
362 // BASN0g01 - black & white
363 test_file
< gray1_image_t
>( "BASN0G01.PNG" );
364 test_png_scanline_reader
< gray1_image_t
>( "BASN0G01.PNG" );
366 // BASN0g02 - 2 bit (4 level) grayscale
367 test_file
< gray2_image_t
>( "BASN0G02.PNG" );
368 test_png_scanline_reader
< gray2_image_t
>( "BASN0G02.PNG" );
370 // BASN0g04 - 4 bit (16 level) grayscale
371 test_file
< gray4_image_t
>( "BASN0G04.PNG" );
372 test_png_scanline_reader
< gray4_image_t
>( "BASN0G04.PNG" );
374 // BASN0g08 - 8 bit (256 level) grayscale
375 test_file
< gray8_image_t
>( "BASN0G08.PNG" );
376 test_png_scanline_reader
< gray8_image_t
>( "BASN0G08.PNG" );
378 // BASN0g16 - 16 bit (64k level) grayscale
379 test_file
< gray16_image_t
>( "BASN0G16.PNG" );
380 test_png_scanline_reader
< gray16_image_t
>( "BASN0G16.PNG" );
382 // BASN2c08 - 3x8 bits rgb color
383 test_file
< rgb8_image_t
>( "BASN2C08.PNG" );
384 test_png_scanline_reader
< rgb8_image_t
>( "BASN2C08.PNG" );
386 // BASN2c16 - 3x16 bits rgb color
387 test_file
< rgb16_image_t
>( "BASN2C16.PNG" );
388 test_png_scanline_reader
< rgb16_image_t
>( "BASN2C16.PNG" );
390 // BASN3p01 - 1 bit (2 color) paletted
391 test_file
< rgb8_image_t
>( "BASN3P01.PNG" );
392 test_png_scanline_reader
< rgb8_image_t
>( "BASN3P01.PNG" );
394 // BASN3p02 - 2 bit (4 color) paletted
395 test_file
< rgb8_image_t
>( "BASN3P02.PNG" );
396 test_png_scanline_reader
< rgb8_image_t
>( "BASN3P02.PNG" );
398 // BASN3p04 - 4 bit (16 color) paletted
399 test_file
< rgb8_image_t
>( "BASN3P04.PNG" );
400 test_png_scanline_reader
< rgb8_image_t
>( "BASN3P04.PNG" );
402 // BASN3p08 - 8 bit (256 color) paletted
403 test_file
< rgb8_image_t
>( "BASN3P08.PNG" );
404 test_png_scanline_reader
< rgb8_image_t
>( "BASN3P08.PNG" );
406 // BASN4a08 - 8 bit grayscale + 8 bit alpha-channel
407 test_file
< gray_alpha8_image_t
>( "BASN4A08.PNG" );
408 test_png_scanline_reader
< gray_alpha8_image_t
>( "BASN4A08.PNG" );
410 // BASN4a16 - 16 bit grayscale + 16 bit alpha-channel
411 test_file
< gray_alpha16_image_t
>( "BASN4A16.PNG" );
412 test_png_scanline_reader
< gray_alpha16_image_t
>( "BASN4A16.PNG" );
414 // BASN6a08 - 3x8 bits rgb color + 8 bit alpha-channel
415 test_file
< rgba8_image_t
>( "BASN6A08.PNG" );
416 test_png_scanline_reader
< rgba8_image_t
>( "BASN6A08.PNG" );
418 // BASN6a16 - 3x16 bits rgb color + 16 bit alpha-channel
419 test_file
< rgba16_image_t
>( "BASN6A16.PNG" );
420 test_png_scanline_reader
< rgba16_image_t
>( "BASN6A16.PNG" );
423 BOOST_AUTO_TEST_CASE( BASIc_format_interlaced_test
)
425 // Basic format test files (Adam-7 interlaced)
427 // BASI0g01 - black & white
428 test_file
< gray1_image_t
>( "BASI0G01.PNG" );
430 // BASI0g02 - 2 bit (4 level) grayscale
431 test_file
< gray2_image_t
>( "BASI0G02.PNG" );
433 // BASI0g04 - 4 bit (16 level) grayscale
434 test_file
< gray4_image_t
>( "BASI0G04.PNG" );
436 // BASI0g08 - 8 bit (256 level) grayscale
437 test_file
< gray8_image_t
>( "BASI0G08.PNG" );
439 // BASI0g16 - 16 bit (64k level) grayscale
440 test_file
< gray16_image_t
>( "BASI0G16.PNG" );
442 // BASI2c08 - 3x8 bits rgb color
443 test_file
< rgb8_image_t
>( "BASI2C08.PNG" );
445 // BASI2c16 - 3x16 bits rgb color
446 test_file
< rgb16_image_t
>( "BASI2C16.PNG" );
448 // BASI3p01 - 1 bit (2 color) paletted
449 test_file
< rgb8_image_t
>( "BASI3P01.PNG" );
451 // BASI3p02 - 2 bit (4 color) paletted
452 test_file
< rgb8_image_t
>( "BASI3P02.PNG" );
454 // BASI3p04 - 4 bit (16 color) paletted
455 test_file
< rgb8_image_t
>( "BASI3P04.PNG" );
457 // BASI3p08 - 8 bit (256 color) paletted
458 test_file
< rgb8_image_t
>( "BASI3P08.PNG" );
460 // BASI4a08 - 8 bit grayscale + 8 bit alpha-channel
461 test_file
< gray_alpha8_image_t
>( "BASI4A08.PNG" );
463 // BASI4a16 - 16 bit grayscale + 16 bit alpha-channel
464 test_file
< gray_alpha16_image_t
>( "BASI4A16.PNG" );
466 // BASI6a08 - 3x8 bits rgb color + 8 bit alpha-channel
467 test_file
< rgba8_image_t
>( "BASI6A08.PNG" );
469 // BASI6a16 - 3x16 bits rgb color + 16 bit alpha-channel
470 test_file
< rgba16_image_t
>( "BASI6A16.PNG" );
473 BOOST_AUTO_TEST_CASE( odd_sizes_test
)
475 // S01I3P01 - 1x1 paletted file, interlaced
476 test_file
< rgb8_image_t
>( "S01I3P01.PNG" );
478 // S01N3P01 - 1x1 paletted file, no interlacing
479 test_file
< rgb8_image_t
>( "S01N3P01.PNG" );
480 test_png_scanline_reader
< rgb8_image_t
>( "S01N3P01.PNG" );
482 // S02I3P01 - 2x2 paletted file, interlaced
483 test_file
< rgb8_image_t
>( "S02I3P01.PNG" );
485 // S02N3P01 - 2x2 paletted file, no interlacing
486 test_file
< rgb8_image_t
>( "S02N3P01.PNG" );
487 test_png_scanline_reader
< rgb8_image_t
>( "S02N3P01.PNG" );
489 // S03I3P01 - 3x3 paletted file, interlaced
490 test_file
< rgb8_image_t
>( "S03I3P01.PNG" );
492 // S03N3P01 - 3x3 paletted file, no interlacing
493 test_file
< rgb8_image_t
>( "S03N3P01.PNG" );
494 test_png_scanline_reader
< rgb8_image_t
>( "S03N3P01.PNG" );
496 // S04I3P01 - 4x4 paletted file, interlaced
497 test_file
< rgb8_image_t
>( "S04I3P01.PNG" );
499 // S04N3P01 - 4x4 paletted file, no interlacing
500 test_file
< rgb8_image_t
>( "S04N3P01.PNG" );
501 test_png_scanline_reader
< rgb8_image_t
>( "S04N3P01.PNG" );
503 // S05I3P02 - 5x5 paletted file, interlaced
504 test_file
< rgb8_image_t
>( "S05I3P02.PNG" );
506 // S05N3P02 - 5x5 paletted file, no interlacing
507 test_file
< rgb8_image_t
>( "S05N3P02.PNG" );
508 test_png_scanline_reader
< rgb8_image_t
>( "S05N3P02.PNG" );
510 // S06I3P02 - 6x6 paletted file, interlaced
511 test_file
< rgb8_image_t
>( "S06I3P02.PNG" );
513 // S06N3P02 - 6x6 paletted file, no interlacing
514 test_file
< rgb8_image_t
>( "S06N3P02.PNG" );
515 test_png_scanline_reader
< rgb8_image_t
>( "S06N3P02.PNG" );
517 // S07I3P02 - 7x7 paletted file, interlaced
518 test_file
< rgb8_image_t
>( "S07I3P02.PNG" );
520 // S07N3P02 - 7x7 paletted file, no interlacing
521 test_file
< rgb8_image_t
>( "S07N3P02.PNG" );
522 test_png_scanline_reader
< rgb8_image_t
>( "S07N3P02.PNG" );
524 // S08I3P02 - 8x8 paletted file, interlaced
525 test_file
< rgb8_image_t
>( "S08I3P02.PNG" );
527 // S08N3P02 - 8x8 paletted file, no interlacing
528 test_file
< rgb8_image_t
>( "S08N3P02.PNG" );
529 test_png_scanline_reader
< rgb8_image_t
>( "S08N3P02.PNG" );
531 // S09I3P02 - 9x9 paletted file, interlaced
532 test_file
< rgb8_image_t
>( "S09I3P02.PNG" );
534 // S09N3P02 - 9x9 paletted file, no interlacing
535 test_file
< rgb8_image_t
>( "S09N3P02.PNG" );
536 test_png_scanline_reader
< rgb8_image_t
>( "S09N3P02.PNG" );
538 // S32I3P04 - 32x32 paletted file, interlaced
539 test_file
< rgb8_image_t
>( "S32I3P04.PNG" );
541 // S32N3P04 - 32x32 paletted file, no interlacing
542 test_file
< rgb8_image_t
>( "S32N3P04.PNG" );
543 test_png_scanline_reader
< rgb8_image_t
>( "S32N3P04.PNG" );
545 // S33I3P04 - 33x33 paletted file, interlaced
546 test_file
< rgb8_image_t
>( "S33I3P04.PNG" );
548 // S33N3P04 - 33x33 paletted file, no interlacing
549 test_file
< rgb8_image_t
>( "S33N3P04.PNG" );
550 test_png_scanline_reader
< rgb8_image_t
>( "S33N3P04.PNG" );
552 // S34I3P04 - 34x34 paletted file, interlaced
553 test_file
< rgb8_image_t
>( "S34I3P04.PNG" );
555 // S34N3P04 - 34x34 paletted file, no interlacing
556 test_file
< rgb8_image_t
>( "S34N3P04.PNG" );
557 test_png_scanline_reader
< rgb8_image_t
>( "S34N3P04.PNG" );
559 // S35I3P04 - 35x35 paletted file, interlaced
560 test_file
< rgb8_image_t
>( "S35I3P04.PNG" );
562 // S35N3P04 - 35x35 paletted file, no interlacing
563 test_file
< rgb8_image_t
>( "S35N3P04.PNG" );
564 test_png_scanline_reader
< rgb8_image_t
>( "S35N3P04.PNG" );
566 // S36I3P04 - 36x36 paletted file, interlaced
567 test_file
< rgb8_image_t
>( "S36I3P04.PNG" );
569 // S36N3P04 - 36x36 paletted file, no interlacing
570 test_file
< rgb8_image_t
>( "S36N3P04.PNG" );
571 test_png_scanline_reader
< rgb8_image_t
>( "S36N3P04.PNG" );
573 // S37I3P04 - 37x37 paletted file, interlaced
574 test_file
< rgb8_image_t
>( "S37I3P04.PNG" );
576 // S37N3P04 - 37x37 paletted file, no interlacing
577 test_file
< rgb8_image_t
>( "S37N3P04.PNG" );
578 test_png_scanline_reader
< rgb8_image_t
>( "S37N3P04.PNG" );
580 // S38I3P04 - 38x38 paletted file, interlaced
581 test_file
< rgb8_image_t
>( "S38I3P04.PNG" );
583 // S38N3P04 - 38x38 paletted file, no interlacing
584 test_file
< rgb8_image_t
>( "S38N3P04.PNG" );
585 test_png_scanline_reader
< rgb8_image_t
>( "S38N3P04.PNG" );
587 // S39I3P04 - 39x39 paletted file, interlaced
588 test_file
< rgb8_image_t
>( "S39I3P04.PNG" );
590 // S39N3P04 - 39x39 paletted file, no interlacing
591 test_file
< rgb8_image_t
>( "S39N3P04.PNG" );
592 test_png_scanline_reader
< rgb8_image_t
>( "S39N3P04.PNG" );
594 // S40I3P04 - 40x40 paletted file, interlaced
595 test_file
< rgb8_image_t
>( "S40I3P04.PNG" );
597 // S40N3P04 - 40x40 paletted file, no interlacing
598 test_file
< rgb8_image_t
>( "S40N3P04.PNG" );
599 test_png_scanline_reader
< rgb8_image_t
>( "S40N3P04.PNG" );
602 BOOST_AUTO_TEST_CASE( background_test
)
604 // BGAI4A08 - 8 bit grayscale, alpha, no background chunk, interlaced
605 test_file
< gray_alpha8_image_t
>( "BGAI4A08.PNG" );
607 // BGAI4A16 - 16 bit grayscale, alpha, no background chunk, interlaced
608 test_file
< gray_alpha16_image_t
>( "BGAI4A16.PNG" );
610 // BGAN6A08 - 3x8 bits rgb color, alpha, no background chunk
611 test_file
< rgba8_image_t
>( "BGAN6A08.PNG" );
613 // BGAN6A16 - 3x16 bits rgb color, alpha, no background chunk
614 test_file
< rgba16_image_t
>( "BGAN6A16.PNG" );
616 // BGBN4A08 - 8 bit grayscale, alpha, black background chunk
617 test_file
< gray_alpha8_image_t
>( "BGBN4A08.PNG" );
619 // BGGN4A16 - 16 bit grayscale, alpha, gray background chunk
620 test_file
< gray_alpha16_image_t
>( "BGGN4A16.PNG" );
622 // BGWN6A08 - 3x8 bits rgb color, alpha, white background chunk
623 test_file
< rgba8_image_t
>( "BGWN6A08.PNG" );
625 // BGYN6A16 - 3x16 bits rgb color, alpha, yellow background chunk
626 test_file
< rgba16_image_t
>( "BGYN6A16.PNG" );
629 BOOST_AUTO_TEST_CASE( transparency_test
)
631 // TBBN1G04 - transparent, black background chunk
633 //test_file< gray_alpha8_image_t >( "TBBN1G04.PNG" );
635 // TBBN2C16 - transparent, blue background chunk
636 test_file
< rgba16_image_t
>( "TBBN2C16.PNG" );
638 // TBBN3P08 - transparent, black background chunk
639 test_file
< rgba8_image_t
>( "TBBN3P08.PNG" );
641 // TBGN2C16 - transparent, green background chunk
642 test_file
< rgba16_image_t
>( "TBGN2C16.PNG" );
644 // TBGN3P08 - transparent, light-gray background chunk
645 test_file
< rgba8_image_t
>( "TBGN3P08.PNG" );
647 // TBRN2C08 - transparent, red background chunk
648 test_file
< rgba8_image_t
>( "TBRN2C08.PNG" );
650 // TBWN1G16 - transparent, white background chunk
651 test_file
< gray_alpha16_image_t
>( "TBWN0G16.PNG" );
653 // TBWN3P08 - transparent, white background chunk
654 test_file
< rgba8_image_t
>( "TBWN3P08.PNG" );
656 // TBYN3P08 - transparent, yellow background chunk
657 test_file
< rgba8_image_t
>( "TBYN3P08.PNG" );
659 // TP0N1G08 - not transparent for reference (logo on gray)
660 test_file
< gray8_image_t
>( "TP0N0G08.PNG" );
662 // TP0N2C08 - not transparent for reference (logo on gray)
663 test_file
< rgb8_image_t
>( "TP0N2C08.PNG" );
665 // TP0N3P08 - not transparent for reference (logo on gray)
666 test_file
< rgb8_image_t
>( "TP0N3P08.PNG" );
668 // TP1N3P08 - transparent, but no background chunk
669 test_file
< rgba8_image_t
>( "TP1N3P08.PNG" );
672 BOOST_AUTO_TEST_CASE( gamma_test
)
674 // G03N0G16 - grayscale, file-gamma = 0.35
675 test_file
< gray16_image_t
>( "G03N0G16.PNG" );
677 // G03N2C08 - color, file-gamma = 0.35
678 test_file
< rgb8_image_t
>( "G03N2C08.PNG" );
680 // G03N3P04 - paletted, file-gamma = 0.35
681 test_file
< rgb8_image_t
>( "G03N3P04.PNG" );
683 // G04N0G16 - grayscale, file-gamma = 0.45
684 test_file
< gray16_image_t
>( "G04N0G16.PNG" );
686 // G04N2C08 - color, file-gamma = 0.45
687 test_file
< rgb8_image_t
>( "G04N2C08.PNG" );
689 // G04N3P04 - paletted, file-gamma = 0.45
690 test_file
< rgb8_image_t
>( "G04N3P04.PNG" );
692 // G05N0G16 - grayscale, file-gamma = 0.55
693 test_file
< gray16_image_t
>( "G05N0G16.PNG" );
695 // G05N2C08 - color, file-gamma = 0.55
696 test_file
< rgb8_image_t
>( "G05N2C08.PNG" );
698 // G05N3P04 - paletted, file-gamma = 0.55
699 test_file
< rgb8_image_t
>( "G05N3P04.PNG" );
701 // G07N0G16 - grayscale, file-gamma = 0.70
702 test_file
< gray16_image_t
>( "G07N0G16.PNG" );
704 // G07N2C08 - color, file-gamma = 0.70
705 test_file
< rgb8_image_t
>( "G07N2C08.PNG" );
707 // G07N3P04 - paletted, file-gamma = 0.70
708 test_file
< rgb8_image_t
>( "G07N3P04.PNG" );
710 // G10N0G16 - grayscale, file-gamma = 1.00
711 test_file
< gray16_image_t
>( "G10N0G16.PNG" );
713 // G10N2C08 - color, file-gamma = 1.00
714 test_file
< rgb8_image_t
>( "G10N2C08.PNG" );
716 // G10N3P04 - paletted, file-gamma = 1.00
717 test_file
< rgb8_image_t
>( "G10N3P04.PNG" );
719 // G25N0G16 - grayscale, file-gamma = 2.50
720 test_file
< gray16_image_t
>( "G25N0G16.PNG" );
722 // G25N2C08 - color, file-gamma = 2.50
723 test_file
< rgb8_image_t
>( "G25N2C08.PNG" );
725 // G25N3P04 - paletted, file-gamma = 2.50
726 test_file
< rgb8_image_t
>( "G25N3P04.PNG" );
729 #endif // BOOST_GIL_IO_USE_PNG_TEST_SUITE_IMAGES
731 BOOST_AUTO_TEST_SUITE_END()