0

I have a BMP image and I want to extract a small portion of it and save it as a new BMP image file. I was able to load image and read it however I was not able to extract the small portion of BMP image as I am new to manipulating BMP image with python and also it not same as reading text file. Things I have to do is

  1. load image.
  2. extract small portion of image. eg. I have to extract 40X40 pixel image from 900X900 image file
  3. then save extracted image as new file. eg new.bmp

I am trying to do this for last 3 days also I have searched a lot in the net but got solution which uses Pillow library however I need it to do this without using any external module of Python. Stackoverflow is my last hope I need some guidance from a expert people present here, please provide my some guidance.

GAURAV Sharma
  • 103
  • 1
  • 10
  • Sounds like a student assignment from a particularly perverse lecturer forcing people to read and write antique, arcane image formats when perfectly good libraries exist. Great engineers re-use code and build on the work of others... I guess you'll need to go to Wikipedia https://en.m.wikipedia.org/wiki/BMP_file_format and practice working with Python structs https://docs.python.org/3/library/struct.html ... unless you have to use Python 2 as well? – Mark Setchell Sep 26 '20 at 16:07
  • Does this answer your question? [Load just part of an image in python](https://stackoverflow.com/questions/19695249/load-just-part-of-an-image-in-python) – Avinash Sep 26 '20 at 17:20

0 Answers0