Made NTFT.py support non-square images and fixed two typos

This commit is contained in:
pbsds committed 2014-06-24 01:02:40 +02:00
1 parent a2d73dcc3c
commit dfd42b850f
2 files changed
+9 -7

No files matched your search

+8 -6
View File
@@ -44,7 +44,7 @@ def DecAsc(dec, length=None, LittleEndian=False):#Converts a decimal into an asc
def clamp(value, min, max): def clamp(value, min, max):
if value > max: return max if value > max: return max
if value < min: return min if value < min: return min
return value return value
#Class NTFT: #Class NTFT:
# #
@@ -115,8 +115,10 @@ class NTFT:
if not self.Loaded: if not self.Loaded:
return False return False
w = len(self.Image[0]) h = len(self.Image[0])
h = len(self.Image) w = len(self.Image)
print w, h
#the actual stored data is a image with the sizes padded to the nearest power of 2 #the actual stored data is a image with the sizes padded to the nearest power of 2
psize = [] psize = []
@@ -221,7 +223,7 @@ def ReadImage(path):
if __name__ == "__main__": if __name__ == "__main__":
print " == NTFT.py ==" print " == NTFT.py =="
print " == by pbsds ==" print " == by pbsds =="
print " == v0.73 ==" print " == v0.80 =="
print print
if not hasPIL: if not hasPIL:
@@ -233,7 +235,7 @@ if __name__ == "__main__":
print " NTFT.py <input> [<output> [<width> <height>]]" print " NTFT.py <input> [<output> [<width> <height>]]"
print "" print ""
print "Can convert a NTFT to PNG or the other way around." print "Can convert a NTFT to PNG or the other way around."
print "if <output> isn't spesified it will be set to <input> with an another extention" print "if <output> isn't specified it will be set to <input> with an another extension"
print "" print ""
print "The NTFT file contain only the colordata, so it's up to the user to find or" print "The NTFT file contain only the colordata, so it's up to the user to find or"
print "store the resolution of the image. <width> and <height> is required" print "store the resolution of the image. <width> and <height> is required"
@@ -261,7 +263,7 @@ if __name__ == "__main__":
width = int(sys.argv[3]) width = int(sys.argv[3])
height = int(sys.argv[4]) height = int(sys.argv[4])
if not (width and height): if not (width and height) and not Encode:
print "Image size not provided!" print "Image size not provided!"
sys.exit() sys.exit()
+1 -1
View File
@@ -6,7 +6,7 @@
PPM.py: v1.2 PPM.py: v1.2
PPM_nonumpy.py: v1.06 PPM_nonumpy.py: v1.06
UGO.py: v0.92 UGO.py: v0.92
NTFT.py: v0.73 NTFT.py: v0.80
--DESCRIPTION-- --DESCRIPTION--
PPM.py can read the metadata, thumbnail, frames and the sound of Flipnote Studio files: .ppm PPM.py can read the metadata, thumbnail, frames and the sound of Flipnote Studio files: .ppm