Merge pull request #1430 from kevinwchang/no-rgba-jpeg
Convert RGBA to RGB before saving as JPEG
This commit is contained in:
@@ -146,6 +146,8 @@ directory.
|
|||||||
|
|
||||||
# write a blank image
|
# write a blank image
|
||||||
blank = Image.new("RGBA", (1,1), tileset.options.get('bgcolor'))
|
blank = Image.new("RGBA", (1,1), tileset.options.get('bgcolor'))
|
||||||
|
if tileset.options.get('imgformat') != 'png':
|
||||||
|
blank = blank.convert("RGB")
|
||||||
blank.save(os.path.join(self.outputdir, tileset.options.get('name'), "blank." + tileset.options.get('imgformat')))
|
blank.save(os.path.join(self.outputdir, tileset.options.get('name'), "blank." + tileset.options.get('imgformat')))
|
||||||
|
|
||||||
# write out config
|
# write out config
|
||||||
|
|||||||
@@ -978,7 +978,7 @@ class TileSet(object):
|
|||||||
# Save it
|
# Save it
|
||||||
with FileReplacer(imgpath, capabilities=self.fs_caps) as tmppath:
|
with FileReplacer(imgpath, capabilities=self.fs_caps) as tmppath:
|
||||||
if imgformat == 'jpg':
|
if imgformat == 'jpg':
|
||||||
img.save(tmppath, "jpeg", quality=self.options['imgquality'], subsampling=0)
|
img.convert('RGB').save(tmppath, "jpeg", quality=self.options['imgquality'], subsampling=0)
|
||||||
else: # png
|
else: # png
|
||||||
img.save(tmppath, "png")
|
img.save(tmppath, "png")
|
||||||
|
|
||||||
@@ -1089,7 +1089,7 @@ class TileSet(object):
|
|||||||
# Save them
|
# Save them
|
||||||
with FileReplacer(imgpath, capabilities=self.fs_caps) as tmppath:
|
with FileReplacer(imgpath, capabilities=self.fs_caps) as tmppath:
|
||||||
if self.imgextension == 'jpg':
|
if self.imgextension == 'jpg':
|
||||||
tileimg.save(tmppath, "jpeg", quality=self.options['imgquality'], subsampling=0)
|
tileimg.convert('RGB').save(tmppath, "jpeg", quality=self.options['imgquality'], subsampling=0)
|
||||||
else: # png
|
else: # png
|
||||||
tileimg.save(tmppath, "png")
|
tileimg.save(tmppath, "png")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user