Skip to content
This repository was archived by the owner on Mar 22, 2019. It is now read-only.
This repository was archived by the owner on Mar 22, 2019. It is now read-only.

Performance issue on ZendPdf\Resource\Image\Png with Alpha filter #18

@bastnic

Description

@bastnic

Hi,

I encounter very serious performance trouble with this file : https://github.com/zendframework/ZendPdf/blob/master/library/ZendPdf/Resource/Image/Png.php#L233

            case self::PNG_CHANNEL_RGB_ALPHA:
                /*
                 * To decode PNG's with alpha data we must create two images from one. One image will contain the RGB data
                 * the other will contain the Gray transparency overlay data. The former will become the object data and the latter
                 * will become the Shadow Mask (SMask).
                 */
[…]
                //Iterate every pixel and copy out rgb data and alpha channel (this will be slow)
                for($pixel = 0, $pixelcount = ($width * $height); $pixel < $pixelcount; $pixel++) {
                    $imageDataTmp .= $pngDataRawDecoded[($pixel*4)+0] . $pngDataRawDecoded[($pixel*4)+1] . $pngDataRawDecoded[($pixel*4)+2];
                    $smaskData .= $pngDataRawDecoded[($pixel*4)+3];
                }

I found two mentions on the great internet:

In the first article there is a mention of parsers being recoded. 6 years later and no trace of that change. Is there any plan on this bug?

See ya. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions