disintegration / imaging

Imaging is a simple image processing package for Go
MIT License
5.3k stars 443 forks source link

PNG compression is invalid #127

Closed aveyuan closed 4 years ago

aveyuan commented 4 years ago

Hi, I try Use PNG compression,but The size has not changed.

Code

package main

import (
    "image/png"

    "github.com/disintegration/imaging"
)

func main() {
    img, err := imaging.Open("test.png")
    if err != nil {
        panic(err)
    }

    b := img.Bounds()

    dstImage128 := imaging.Resize(img, b.Dx(), b.Dy(), imaging.Lanczos)

    imaging.Save(dstImage128, "x1.png", imaging.PNGCompressionLevel(png.BestCompression))

}

Output pic

image

I want to compress more, how did I do it? Thanks

disintegration commented 4 years ago

Hi,

This package does not implement any image encoding methods itself. To encode image to PNG it uses the standard image/png package. The given compression level (png.BestCompression) is the maximum compression that is available.

aveyuan commented 4 years ago

你好

该程序包本身不实现任何图像编码方法。要将图像编码为PNG,它使用标准image/png包。给定的压缩级别(png.BestCompression)是可用的最大压缩率。

Thanks