mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Issue #357 : prevent transparency in GIF export if more than 256 colors
This commit is contained in:
parent
4d8b093941
commit
5b567683a7
@ -94,7 +94,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.GifExportController.prototype.updatePreview_ = function (src) {
|
ns.GifExportController.prototype.updatePreview_ = function (src) {
|
||||||
this.previewContainerEl.innerHTML = '<div><img style="max-width:32px;"src="' + src + '"/></div>';
|
this.previewContainerEl.innerHTML = '<div><img style="max-width:32px;" src="' + src + '"/></div>';
|
||||||
};
|
};
|
||||||
|
|
||||||
ns.GifExportController.prototype.getZoom_ = function () {
|
ns.GifExportController.prototype.getZoom_ = function () {
|
||||||
@ -107,13 +107,16 @@
|
|||||||
var preserveColors = currentColors.length < MAX_GIF_COLORS;
|
var preserveColors = currentColors.length < MAX_GIF_COLORS;
|
||||||
var transparentColor = this.getTransparentColor(currentColors);
|
var transparentColor = this.getTransparentColor(currentColors);
|
||||||
|
|
||||||
|
// transparency only supported if preserveColors is true, see Issue #357
|
||||||
|
var transparent = preserveColors ? parseInt(transparentColor.substring(1), 16) : null;
|
||||||
|
|
||||||
var gif = new window.GIF({
|
var gif = new window.GIF({
|
||||||
workers: 5,
|
workers: 5,
|
||||||
quality: 1,
|
quality: 1,
|
||||||
width: this.piskelController.getWidth() * zoom,
|
width: this.piskelController.getWidth() * zoom,
|
||||||
height: this.piskelController.getHeight() * zoom,
|
height: this.piskelController.getHeight() * zoom,
|
||||||
preserveColors : preserveColors,
|
preserveColors : preserveColors,
|
||||||
transparent : parseInt(transparentColor.substring(1), 16)
|
transparent : transparent
|
||||||
});
|
});
|
||||||
|
|
||||||
for (var i = 0 ; i < this.piskelController.getFrameCount() ; i++) {
|
for (var i = 0 ; i < this.piskelController.getFrameCount() ; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user