0

I have a project that I am working on and it requires me to dynamically generate a png on my website from user input, then send that data to my webserver which ultimately creates a file for use with a propriety software package.

I know that the correct data is some sort of bitmap string, but not too sure how it is encoded.

When I generate a bitmap string it looks something like this (opened in visual studio code):

My output

When I open a file generated by the propriety software package it looks like this:

Their Output

I can't seem to work out what / how to properly encode the bitmap string so the output is in the correct format.

Thoughts?

2
  • 1
    I don't see how this is related to the Raspberry Pi? Sep 26, 2019 at 0:35
  • You project is a difficult one, looks like a college level info systems final year project. You can't do it with the weak Arduino. More powerful Rpi (I recommend Rpi4B for rapid development) is the right choice. Good luck and cheers! :)
    – tlfong01
    Sep 26, 2019 at 2:08

1 Answer 1

-1

Question

  1. Project dynamically generates a png from user input send that data to webserver which creates a file for use with a propriety software package.

  2. Correct data is some sort of bitmap string, but not too sure how it is encoded.

  3. How to encode bitmap string so the output is in the correct format.

  4. How can I copy the same image to many SDs?

Answer

I suggest you not to use Rpi web (http) server. Instead, use a very simple Rpi newbie friendly FTP server (eg Pure-FTPd) which only cares about transferring files and no fancy html things.

Bitmap, not like jpg, is uncompressed and very simple. You might like to skim the references below to get a rough idea.

Your propriety image map string seem not properly decoded. If using Rpi Pure-FTP, remember to use properly encoded protocol, eg, UTF-8, UTF-16 BLE, Unicode etc. Otherwise you will get funny characters. Read Ref 4 below, MIMI for image file decoding, etc.

You need to study the BMP and the propriety image string to compare and contrast, to do the conversion. Try your luck, it might be very difficult. Sometimes it is easy, because sometimes only the file header is fiddled.

If you image is finally in Rpi Pure-FTPd's file directory, I usually ftp back to a Win10 directory and use image copier such as Win32ImgMan 1.0 to write to micro SD cards which can be recognized/read by both Win10 and Rpi raspbian.

Bitmap editing is very tedious. But there are many freeware/shareware editors which looks at an image file and reports what is contained in the file, eg. is it a photo, by which camera, date taken, what compressed format etc. This is what you need to know, the rest are raw data, actually bit data which you don't need to care much, just direct copy from each other.

For image editing, you might like to try IfranView Graphics Viewer, which is FREE for non commercial use. For image editing, I prefer Intel/AMD PC Win10 64bit 6GB+, with Nivida GPU, much faster than the little guy Rpi4B 4GB.

And there are also freeware/shareware text editors (not image editors) to edit text files or text strings in your case. I prefer to use EditPlus which has built in FTP upload features, so you don't need to exit one editor to do http/ftp for testing, and come back to do further editing.

bmp format

References

(1) Bitmap overview

(2) Bitmap File Format

(3) Windows MataFile

(4) MIME, Multipurpose Internet Mail Extensions (for SMTP and HTTP)

(5) IfranView Graphics Viewer (free for non commercial use) Review

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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