var _PdfJpxImage = /** @class */ (function () {
    function _PdfJpxImage() {
    }
    _PdfJpxImage.prototype._parseImageProperties = function (stream) {
        var newByte = stream.getByte();
        while (newByte >= 0) {
            var oldByte = newByte;
            newByte = stream.getByte();
            var code = (oldByte << 8) | newByte;
            if (code === 0xff51) {
                stream.skip(4);
                var Xsiz = stream.getInt32() >>> 0; // Byte 4
                var Ysiz = stream.getInt32() >>> 0; // Byte 8
                var XOsiz = stream.getInt32() >>> 0; // Byte 12
                var YOsiz = stream.getInt32() >>> 0; // Byte 16
                stream.skip(16);
                var Csiz = stream.getUnsignedInteger16(); // Byte 36
                return {
                    width: Xsiz - XOsiz,
                    height: Ysiz - YOsiz,
                    bitsPerComponent: 8,
                    componentsCount: Csiz
                };
            }
        }
        throw new Error('No size marker found in JPX stream');
    };
    return _PdfJpxImage;
}());
export { _PdfJpxImage };
