mirror of
https://github.com/option8/RetroConnector.git
synced 2024-11-26 22:50:32 +00:00
Merge pull request #5 from marcan/master
Fix the pixel mapping and improve image processing [AMAZING!]
This commit is contained in:
commit
a193ef6f29
Binary file not shown.
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 32 KiB |
@ -50,9 +50,8 @@ PIXELS = []
|
|||||||
try:
|
try:
|
||||||
byte = DSK.read(1) # read a byte
|
byte = DSK.read(1) # read a byte
|
||||||
while byte !="": # while the file still has bytes in it
|
while byte !="": # while the file still has bytes in it
|
||||||
byte = DSK.read(1)
|
BYTES.append(ord(byte)) # append the number representing the byte (0-255) to the BYTES array
|
||||||
if len(byte) > 0: # the last byte, for whatever reason, is length 0. Bah.
|
byte = DSK.read(1)
|
||||||
BYTES.append(ord(byte)) # append the number representing the byte (0-255) to the BYTES array
|
|
||||||
|
|
||||||
except:
|
except:
|
||||||
print("\n\nOops. Is " + INPUTFILE + " a DSK file of 143kb?\n\n")
|
print("\n\nOops. Is " + INPUTFILE + " a DSK file of 143kb?\n\n")
|
||||||
@ -62,11 +61,10 @@ finally:
|
|||||||
sys.stdout.write("\r Starting.\n\n")
|
sys.stdout.write("\r Starting.\n\n")
|
||||||
|
|
||||||
|
|
||||||
for TRACK in range(0,TRACKS,1): # for each of the 35 tracks
|
for TRACK in range(TRACKS): # for each of the 35 tracks
|
||||||
LINE=[] # start a new line of pixels
|
LINE=[] # start a new line of pixels
|
||||||
for SECTOR in range(0,SECTORS*BYTESPERSECTOR,1): # write the bytes for the sectors in that track to the line array
|
for SECTOR in range(SECTORS*BYTESPERSECTOR): # write the bytes for the sectors in that track to the line array
|
||||||
offset = (SECTOR * TRACK) + SECTOR
|
LINE.append(BYTES[(SECTORS*BYTESPERSECTOR * TRACK) + SECTOR])
|
||||||
LINE.append(BYTES[(SECTOR * TRACK) + SECTOR])
|
|
||||||
|
|
||||||
sys.stdout.write("\r Track: " + str(TRACK))
|
sys.stdout.write("\r Track: " + str(TRACK))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
@ -92,7 +90,8 @@ OUTPUTFILE = os.path.join(INPUTFILE + ".png")
|
|||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.call(['convert', 'DiskImageTEMP.png', '-matte', '-virtual-pixel', 'transparent', '-resize', '1024x1024!', '-rotate', '90', '-distort', 'Polar', '512 110 512,512 -180,180', OUTPUTFILE])
|
subprocess.call(['convert', 'DiskImageTEMP.png', '-scale', '100%x300%', '-resize', '3072x!', '(', '-size', '3072x115', 'pattern:horizontal3', '-negate', '-alpha', 'copy', '-fx', '#000', ')', '-composite', '-virtual-pixel', 'HorizontalTile', '-flip', '+distort', 'Polar', '1024 220', '-resize', '50%x50%', OUTPUTFILE])
|
||||||
|
|
||||||
# convert the 4096x35px image to a square, rotate, then rotate around an axis.
|
# convert the 4096x35px image to a square, rotate, then rotate around an axis.
|
||||||
except OSError:
|
except OSError:
|
||||||
print("\n\nOops. This script requires ImageMagick: http://www.imagemagick.org/")
|
print("\n\nOops. This script requires ImageMagick: http://www.imagemagick.org/")
|
||||||
|
Loading…
Reference in New Issue
Block a user