joye61 / pic-smaller

Pic Smaller – Compress JPEG, PNG, WEBP, AVIF, SVG and GIF images intelligently
https://picsmaller.com
MIT License
2.16k stars 307 forks source link

希望可以增加一个简单的裁切功能 #39

Closed nonozone closed 3 months ago

nonozone commented 4 months ago

比如我原图可能是16:9或者4:3,可以选择1:1裁切, 直接最短边居中就行,或者原图1:1,居中最短边裁切成4:3之类的。

主要是现在这些电商太折腾了,产品图要1:1,但是笔记图又推荐其他尺寸,心累。

joye61 commented 3 months ago

功能已支持,需要注意几点:

  1. 工具会尽可能的将裁剪选区定位到“水平且垂直”居中,因为图小小不是一个专门做图片编辑的工具,目前无法主动设置裁剪选区
  2. 裁剪模式下压缩的图片无法使用“对比预览”功能,这是显而易见的,压缩图和原图尺寸比例都变了,要对比预览,实现会变得更加麻烦,目前我没有精力,留待以后实现
  3. 如果按照具体尺寸来裁剪,当裁剪的任意一边超出原始图片时,会采用原始图片的边长作为最终裁剪边长

The function is supported, but you need to pay attention to the following points:

  1. The tool will try to position the crop selection to the "horizontal and vertical" center. Because Pic Smaller is not a tool dedicated to image editing, it is currently not possible to actively set the crop selection
  2. The "Compare Preview" function cannot be used for compressed images in crop mode. This is obvious. The size ratio of the compressed image and the original image has changed. It will be more troublesome to compare and preview. I don't have the energy at the moment, so I will leave it for later
  3. If you crop according to a specific size, when any side of the crop exceeds the original image, the side length of the original image will be used as the final cropping side length
nonozone commented 3 months ago

感谢感谢,看了下,好像现在是只能裁剪,不能缩放的时候直接裁剪是吧,就是假如我有一批图片,需要缩放+裁剪,就需要批量操作两次?

joye61 commented 3 months ago

感谢感谢,看了下,好像现在是只能裁剪,不能缩放的时候直接裁剪是吧,就是假如我有一批图片,需要缩放+裁剪,就需要批量操作两次?

“先缩放再裁剪”和“先裁剪再缩放”用纯代码实现会产生不同的结果,一般都是在图片编辑工具里,用户可以手工自由选择操作顺序,放在这里会让批量处理逻辑变得更加复杂,暂时没有计划实现了

nonozone commented 3 months ago

好的,好的。多谢