Unfinished work to create a jpg optimiser