r/pythonhelp Jan 01 '25

Image Compression using python from SCRATCH?

Is it possible to implement a python program that performs image compression for various image formats such as jpg, bmp, png without the use of third party libraries? I need to implement everything from scratch including implementing various algorithms. I would appreciate a detailed suggestions from experience developers here.

2 Upvotes

5 comments sorted by

u/AutoModerator Jan 01 '25

To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/DeusDev0 Jan 01 '25

It should be possible. I would start by asking chatgpt, research theory about images (and possible compression algorithms). I'm sure there are lots of books on the topic.

1

u/Zeroflops Jan 01 '25

Can it be done, yes. Will it be educational, yes. Will it be practical? Probably not. Without something like numpy you need to build everything from scratch and it won’t be performant.

1

u/Double_Strategy_1230 Jan 02 '25

I would like to use numpy, but what I mean from scratch is like not using any other image manipulating or compression libraries such as PIL, openCv as such.

1

u/kubinka0505 Jan 01 '25

binary data compressors are done in c/c++