Skip to content

Instantly share code, notes, and snippets.

@usagi
Created April 6, 2017 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save usagi/1d9301fc6378bdbc8ce2f581662a2c0d to your computer and use it in GitHub Desktop.
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
libpng warning: Interlace handling should be turned on when using png_read_image
...
// 本件で欲しい情報
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