Public
Edited
Jan 12, 2023
Insert cell
Insert cell
Insert cell
Insert cell
json.map(o => o.production ).filter(s => !(/q_auto\:eco/.test(s)) )
Insert cell
json[12]
Insert cell
curlCommand = o => {
return `
curl --head -s "${ o.production }" | grep
curl "${ o.production }" -s -o "./production/${ o.basename }.avif" -H 'Accept: image/avif,image/webp,*/*';
sleep 1;
curl "${ o.q_auto_low }" -s -o "./q_auto_low/${ o.basename }.avif" -H 'Accept: image/avif,image/webp,*/*';
sleep 1;
curl "${ o.q_auto_eco }" -s -o "./q_auto_eco/${ o.basename }.avif" -H 'Accept: image/avif,image/webp,*/*';
sleep 1;
curl "${ o.speedsize }" -s -o "./speedsize/${ o.basename }.avif" -H 'Accept: image/avif,image/webp,*/*';
sleep 1;
curl "${ o.original }" -s -o "./original/${ o.basename }.${ o.original_extension }";
sleep 1;`
}
Insert cell
json.map( o => curlCommand(o)).join('\n')
Insert cell
shitlist = [ '12Havells_jpg9010293735454',
'1Apple_jpg9010266374174',
'Cr1oma_jpg9010416123934',
'DELL_jpg9010279350302',
'HP_jpg9010337251358',
'L1G_jpg9010378440734',
'Lenovo_jpg9010378375198',
'Oppo_jpg9010385780766' ]
Insert cell
compares = json.map( o => o.basename ).filter(s => !( shitlist.includes(s) ) )
Insert cell
types = ['q_auto_eco', 'q_auto_low', 'speedsize', 'production']
Insert cell
ssimulacra2 = compares.map( n =>
types.map( t => `echo -e "${t}/${n}\t$(/ssimulacra2/build/ssimulacra2 original/${n}.png ${t}/${n}.png)" >> scores.txt`).join('\n')
).join('\n')

Insert cell
butteraugli = compares.map( n =>
types.map( t => `echo -e "${t}/${n}\t$(/butteraugli/butteraugli/butteraugli original/${n}.png ${t}/${n}.png)" >> butteraugli.txt`).join('\n')
).join('\n')
Insert cell
dssim = compares.map( n =>
types.map( t => `echo -e "${t}/${n}\t$(dssim original/${n}.png ${t}/${n}.png)" >> dssim.txt`).join('\n')
).join('\n')
Insert cell
dimensions = compares.map( n =>
types.map( t => `echo -e "${t}/${n}\t$(identify -format "%wx%h\n" ${t}/${n}.png)" >> dimensions.txt`).join('\n')
).join('\n')
Insert cell
Insert cell
bytes_output_processed = bytes_output.split('\n').filter( s => s.match( /\s*(\d+)\s(.+)/ ) ).map( s => {
const matched = s.match( /\s*(\d+)\s(.+)/ );
const bytes = matched[1];
const name = matched[2];
const splitname = name.split('.');
const basename = splitname.slice(0, splitname.length - 1).join('.');
const extension = splitname[ splitname.length - 1 ];
return { basename, extension, bytes }
} )
Insert cell
unique_bytes_names = bytes_output_processed.reduce( (acc, cv) => {
if ( acc.includes( cv.basename ) ) {
return acc;
} else {
return acc.concat( [ cv.basename ] );
}
}, [] )
Insert cell
bytes_objs = unique_bytes_names.map( name => {
const not_a_png = bytes_output_processed.find( o => o.basename === name && o.extension !== 'png' );
if (not_a_png) { return not_a_png }
else return bytes_output_processed.find( o => o.basename === name )
} )
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
production = joined.filter( o => o.type === 'production' );
Insert cell
q_auto_eco = joined.filter( o => o.type === 'q_auto_eco' );
Insert cell
q_auto_low = joined.filter( o => o.type === 'q_auto_low' );
Insert cell
speedsize = joined.filter( o => o.type === 'speedsize' );
Insert cell
speedsize.reduce( (acc, cv) => acc += parseInt( cv.bytes ), 0 )
Insert cell
q_auto_eco.reduce( (acc, cv) => acc += parseInt( cv.bytes ), 0 )
Insert cell
q_auto_low.reduce( (acc, cv) => acc += parseInt( cv.bytes ), 0 )
Insert cell
compressed = joined.filter(d => ['q_auto_eco', 'q_auto_low', 'speedsize'].includes(d.type))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more