amazon s3 - Why do Android captured PNG's throw errors on attempt to render into Prawn PDF -
i have ios/android app requires user sign on screen app captures screenshot of signature. in situations, process works fine. in few situations, related samsung android phones, on server when attempt render s3 stored screenshot phone, prawn pdf throws below error.
zlib::inflate.inflate(@img_data) zlib::dataerror: incorrect data check
i wasn't able more error information decided dig in , more closely @ underlying data of file. first attempt open file imagemagick.
imagemagick create image file object referenced below,
#<minimagick::image:0x007f83b47c9bf8 @path="/var/folders/g2/57tbfl691hg1gyqjkgy4vd6m0000gn/t/mini_magick20150713-2121-6y1as5.png", @tempfile=#<tempfile:/var/folders/g2/57tbfl691hg1gyqjkgy4vd6m0000gn/t/mini_magick20150713-2121-6y1as5.png (closed)>, @info=#<minimagick::image::info:0x007f83b47c9bd0 @path="/var/folders/g2/57tbfl691hg1gyqjkgy4vd6m0000gn/t/mini_magick20150713-2121-6y1as5.png", @info={"raw:%m %w %h %b"=>"png 2560 970 59926b", "format"=>"png", "width"=>2560, "height"=>970, "dimensions"=>[2560, 970], "size"=>59926}>>
when attempted basic image file operation think of, ie, convert png jpg, received below error, references idat data check being incorrect, behavior consistent error prawn ie, 'incorrect data check'.
minimagick::error: `convert /var/folders/g2/57tbfl691hg1gyqjkgy4vd6m0000gn/t/mini_magick20150713-29731-1urceop.png[0] /var/folders/g2/57tbfl691hg1gyqjkgy4vd6m0000gn/t/mini_magick20150713-29731-10i6sg1.jpg` failed error: convert: idat: incorrect data check `/var/folders/g2/57tbfl691hg1gyqjkgy4vd6m0000gn/t/mini_magick20150713-29731-1urceop.png' @ warning/png.c/magickpngwarninghandler/1831.
i'm unclear how verify expected value of idat or how interpret patterns might indicate data corrupt. below meta data image causing prawn crash.
{"x-amz-id-2"=>"bxkvr2k45l6zhsv31aq6th3ocbp5c9ncv0fd1zloh5ow5d0pqht1i+za3eaat/tezlzqfoyr43e=", "x-amz-request-id"=>"69601e81d15125ad", "date"=>"mon, 13 jul 2015 20:29:00 gmt", "last-modified"=>"mon, 13 jul 2015 19:14:49 gmt", "etag"=>"\"fe1da1ea421864ddadde17147bbb82a9\"", "accept-ranges"=>"bytes", "content-type"=>"image/png", "content-length"=>"59926", "server"=>"amazons3"}
the code being used on android capture screenshot below.
original_image = cropimageview.getcroppedimage() bytearrayoutputstream stream = new bytearrayoutputstream(); original_image.compress(bitmap.compressformat.png, 100, stream); byte[] bytearray = stream.tobytearray(); stream.close();
in general, files being captured being captured, stored , retrieved attempt process these particular files causes prawn error. i'm unclear direction take debugging , input on how proceed.
an example image captured samsung android galaxy note 4 running android 5.0.1 stored here, https://s3-us-west-2.amazonaws.com/bcamarda/original_broken.png reference , or tinkering if desired.
Comments
Post a Comment