npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@masx200/long-image-split-square

v1.4.0

Published

批量把长图拆分成接近正方形的小图片的脚本

Downloads

33

Readme

long-image-split-square

此仓库仅供学习交流之用

批量把长图竖直或水平拆分成接近正方形的小图片的脚本

给文件读取异步操作限流,防止文件打开过多报错

这些图片往往是微博图片特色,或者是全景照片

安装依赖

先安装 GraphicsMagick

sudo apt install graphicsmagick

或者下载GraphicsMagick

https://cdn.jsdelivr.net/gh/masx200/[email protected]/GraphicsMagick-1.3.34-Q16-win64-dll.exe.zip

https://cdn.jsdelivr.net/gh/masx200/[email protected]/GraphicsMagick-1.3.34.tar.xz

如果要处理webp文件需要安装libwebp

sudo apt install  libwebp

或者下载libwebp的可执行文件

http://downloads.webmproject.org/releases/webp/

https://cdn.jsdelivr.net/gh/masx200/long-image-split-square@libwebp/libwebp-1.0.1-windows-x64.zip

https://cdn.jsdelivr.net/gh/masx200/[email protected]/libwebp-1.1.0-aarch64.zip

官方说明

https://github.com/webmproject/libwebp

http://www.linuxfromscratch.org/blfs/view/svn/general/libwebp.html

http://www.graphicsmagick.org/README.html

安装 node_modules

yarn add @masx200/long-image-split-square
yarn install

编译脚本

yarn build

运行脚本

yarn start

长图判定方法

图片长边与短边的比例大于 3,且短边大于 400 像素,横向或竖向均可

配置

编辑image-config.json文件

https://github.com/masx200/long-image-split-square/blob/master/dist/IMAGECONFIG.d.ts

inputextentions:输入的文件扩展名

input:输入文件的目录

output:输出文件的目录

outputextention:输出文件的扩展名

maxpixels:输出图片的最大像素总数限制,若无限制,则为 0

interface IMAGECONFIG {
    inputextentions: string[];
    input: string;
    output: string;
    outputextention: string;
    maxpixels: number;
}

支持的图片格式

webpGraphicsMagick Supported Formats

https://github.com/masx200/long-image-split-square/blob/master/gm%20convert%20-list%20format.txt

http://www.graphicsmagick.org/formats.html

命令行用法示例

必选参数 input:类型string,输入图片目录

必选参数 output:类型string,输出图片目录

可选参数 maxpixels:类型number,输出图片最大像素数

可选参数 concurrent:类型:number,同时运行的图片处理进程最大值

node ./dist/cli.js --input=D:/baidupandownload/图片输入  --output=D:/baidupandownload/输出切割图片/
node ./dist/cli.js --input=D:/baidupandownload/图片输入  --output=D:/baidupandownload/输出切割图片/ --maxpixels=4000000 --concurrent=4
npx @masx200/long-image-split-square --input=D:/baidupandownload/图片输入  --output=D:/baidupandownload/输出切割图片/ --maxpixels=4000000