Image Compression you can implement in a day

  • Thread starter Thread starter Superposed_Cat
  • Start date Start date
  • Tags Tags
    Compression Image
Click For Summary

Discussion Overview

The discussion revolves around implementing a simple image compression algorithm within a short timeframe, specifically avoiding complex methods like JPEG. Participants explore various algorithms that can be learned and executed quickly without relying on external libraries.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants propose Huffman encoding as a viable option for image compression that can be implemented quickly.
  • One participant suggests using the difference between pixel values and applying Huffman compression to those differences, indicating a potential method for improving compression efficiency.
  • Another participant mentions LZW compression as an alternative and provides a reference to the original paper by Welch for further reading.
  • One participant outlines a series of methods starting with Run Length Encoding, progressing to more complex techniques that involve correlations between successive scan lines and specific implementations used in FAX machines.

Areas of Agreement / Disagreement

Participants present multiple competing views on the best approach to image compression, with no consensus on a single method being favored over others.

Contextual Notes

Some methods discussed depend on specific assumptions about the image data and may require additional context for implementation. The discussion does not resolve the effectiveness or suitability of the proposed algorithms.

Who May Find This Useful

Individuals interested in quick implementations of image compression algorithms, particularly those with limited time and resources for complex solutions.

Superposed_Cat
Messages
388
Reaction score
5
I need to implement a decent image compression algorithm in a day or two, without using libraries.
So it can't be anything with multiple layers, like jpeg.
I was thinking huffman encoding,

Which would be a good algorithm I can learn to implement in a day or two that is not terrible at it's job.
 
Technology news on Phys.org
Superposed_Cat said:
I need to implement a decent image compression algorithm in a day or two, without using libraries.
So it can't be anything with multiple layers, like jpeg.
I was thinking huffman encoding,

Which would be a good algorithm I can learn to implement in a day or two that is not terrible at it's [SIC] job.
You can find good examples on the internet of huffman encrypt/decrypt. I remember years ago lifting one and modifying it to my needs in a couple of hours.
 
  • Like
Likes   Reactions: Klystron, Superposed_Cat and anorlunda
.
phinds said:
You can find good examples on the internet of huffman encrypt/decrypt. I remember years ago lifting one and modifying it to my needs in a couple of hours.
Another idea is to compute the difference between a pixel value and the pixel value to the left or above it, and use huffman compression on those differences. (you can just use unsigned values,)
 
1) The simplest of course in just Run Length encoding. That takes advantage of correlations along scan lines.

2) The next step up is correlation between succesive scan lines (copy the pixel above) combined with Run Length.

3) One more step up is copy 2) above that is <offset or different length> by X pixels.

Number 3 above is used in FAX machines. The specific codes for the above are described in the FAX standard. I worked on the early prototypes several decades ago and don't recall the details. This Google search returns many results and probably has the actual standard listed.
https://www.google.com/search?&q=fax+code+standards
The hardware implementation required a one-scanline buffer for the look-behind, some logic, and 3 or 4 EEprom memories for the table lookup/encode-decode.

Cheers,
Tom
 
  • Like
Likes   Reactions: berkeman

Similar threads

  • · Replies 13 ·
Replies
13
Views
5K
  • · Replies 31 ·
2
Replies
31
Views
4K
  • · Replies 133 ·
5
Replies
133
Views
13K
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
4K
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 2 ·
Replies
2
Views
5K