예제 #1
0
func (prc *SimpleProcessor) processImage(p *image.Paletted, params imageserver.Params) (*image.Paletted, error) {
	tmp, err := prc.Processor.Process(p, params)
	if err != nil {
		return nil, err
	}
	out, ok := tmp.(*image.Paletted)
	if !ok {
		out = image.NewPaletted(tmp.Bounds(), p.Palette)
		imageserver_image_internal.Copy(out, tmp)
	}
	return out, nil
}
예제 #2
0
func (prc *CorrectionProcessor) process(nim image.Image, params imageserver.Params) (image.Image, error) {
	original := nim
	nim, _ = prc.before.Process(nim, params)
	nim, err := prc.Processor.Process(nim, params)
	if err != nil {
		return nil, err
	}
	nim, _ = prc.after.Process(nim, params)
	if isHighQuality(nim) && !isHighQuality(original) {
		newNim := imageserver_image_internal.NewDrawableSize(original, nim.Bounds())
		imageserver_image_internal.Copy(newNim, nim)
		nim = newNim
	}
	return nim, nil
}