帮个忙啊!

原生php 把四张 300300 的图片 生成一张300300的 在图片底下打上水印 这个怎么弄得啊!有大神没有 帮我写个函数

《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 2

可以使用intervention/image

4年前 评论
caden123 (楼主) 4年前
小李世界 4年前
plugins-shibo 4年前
pardon110

刚用golang写了个四图合一

package main

import (
    "github.com/disintegration/imaging"
    "image"
    "image/color"
    "log"
)

func main() {
    src, err := imaging.Open("testdata/branches.png")
    if err != nil {
        log.Fatalf("failed to open image: %v", err)
    }

    // 切割原始图片
    src = imaging.CropAnchor(src, 300, 300, imaging.Center)
    // 固定宽度缩放
    src = imaging.Resize(src, 200, 0, imaging.Lanczos)
    // 聚集
    img1 := imaging.Blur(src, 5)

    // 灰度图片
    img2 := imaging.Grayscale(src)
    // 对比度调整
    img2 = imaging.AdjustContrast(img2, 20)
    // 锐化
    img2 = imaging.Sharpen(img2, 2)

    // 倒置图片
    img3 := imaging.Invert(src)
    // 求得梯度图像
    img4 := imaging.Convolve3x3(
        src,
        [9]float64{
            -1, -1, 0,
            -1, 1, 1,
            0, 1, 1,
        },
        nil,
    )

    // 使用图片粘贴
    dst := imaging.New(400, 400, color.NRGBA64{0, 0, 0, 0})
    dst = imaging.Paste(dst, img1, image.Pt(0, 0))
    dst = imaging.Paste(dst, img2, image.Pt(0, 200))
    dst = imaging.Paste(dst, img3, image.Pt(200, 0))
    dst = imaging.Paste(dst, img4, image.Pt(200, 200))

    err = imaging.Save(dst, "testdata/out_example.jpg")
    if err != nil {
        log.Fatalf("failed to save image: %v", err)
    }

}

输出效果

file

4年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!