Hi,
Is there any way that I can have access to the data array of the saved image or video and manipulate the data and save it without needing to open the image or video? I would appreciate any hints.
Thanks in advance.
Printable View
Hi,
Is there any way that I can have access to the data array of the saved image or video and manipulate the data and save it without needing to open the image or video? I would appreciate any hints.
Thanks in advance.
The binary object (with binary quickload for large files) can be used to edit any files if you know the format.
What are you trying to do?
I don't want to take over this thread or anything but im quite interested in this also, mainly just how to edit a image changing it's colors etc using binary then re-save it.
Also is there some sort of references for doing this sort of stuff for binary editing of images and sounds online?
It sounds like it could be very useful but i have no idea how it's done right now. Hopefully this is ok to post, i know i didn't start this topic but it saves me from making another as it seems like the same type of thing i wanted to know.
Hi Dynasoft,
Thanks for the reply. Well what I want to do is basically to have a visual picture of the data responsible to the image or images building the video to be able to associate any manipulation visually. I have been searching online and seen tutorials regarding LockBits method but the problem is that I have to see what I do and therefor what I want to do is to insert some data in a table to edit and save it and see the result. I hope with this file
I have been able to explain myself better.
With Respect
Hi Atom,
It is a big relife to see I am not alone.
Wikipedia has information on the binary format of most file types, e.g.:Quote:
Originally Posted by Atom
.BMP: http://en.wikipedia.org/wiki/BMP_file_format#Example_of_a_2x2_Pixel.2C_24-Bit_Bitmap
and even:
.PNG: http://en.wikipedia.org/wiki/Portable_Network_Graphics#Technical_details
Good luck understanding them though, binary editing files isn't simple.
Hi Dynasoft,
Let us assume that I want to load the bitmap data in that very image in the first link you kindly mentioned describing the bmp file, in to the binary object to get to the bitmap data of the image.
Do I have to originate my readings from the offset 36h as zero with a width 12h and 16h as x and y coordinates excluding the Padding for 4 byte alignment to get the data for the image upside down?
That sounds right.
Does the binary object automatically "convert" the files to binary, as far as I new I thought all files also used hexadecimals along with binany.
-Thanks, Variant
Thanks for the links Dynasoft :)
Binary, hexadecimal and decimal are just different ways of writing down the same number. The contents of the file are always binary, as this is how a computer operates internally.Quote:
Originally Posted by variant
You're probably thinking of using a "hex editor" to edit a file by hand. The contents of the file aren't actually hexadecimal, it's just more convenient to read and edit than decimal or binary.
Hi Dynasoft,
How does the object accepts the values and interpret the value in using the Expression 'Get byte at' and 'get string at'
byte( "Binary object", > Enter value here <)
string$( "Binary object", > Enter value here <, > Enter value here <)
Can you recommend some links to become familiar with the terminologies of the binary object?
With Respect
There should be a help file somewhere, but the first value for both is going to be the location in the file (as a decimal number). The second for the string is either going to be the end location, fixed length of the string to get, or a max length of the string (stopping at a "null" character if there is one before the max length).
Hi Dynasoft,
Yes I have seen the help file. But the problem is that I have to convert the readings to see the binary representation if not what do I do wrong in this file ?
Thanks
Hi,
Unfortunatly there is some thing wrong with the binary object as I used Binary array object instead and the readindgs are satisfactory but stil the problem is that the readings must be converted to get the binary representation.
With Regards
I don't remember whether MMF has a binary$() function, but it definitely has a hex$() function. Try that.
Hi Dynasoft,
MMF has both binary$() and hex$() function which makes it strange that why load binary file is not provided.
I think as it is, the best way is the use of dotnet object.
With respect
Files aren't really stored as binary*. They're stored as bytes, which are integer numbers in the inclusive range of 000-255 (decimal), 00-FF (hex) and 00000000-11111111 (binary).
*Hard-disks store files as magnetic polarisation. Optical disks store files as reflectivity. When transmitted over wire, it's common to represent an entire byte in one go as a combination of frequency and phase, rather than individual bits, because you can transmit much faster that way. See QAM
The binary object works fine.
The str$(), hex$() and binary$() functions convert a number to decimal, hex and binary strings respectively. They're only for display to the user, because after doing any of those they aren't numbers as far as the computer is concerned any more.
the binary reperesentation of RGBW.bmp in file
is suposed to be the fowlowing
01000010 01001101 01000110 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00110110 00000000
00000000 00000000 00101000 00000000
00000000 00000000 00000010 00000000
00000000 00000000 00000010 00000000
00000000 00000000 00000001 00000000
00011000 00000000 00000000 00000000
00000000 00000000 00010000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 11111111 00000000
00000000 11111111 11111111 11111111
00000000 00000000 00000000 00000000
11111111 00000000 11111111 00000000
00000000 00000000
but it is not represented so in the way I have used the binary object in the example. byte 54,57,57,59,64,66 are not read corectly no matter how I try to present them. Am I not approching the Binary object Correct?
Thanks for the link. I think I will red that carefully tomorrow.
Regards
I guess you're getting "signed" bytes out of the binary object. They're exactly the same, just how you convert them to other forms is different. Including how the binary object converts them to the signed 32-bit integers and 64-bit floating point numbers MMF uses internally.
8-bit Binary: 10000000 - 11111111
Convert to decimal (unsigned): 128 - 255
Convert to decimal (signed): -128 - -1
Convert to 16-bit (unsigned, add 0s to start): 00000000.10000000 - 00000000.11111111
Convert to 16-bit (signed, clone first digit): 11111111.10000000 - 11111111.11111111
(I didn't want to write out 32 bits, but it's the same idea)
Hi Dynasoft,
It is strange as I get the readings by one loop which is equal to the size of the file loaded in to the object. If that is the case then my readings would be wrong for every loop which is not the case. It is only when it reads any integer greater than 100h which I get the wrong readings. I have changed the color of the bmp and if there is no color value greater than 100 then the readings are correct.
I think it is a bug.
Regards
Signed vs unsigned are only different for half the values. For bytes, this is 128 - 255 (unsigned) becomes -128 - -1 (signed). 0-127 work fine. This is what you are seeing.
Hi Dynasoft,
You are right I am getting signed bytes out of the binary object. But then how this very object is useful in getting bytes? Does it mean that I always have to first check if the bytes are signed or unsigned and then convert the second half if signed integer? Is there any special reason in choosing the output to be signed or unsigned?
I think I will have to read more about use of these integers.
Thanks for your patience.
Hi,
What is the path to a MMF2 built application’s temp directory? Is it possible to get the data output of video and graphic objects?
Thanks
Hi,
I think I have not been clear enough with my question so I will try to put it somehow better.
In MMF 1.5, I could have access to the temp directory of my project via
As Appdrive$ + Appdir$ + "_Del.log"
I wonder how I can access to temp directory of my project in MMF2 and if there is a possibility of accessing the data output produced by the video or graphic objects I have used in my project. My task is to get access to the video output of a video object by accessing its pointers or reading the changes in value of the bytes reserved for the object. Is it somehow possible?
Thanks in advance
The same thing works, though Apppath$ instead of "appdrive$+appdir$" is preferred now.Quote:
Originally Posted by Ham
Theoretically yes, in practice it might as well be impossible.Quote:
Originally Posted by Ham
>>Theoretically yes, in practice it might as well be impossible <<
Hi Dynasoft,
Thank you very much. Now I can put some time on it. You are a pearl.