Skip to content

Additional padding #3

Description

@STROMANZ

Dear Necmettin,

I might be wrong!

I am validating your binary-to-image converter for my research.
While doing some trivial tests I noticed, what i believe to be, some unnecessary padding was added to a 64 byte file.
After creating a text file in VI containing 64 ASCII characters (A-Z|a-z) and removing the endofline character in vi.
(https://askubuntu.com/questions/1034725/how-to-remove-carriage-return-in-vi)

stromanz@i7:~/binary-to-image/input_dir$ ls -al A.txt
-rw-r--r-- 1 stromanz stromanz 64 Sep 5 08:46 A.txt
stromanz@i7:~/binary-to-image/input_dir$ cat A.txt | wc -c
64

I converted the text file to an image and check it with imagemagic, via "identify -verbose A_L.png"
I see an, in my opinion, additional unnecessary third line (Geometry: 32x3+0+0).

The histogram also shows 32 additional null-characters.
Histogram:
32: ( 0, 0, 0) #000000 gray(0)
64: ( 97, 97, 97) #616161 gray(97)

The filesize only increased by 10 bytes, due to the PNG header.
stromanz@i7:~/binary-to-image/input_dir/L$ ls -al A_L.png
-rw-r--r-- 1 stromanz stromanz 74 Sep 5 08:47 A_L.png

The line may still be there as PNG is a compressed format.

When I remove a single character from this file I end up with a single null character as padding.
Histogram:
1: ( 0, 0, 0) #000000 gray(0)
63: ( 98, 98, 98) #626262 gray(98)

As expected.

Would this be a solution (@line 112)?
if (int(size % width) != 0):
height = int(size / width) + 1
else:
height = int(size / width)

If I'm wrong and this is not an issue within your code, could you point me in the right direction ?

Kind regards,
Marco Stroosnijder

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions