Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compression > #204

Re: removing predictable crap from poor quality jpegs

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!news.n-ix.net!news.belwue.de!rz.uni-karlsruhe.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail
From human <noreply@elfavo.com>
Newsgroups comp.compression
Subject Re: removing predictable crap from poor quality jpegs
Date Tue, 03 May 2011 13:53:59 +0200
Organization humanity
Lines 52
Message-ID <4DBFECD7.A3180162@elfavo.com> (permalink)
References <877ha8xeex.fsf@bazspaz.fatphil.org>
NNTP-Posting-Host port-92-195-180-235.dynamic.qsc.de
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Trace online.de 1304423558 23705 92.195.180.235 (3 May 2011 11:52:38 GMT)
X-Complaints-To abuse@einsundeins.com
NNTP-Posting-Date Tue, 3 May 2011 11:52:38 +0000 (UTC)
X-Mailer Mozilla 4.78 [de] (Windows NT 5.0; U)
X-Accept-Language de
Xref x330-a1.tempe.blueboxinc.net comp.compression:204

Show key headers only | View raw


Phil Carmody wrote:
> 
> I just need to strip all non-zero (8,8) coefficients from the file. Is
> there a utility that can do that? One that otherwise doesn't change
> the file would be best.
> 
> One idea was to use jpegtran -scale 7/8 | jpegtran -scale 8/7 to
> just remove all of the (x,8) and (8,y) coefficients. Which is more
> than I need, but probably causes no losses of other frequencies that
> I would object to. Can anyone see any downsides to that? (The results
> look like an improvement to me.)

That is a good idea for quick application, but there is a better
solution.
One other (minor) downside of this approach is that it doesn't
retain odd image dimensions exactly in the process of rescaling.

Here is what I recommend:
Write a custom scan script as follows (create a file "scans.txt"
for example):

  # Interleaved DC scan for Y,Cb,Cr:
  0,1,2: 0-0,  0, 0 ;
  # AC scans for all AC coefficients, except the last one:
  0:     1-62, 0, 0 ;  # Y
  1:     1-62, 0, 0 ;  # Cb
  2:     1-62, 0, 0 ;  # Cr

Then use the following command:

  jpegtran -scans scans.txt | jpegtran

This will create an intermediate "incomplete" progressive JPEG file
in the first stage, which will then be restored to standard sequential
JPEG in the second stage (jpegtran might emit warnings).

This is for color images.  Grayscale is even simpler, you just remove
the Cb/Cr parts (component indices 1,2):

  # DC scan for Y:
  0: 0-0,  0, 0 ;
  # AC scan for all Y AC coefficients, except the last one:
  0: 1-62, 0, 0 ;

With this approach you can remove any coefficient(s) you want.
In your case this just happens to be the last coefficient in the
zig-zag sequence (index 63, which appears in "complete" scripts,
see file "wizard.txt" in the IJG distribution for more information
and examples about scan scripts).

ciao
human

Back to comp.compression | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

removing predictable crap from poor quality jpegs Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-05-03 13:32 +0300
  Re: removing predictable crap from poor quality jpegs human <noreply@elfavo.com> - 2011-05-03 13:53 +0200
    Re: removing predictable crap from poor quality jpegs Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-05-03 16:09 +0100
      Re: removing predictable crap from poor quality jpegs human <noreply@elfavo.com> - 2011-05-03 18:10 +0200
        Re: removing predictable crap from poor quality jpegs human <noreply@elfavo.com> - 2011-05-03 18:32 +0200
  Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-03 06:22 -0700
    Re: removing predictable crap from poor quality jpegs Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-05-03 18:03 +0300
      Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-05 04:18 -0700
        Re: removing predictable crap from poor quality jpegs human <noreply@elfavo.com> - 2011-05-05 13:35 +0200
          Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-06 00:23 -0700
            Re: removing predictable crap from poor quality jpegs human <noreply@elfavo.com> - 2011-05-06 14:24 +0200
              Re: removing predictable crap from poor quality jpegs Thomas Richter <thor@math.tu-berlin.de> - 2011-05-06 20:33 +0200
                Re: removing predictable crap from poor quality jpegs human <noreply@elfavo.com> - 2011-05-08 09:52 +0200
                Re: removing predictable crap from poor quality jpegs Thomas Richter <thor@math.tu-berlin.de> - 2011-05-08 15:27 +0200
                Re: removing predictable crap from poor quality jpegs human <noreply@elfavo.com> - 2011-05-08 17:55 +0200
                Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-08 07:56 -0700
                Re: removing predictable crap from poor quality jpegs human <noreply@elfavo.com> - 2011-05-08 18:44 +0200
                Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-08 10:21 -0700
                Re: removing predictable crap from poor quality jpegs human <noreply@elfavo.com> - 2011-05-09 10:51 +0200
                Re: removing predictable crap from poor quality jpegs Thomas Richter <thor@math.tu-berlin.de> - 2011-05-09 11:49 +0200
                Re: removing predictable crap from poor quality jpegs human <noreply@elfavo.com> - 2011-05-09 12:06 +0200
                Re: removing predictable crap from poor quality jpegs Thomas Richter <thor@math.tu-berlin.de> - 2011-05-09 15:29 +0200
                Re: removing predictable crap from poor quality jpegs Guido Vollbeding <gv@uc.ag> - 2011-05-09 16:03 +0200
                Re: removing predictable crap from poor quality jpegs human <noreplay@elfavo.com> - 2011-05-09 22:01 +0200
                Re: removing predictable crap from poor quality jpegs Thomas Richter <thor@math.tu-berlin.de> - 2011-05-09 23:24 +0200
                Re: removing predictable crap from poor quality jpegs human <noreplay@elfavo.com> - 2011-05-10 16:45 +0200
                Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-09 04:15 -0700
                Re: removing predictable crap from poor quality jpegs human <noreplay@elfavo.com> - 2011-05-09 14:26 +0200
                Re: removing predictable crap from poor quality jpegs Thomas Richter <thor@math.tu-berlin.de> - 2011-05-09 15:51 +0200
                Re: removing predictable crap from poor quality jpegs human <noreplay@elfavo.com> - 2011-05-09 21:09 +0200
                Re: removing predictable crap from poor quality jpegs Thomas Richter <thor@math.tu-berlin.de> - 2011-05-09 22:28 +0200
                Re: removing predictable crap from poor quality jpegs human <noreplay@elfavo.com> - 2011-05-09 23:06 +0200
                Re: removing predictable crap from poor quality jpegs Thomas Richter <thor@math.tu-berlin.de> - 2011-05-10 17:34 +0200
                Re: removing predictable crap from poor quality jpegs human <noreplay@elfavo.com> - 2011-05-12 15:01 +0200
                Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-09 09:40 -0700
                Re: removing predictable crap from poor quality jpegs human <noreplay@elfavo.com> - 2011-05-09 20:23 +0200
                Re: removing predictable crap from poor quality jpegs Thomas Richter <thor@math.tu-berlin.de> - 2011-05-09 22:37 +0200
                Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-10 02:27 -0700
                Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-10 05:01 -0700
                Re: removing predictable crap from poor quality jpegs human <noreplay@elfavo.com> - 2011-05-12 15:51 +0200
                Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-13 05:07 -0700
                Re: removing predictable crap from poor quality jpegs human <noreplay@elfavo.com> - 2011-05-13 14:39 +0200
                Re: removing predictable crap from poor quality jpegs human <noreplay@elfavo.com> - 2011-05-13 15:39 +0200
                Re: removing predictable crap from poor quality jpegs human <noreplay@elfavo.com> - 2011-05-13 16:36 +0200
                Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-13 08:52 -0700
                Re: removing predictable crap from poor quality jpegs human <noreplay@elfavo.com> - 2011-05-13 19:00 +0200
                Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-13 10:07 -0700
                Re: removing predictable crap from poor quality jpegs human <noreplay@elfavo.com> - 2011-05-13 17:25 +0200
                Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-13 10:06 -0700
                Re: removing predictable crap from poor quality jpegs Pete Fraser <pfraser@covad.net> - 2011-05-13 18:17 -0700
                Re: removing predictable crap from poor quality jpegs Guido Vollbeding <guido@jpegclub.org> - 2011-05-14 09:16 +0200
                Re: removing predictable crap from poor quality jpegs Guido Vollbeding <guido@jpegclub.org> - 2011-05-14 10:07 +0200
                Re: removing predictable crap from poor quality jpegs Guido Vollbeding <guido@jpegclub.org> - 2011-05-14 19:52 +0200
                Re: removing predictable crap from poor quality jpegs Guido Vollbeding <guido@jpegclub.org> - 2011-05-14 21:08 +0200
                Re: removing predictable crap from poor quality jpegs Guido Vollbeding <guido@jpegclub.org> - 2011-05-16 08:43 +0200
                Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-16 05:15 -0700
                Re: removing predictable crap from poor quality jpegs Thomas Richter <thor@math.tu-berlin.de> - 2011-05-16 17:00 +0200
                Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-16 13:02 -0700
                Re: removing predictable crap from poor quality jpegs Thomas Richter <thor@math.tu-berlin.de> - 2011-05-17 09:43 +0200
                Re: removing predictable crap from poor quality jpegs Sebastian <s.gesemann@gmail.com> - 2011-05-19 02:55 -0700
                Re: removing predictable crap from poor quality jpegs Noob <root@127.0.0.1> - 2011-05-20 13:23 +0200
                Re: removing predictable crap from poor quality jpegs Pete Fraser <pfraser@covad.net> - 2011-05-20 05:38 -0700
                Re: removing predictable crap from poor quality jpegs human <noreplay@elfavo.com> - 2011-05-12 20:15 +0200

csiph-web