[Image-SIG] Manipulating JPEGs w/out decompressing?

Chris Cogdon chris at cogdon.org
Mon Jan 26 17:35:19 EST 2004

On Jan 26, 2004, at 12:35, Smurf wrote:

> Hi,
> Chris Cogdon:
>> The way that I understand JPEG is that the encoding for any particular
>> pixel depends on 'state' that is set up from the previous pixels. In
>> other words, if you were to crop off 1 or 2 pixels at the left hand
>> side of the image, all the following pixels MUST be re-encoded... 
>> which
>> means you get the re-compression that you were trying to avoid.
>> Doubly so for rotations.
> JPEG is based on 8x8 cells. (Hence the blocky artefacts.)
> So you can in fact chop them by 8-pixel boundaries, and 90-degree 
> rotate
> them by swapping the coefficients in the individual blocks as well as
> the blocks themselves, and probably some other minor stuff.

I don't think it's as simple as that.

Firstly, even within the 8x8 cells, you need to rotate THAT as an 
element, meaning the association within the surrounding pixels is 

Secondly, there is SOME 'holistic information' kept from cell to cell, 
or at least across the entire picture; I've seen corrupted JPEGs where 
the 'base colour' after a particular point has gone wildly awry.

So... while I think it's a great goal, I believe doing editing beyond 
simply adding or subtracting profile information cannot be achieved 
without decoding then encoding again.

    ("`-/")_.-'"``-._        Chris Cogdon <chris at cogdon.org>
     . . `; -._    )-;-,_`)
    (v_,)'  _  )`-.\  ``-'
   _.- _..-_/ / ((.'
((,.-'   ((,/   fL

More information about the Image-SIG mailing list