简体   繁体   English

如何使用linux命令将jpg文件转换为png文件? + 难度 = 子文件夹

[英]How to convert jpg files into png files with linux command? + Difficulty = Subfolders

I want to convert several jpg files into png files.我想将几个 jpg 文件转换为 png 文件。 As far as I know, one can use this command据我所知,可以使用此命令

mogrify -format png *.*

I have one problem, I have a lot of subfolders.我有一个问题,我有很多子文件夹。 Let's say a is my main folder and b,c and d are subfolders.假设a是我的主文件夹,而b、cd是子文件夹。 The images are in the subfolders.图像位于子文件夹中。

How can I convert all images without having to open every folder manually?如何在无需手动打开每个文件夹的情况下转换所有图像?

-> I would like to write a command that works, when I am in folder a , but works for all files in the subfolders. -> 当我在文件夹a中时,我想编写一个有效的命令,但适用于子文件夹中的所有文件。

Assuming you're in folder a the following might work for you假设您在文件夹 a中,以下可能对您有用

find . -name "*.jpg" -exec mogrify -format png {} \;

You can use the find command to get all the jpg files in all the subfolders and pass your command as an argument to find您可以使用 find 命令获取所有子文件夹中的所有 jpg 文件,并将您的命令作为参数传递给 find

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Linux上将pptx文件转换为jpg或png(对于每张幻灯片)? - How to convert pptx files to jpg or png (for each slide) on linux? 在子文件夹中将图像文件jpg,png批量转换为webp - Batch convert images files jpg, png to webp also in subfolders 如何在Linux中一步将子文件夹中的jpg文件转换为每个pdf文件? - How to convert jpg files in subfolders to one each pdf file in one step in linux? 如何使用inkscape linux将包含SVG文件的文件夹转换为PNG? - How to convert a folder with SVG files to PNG with inkscape linux? 在Linux上将SWF文件转换为PNG图像 - Convert SWF files to PNG images on Linux 如何在Linux中将多个子文件夹压缩成单独的文件? - How to compress multiple subfolders into separate files in linux? 如何对子文件夹中的文件使用 stat 命令? - How to use the stat command for files that are in subfolders? Linux 命令将文件从子文件夹移动到其父文件夹 - Linux command to move files from subfolders into their parent folders 如何使用命令行替换linux中具有不同文件扩展名的多个子文件夹中的多个文件中的字符串 - How to replace a string in multiple files in multiple subfolders with different file extensions in linux using command line Xampp / Lampp .jpg / .png文件无法访问,而.txt文件具有相同文件权限-Linux - Xampp/Lampp .jpg/.png files inaccessible while .txt is, same file permissions - Linux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM