0

I have an image with grayscale background and 2 thin lines (1 pixel wide) drawn in color. I'm trying to use various JPEG compression table (luminance and chrominance) to get the best possible result while staying under a certain file size. The grayscale background compresses well and looks decent. The thin vertical and horizontal color lines get mutilated / smeared. The current JPEG algorithm uses 2x2 sub-sampling on the Cb and Cr channels and the chrominance compression table is fairly aggressive (high compression).

Is there any way to embed a "BMP" type data into JPEG image. Basically specify a color for specific pixels to be applied after the JPEG is de-compressed? Any other ways clean up how thin color lines get encoded / decoded in JPEG without increasing the overall file size by a lot.

P.S. I'm testing all this stuff in Matlab.

Borisw37
  • 739
  • 2
  • 7
  • 30
  • There is no current way to specify "local" quantization tables for a portion of a JPEG image. If your gray background is a single color (or a color which changes slowly) and so are your lines, then PNG will probably give you the best possible compression. If PNG is not available, TIFF LZW will probably be a decent second place. Both of those are lossless compressions that won't distort the pixels. – BitBank Jun 17 '15 at 20:32
  • This is the kind of thing you are better off using PNG. JPEG is designed for photographic images. You get smearing where there are sharp changes in color through the DCT process. – user3344003 Jun 19 '15 at 15:22

0 Answers0