I can not write the array correctly. I don't know why python has such a issue.
import sys,os
import numpy as np
from PIL import Image
from bitmap import BitMap
src=os.getcwd()
#get the current working diretory
print(src)
path=src+"\\Se.bmp"
img=Image.open(path,"r")
width, height=img.size
print(f"width={width}")
print(f"height={height}")
#turn it into RGB vlaue array
array=np.array(list(img.getdata()))
name="\\rgb array test_1a.txt"
with open(src+name,"w",encoding="utf-8") as file:
for i in range(len(array)):
file.write("\n")
for j in range(3):
file.writelines(str(array[i][j])+",")
I compare it to the value I get from https://hexed.it/ after I convert both of them to a decimal value. They are totally different. What's the issue here?
Here is the first row I got from the website https://hexed.it/. I have export it as a decimal value.
arr = bytes([ # Offset 0x00000000 to 0x00000015 66, 77, 54, 48, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0 ])
This below is 1st row my output txt file.
254,254,254,
User contributions licensed under CC BY-SA 3.0