Re: JPEG quantization tables and progressive scan scripts
Posted: 2013-10-14T23:02:22-07:00
by savyan
doubt in convert -define:jpeg q-table=myQTable.xml (ver 6.8.7-0)
First i executed the following command:
convert -define jpeg:q-table=myQTables.xml lena512.bmp testing6.jpeg
after executing i displayed the qtable using exiftool and using python both shows which is not the one i gave in the myQTables.xml:
3, 2, 2, 2, 2, 2, 3, 2,
2, 3, 4, 3, 3, 3, 4, 5,
4, 3, 3, 4, 5, 7, 5, 4,
4, 4, 5, 7, 12, 7, 6, 5,
5, 6, 7, 12, 12, 8, 7, 6,
7, 8, 12, 13, 10, 9, 9, 10,
13, 16, 13, 12, 13, 16, 21, 18,
18, 21, 28, 27, 28, 43, 43, 68
but the expected values were
16, 12, 14, 17, 22, 30, 45, 72,
12, 13, 14, 17, 22, 31, 46, 74,
14, 14, 16, 19, 25, 35, 52, 83,
17, 17, 19, 23, 30, 41, 62, 100,
22, 22, 25, 30, 39, 54, 80, 129,
30, 31, 35, 41, 54, 74, 111, 178,
45, 46, 52, 62, 80, 111, 166, 267,
72, 74, 83, 100, 129, 178, 267, 428
i tried with different values in myQTables.xml thecompressed file size is changing each time but the qtable is wrong
I set myQTables.xml as this
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE quantization-tables [
<!ELEMENT quantization-tables (table)+>
<!ELEMENT table (description , levels)>
<!ELEMENT description (CDATA)>
<!ELEMENT levels (CDATA)>
<!ATTLIST table slot ID #REQUIRED>
<!ATTLIST levels width CDATA #REQUIRED>
<!ATTLIST levels height CDATA #REQUIRED>
<!ATTLIST levels divisor CDATA #REQUIRED>
]>
<!--
JPEG quantization tables.
-->
<quantization-tables>
<table slot="0" alias="luminance">
<description>Luminance Quantization Table</description>
<levels width="8" height="8" divisor="1">
16, 12, 14, 17, 22, 30, 45, 72,
12, 13, 14, 17, 22, 31, 46, 74,
14, 14, 16, 19, 25, 35, 52, 83,
17, 17, 19, 23, 30, 41, 62, 100,
22, 22, 25, 30, 39, 54, 80, 129,
30, 31, 35, 41, 54, 74, 111, 178,
45, 46, 52, 62, 80, 111, 166, 267,
72, 74, 83, 100, 129, 178, 267, 428
</levels>
</table>
<table slot="1" alias="chrominance">
<description>Chrominance Quantization Table</description>
<levels width="8" height="8" divisor="1">
17, 18, 22, 31, 50, 92, 193, 465,
18, 19, 24, 33, 54, 98, 207, 498,
22, 24, 29, 41, 66, 120, 253, 609,
31, 33, 41, 57, 92, 169, 355, 854,
50, 54, 66, 92, 148, 271, 570, 1370,
92, 98, 120, 169, 271, 498, 1046, 2516,
193, 207, 253, 355, 570, 1046, 2198, 5289,
465, 498, 609, 854, 1370,2516, 5289, 12725
</levels>
</table>
</quantization-tables>
what is the problem?
Re: JPEG quantization tables and progressive scan scripts
Posted: 2013-10-14T23:19:50-07:00
by savyan
The following python code also gave same result:
from PIL import Image
tst6=Image.open('testing6.jpeg')
print "testing6 QT table"
print tst6.quantization
its output is also:
testing6 QT table
{0: array('b', [3, 2, 2, 2, 2, 2, 3, 2, 2, 3, 4, 3, 3, 3, 4, 5, 4, 3, 3, 4, 5, 7, 5, 4, 4, 4, 5, 7, 12, 7, 6, 5, 5, 6, 7, 12, 12, 8, 7, 6, 7, 8, 12, 13, 10, 9, 9, 10, 13, 16, 13, 12, 13, 16, 21, 18, 18, 21, 28, 27, 28, 43, 43, 68])}
L
('L',)