Commit 669a9a33 authored by Bryce Hepner's avatar Bryce Hepner

Tests on lwz

parent 98603e37
......@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
......@@ -15,7 +15,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 4,
"metadata": {},
"outputs": [
{
......@@ -23,7 +23,7 @@
"output_type": "stream",
"text": [
"262\n",
"0.39837348558217806\n"
"0.3968581030135283\n"
]
}
],
......@@ -43,8 +43,8 @@
" else:\n",
" newname = images[i][:-4]\n",
" newnamesforlater.append(newname + \"_Compressed.txt\")\n",
" with open(newname + \"_Compressed.txt\", 'wb') as f:\n",
" f.write(inletters)\n",
" # with open(newname + \"_Compressed.txt\", 'wb') as f:\n",
" # f.write(inletters)\n",
" file_sizes_new.append((os.path.getsize(newname + \"_Compressed.txt\")))\n",
" file_sizes_old.append((os.path.getsize(images[i])))\n",
"file_sizes_new.append(os.path.getsize(\"first_dic.npy\"))\n",
......@@ -53,7 +53,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 5,
"metadata": {},
"outputs": [
{
......@@ -145,6 +145,46 @@
"print((np.sum(pngsizes) - np.sum(file_sizes_new))/np.sum(pngsizes))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"from PIL import TiffTags\n",
"TiffTags.LIBTIFF_CORE.add(318)\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.6185872808807661\n"
]
}
],
"source": [
"lwz_sizes = []\n",
"for i, filename in enumerate(images):\n",
" newimage = Image.open(filename)\n",
" newimage.save(newnamesforlater[i][:-4]+ \"lzw\" + \".tiff\", compression='tiff_lzw', tiffinfo={317: 2})\n",
"\n",
" lwz_sizes.append(os.path.getsize(newnamesforlater[i][:-4]+ \"lzw\" + \".tiff\"))\n",
"print(np.sum(lwz_sizes)/np.sum(file_sizes_old))"
]
},
{
"cell_type": "code",
"execution_count": null,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment