-2

How to remove a header from a file that is .bmp using objective c. I am getting 54 bytes extra. But in order to view image have to remove these 54 bytes and get actual image bytes.

NSData *data = [NSData dataWithContentsOfFile:snapshotFile options:0 error:&error];
NSBitmapImageRep *imagerep = [NSBitmapImageRep imageRepWithData:data];
NSData *bytes = [imagerep representationUsingType:NSBMPFileType properties:nil];

My image is of width = 1280 and height = 800, so total image bytes should be 800*1280*5= 4096000.
But when i checked for bytes calculated above it was 4096054 bytes. It seems that 54 extra is header. I want to remove these header bytes in order to get actual image.
Any help will be really appreciated. And please excuse in case this has already been answered.

1 Answers1

0

BMP is the native bitmap format of Windows and is used to store virtually any type of bitmap data. For Cocoa/Cocoa-touch, we typically use PNG. As for reducing the size of an image programmatically in Objective-C, please:

Refer to this!

Community
  • 1
  • 1
Abhinav
  • 37,684
  • 43
  • 191
  • 309