Created
April 6, 2017 07:54
-
-
Save usagi/1d9301fc6378bdbc8ce2f581662a2c0d to your computer and use it in GitHub Desktop.
libpng を使ったアプリが実行時に `libpng warning: Interlace handling should be turned on when using png_read_image` を吐いてくれる時の正しい対処法 ref: http://qiita.com/usagi/items/c607fb833fdd63929d33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
libpng warning: Interlace handling should be turned on when using png_read_image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
// 本件で欲しい情報 | |
int interlace_type = PNG_INTERLACE_NONE; | |
// 情報が要らないところは nullptr を渡す仕様 | |
png_get_IHDR | |
( png.get() | |
, nullptr // info | |
, &width | |
, &height | |
, &bits_per_element | |
, &color_type | |
, &interlace_type | |
, nullptr // compression_type | |
, nullptr //filter_type | |
); | |
... | |
// 本件に必要な修正 | |
if ( interlace_type != PNG_INTERLACE_NONE ) | |
png_set_interlace_handling( png.get() ); | |
... | |
// read | |
png_read_image( png.get(), rows.data() ); | |
png_read_end( png.get(), nullptr ); | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment