mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
@@ -80,7 +80,7 @@ var (
|
|||||||
// Add or increment if changes to an image format's processing requires
|
// Add or increment if changes to an image format's processing requires
|
||||||
// re-generation.
|
// re-generation.
|
||||||
imageFormatsVersions = map[imaging.Format]int{
|
imageFormatsVersions = map[imaging.Format]int{
|
||||||
imaging.PNG: 1, // 1: Add proper palette handling
|
imaging.PNG: 2, // Floyd Steinberg dithering
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increment to mark all processed images as stale. Only use when absolutely needed.
|
// Increment to mark all processed images as stale. Only use when absolutely needed.
|
||||||
@@ -266,7 +266,7 @@ func (i *Image) doWithImageConfig(action, spec string, f func(src image.Image, c
|
|||||||
// Apply the colour palette from the source
|
// Apply the colour palette from the source
|
||||||
if paletted, ok := src.(*image.Paletted); ok {
|
if paletted, ok := src.(*image.Paletted); ok {
|
||||||
tmp := image.NewPaletted(converted.Bounds(), paletted.Palette)
|
tmp := image.NewPaletted(converted.Bounds(), paletted.Palette)
|
||||||
draw.Src.Draw(tmp, tmp.Bounds(), converted, converted.Bounds().Min)
|
draw.FloydSteinberg.Draw(tmp, tmp.Bounds(), converted, converted.Bounds().Min)
|
||||||
converted = tmp
|
converted = tmp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -273,7 +273,7 @@ func TestImageResize8BitPNG(t *testing.T) {
|
|||||||
resized, err := image.Resize("800x")
|
resized, err := image.Resize("800x")
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
assert.Equal(imaging.PNG, resized.format)
|
assert.Equal(imaging.PNG, resized.format)
|
||||||
assert.Equal("/a/gohugoio_hu0e1b9e4a4be4d6f86c7b37b9ccce3fbc_73886_800x0_resize_linear_1.png", resized.RelPermalink())
|
assert.Equal("/a/gohugoio_hu0e1b9e4a4be4d6f86c7b37b9ccce3fbc_73886_800x0_resize_linear_2.png", resized.RelPermalink())
|
||||||
assert.Equal(800, resized.Width())
|
assert.Equal(800, resized.Width())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user