0

So, during some cryptanalysis I find it necessary to modify a particular BMP image's DIB header so that I can increase the height and size of the image.

Here's what I have been able to find:

typedef struct tagBITMAPINFOHEADER {
  DWORD biSize;
  LONG  biWidth;
  LONG  biHeight;
  WORD  biPlanes;
  WORD  biBitCount;
  DWORD biCompression;
  DWORD biSizeImage;
  LONG  biXPelsPerMeter;
  LONG  biYPelsPerMeter;
  DWORD biClrUsed;
  DWORD biClrImportant;
  } BITMAPINFOHEADER, *PBITMAPINFOHEADER;

Trouble is, I do not understand this enough to be able to make modifications to the hex data of this BMP image to increase the height and size. Could anyone please tell me how I can increase the height and width to 100 times? I do not need to do this using a program or anything, I can change it manually if only I knew where.

enter image description here

  • Without modifying the image data it is impossible. – ilkhd Mar 29 '15 at 20:44
  • 1
    modifying the size is more than just toggling two values. You will need to insert the pixel data. If you want to scale it up manually (instead of adding garbage data), then, we'll see you in ten years. Also, if you don't know what a DWORD is or how this struct relates to the file on disk, then you should start your research there. – Yorik Mar 31 '15 at 20:26
  • @Yorik Thanks for your input. I used the GIMP editor to 'scale' the image. Increased the width and height 100 times and 'exported' the resulting image. I am now trying to cryptanalyze this new image in a hexeditor. I find a lot of repeated AA.BB.CC... etc. I think it's part of the cryptography. Could you tell me exactly what happens when GIMP scales the image? Did it add garbage values? Because when I look at the new file, I see patterns rather than garbage. – learnerX Mar 31 '15 at 21:33
  • You said you wanted to do it manually. You could zero-fill it, but scaling x2 means spreading the pixels and inserting new data between them by averaging. Obviously, "manually" this would get VERY time consuming with a calculator and manually keying in data with a HEX editor. – Yorik Mar 31 '15 at 21:36
  • 1
    When resizing, you are doing interpolation. Typically bicubic ( en.wikipedia.org/wiki/Bicubic_interpolation ). Bitmap data can be stored as an explicit palette with arbitrary color values and a look-up index and 1 channel; or as an implicit greyscale palette and 3 channels (RGB). – Yorik Mar 31 '15 at 21:38
0

One can insert/expand the pixel data. That is, i.e. - duplicate each pixel horizontally and vertically - and then change BITMAPINFOHEADER and BITMAPFILEHEADER to the new values. Though, one must write a program,a simple one, since manual insertion would be impractical. The link below, is a YouTube video which provides some background in resize and BITMAPINFOHEADER, BITMAPFILEHEADER : https://www.youtube.com/watch?v=g8LEbJapnj8

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Ramhound Jul 20 '15 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.