diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2022-05-28 12:54:55 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2022-05-28 12:54:55 -0600 |
| commit | a1a14a2d7b9b97b19bd2a1d6b38c14361e766d9b (patch) | |
| tree | 2eb56de836f7dd975fc9c79f5e2d72f2e1482678 | |
| parent | b3d6ca814bcd5c0dc0a4d5c8c699fb6d0ea81a7d (diff) | |
slightly optimize code for reading depth of PNG image
| -rw-r--r-- | lib/asciidoctor/pdf/ext/prawn-gmagick.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/asciidoctor/pdf/ext/prawn-gmagick.rb b/lib/asciidoctor/pdf/ext/prawn-gmagick.rb index 4b519579..71bea13a 100644 --- a/lib/asciidoctor/pdf/ext/prawn-gmagick.rb +++ b/lib/asciidoctor/pdf/ext/prawn-gmagick.rb @@ -12,9 +12,7 @@ Gmagick.prepend (Module.new do if bits != 8 && (GMagick::Image.format image_blob) == 'PNG' (io = StringIO.new image_blob).read 8 chunk_size = io.read 4 - if (io.read 4) == 'IHDR' - self.bits = ((io.read chunk_size.unpack1 'N').unpack 'NNCCCCC')[2] - end + self.bits = ((io.read chunk_size.unpack1 'N').unpack 'NNC')[-1] if (io.read 4) == 'IHDR' end end end) if defined? GMagick::Image |
