Created
November 15, 2018 14:46
-
-
Save jbweston/3eb6b2cd06f804bc5e5e6901e758ba50 to your computer and use it in GitHub Desktop.
Test for compatibility between pylibdmtx and libdmtx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export LD_LIBRARY_PATH=$(pwd)/.libs | |
make -j8 2>/dev/null >/dev/null | |
if [ $? != 0 ]; then | |
exit 125 | |
fi | |
python 2>/dev/null << EOF | |
from pystrich.datamatrix import DataMatrixEncoder | |
import PIL | |
from io import BytesIO | |
from pylibdmtx.pylibdmtx import decode | |
data = 'SomeStringWithData' | |
image_bytes = DataMatrixEncoder(data).get_imagedata(cellsize=2) | |
image = PIL.Image.open(BytesIO(image_bytes)) | |
results, = decode(image) | |
assert results.data == data.encode(), (results.data, data.encode()) | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment