重命名,调整大小并在文件夹中包含每个图像的多个版本 [英] Rename, Resize and have several versions of each image in a folder

查看:105
本文介绍了重命名,调整大小并在文件夹中包含每个图像的多个版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含一些图像的文件夹。



图像名称是串行的(AD10001 - AD10010)。



图像目前尺寸不同,(即500x500,280x280等)



我需要每张图片6份,每份都以格式命名:

AD10001-100x100

AD10001-228x228

AD10001-40x40

AD10001-500x500

AD10001-74x74

AD10001-80x80

Ad10002-100x100

等等



我还需要它们是相关尺寸,即40x40等。



我完全不知道如何做到这一点。



有人可以帮忙吗?



(PS没有10张原始图像,但是26,000!)

解决方案

您的批处理文件技能如何?



下载以下内容: http://www.imagemagick。 org / script / mogrify.php [ ^ ]



这里有一些帮助: http://www.ibm.com/developerworks/library/l-graf/?ca=dnt-428 [ ^ ]


我最近回答了如何使用大小调整位图的大小。净。我只想为你添加:在循环中执行它并以您选择的名称保存所有这些文件。请参阅此答案:

调整vb中的图像大小。网 [ ^ ]。



这一切都很简单,可以给你合理的表现。



第二种选择是使用即用型实用程序(并且可能享受性能提升)。我强烈推荐使用FFmpeg或libavcodec实用程序。请参阅:

http://en.wikipedia.org/wiki/Ffmpeg [< a href =http://en.wikipedia.org/wiki/Ffmpegtarget =_ blanktitle =New Window> ^ ],

http://ffmpeg.org/ [ ^ ],

http://en.wikipedia.org/wiki/Libavcodec [ ^ ],

http://libav.org/ [ ^ ]。



在这两种情况下,您都可以获得免费的开源实用程序,几乎可以制作所有内容。 (这比我之前尝试过的ImageMagic要好得多,即使它也适用于你。使用ffMpeg,我常常在解决方案很难找到时解决最棘手的问题。)



现在,即使您想通过.NET应用程序(甚至是ASP.NET)运行它,您也可以使用 System.Diagnostics将其作为单独的进程运行.Process.Start 。您可以重定向 StandardOutput StandardError ,以捕获输出或简单地隐藏它。您将在本课程的文档中找到足够多的示例。进程开始的文件名不一定是实用程序。它也可以是使用不同参数启动实用程序的批处理文件。但是,有了成千上万的图像,我会直接在代码中进行,而不是批处理文件,因为您可能需要计算文件名等等。



那里是另一个更复杂的选项:你可以找到ffMPeg或LibAV库的.NET包装器库并立即在你的.NET应用程序中使用它,但这需要更多的人力。



无论如何,如果您需要更多信息,请询问您的后续问题。我经常集中图像和其他媒体处理,并且知道很多。



祝你好运,

-SA

I have a folder with some images.

The image names are serial (AD10001 - AD10010).

The images are currently different sizes, (ie a 500x500, a 280x280 etc)

I need 6 copies of each image, each one named in the format :
AD10001-100x100
AD10001-228x228
AD10001-40x40
AD10001-500x500
AD10001-74x74
AD10001-80x80
Ad10002-100x100
and so on

I also need them to be the relevant sizes, ie 40x40 etc.

I have absolutely no idea how to do this.

Can anyone help?

(PS there are not 10 original images, but 26,000!)

解决方案

How is your batch file skills?

Download the following : http://www.imagemagick.org/script/mogrify.php[^]

Some more help here : http://www.ibm.com/developerworks/library/l-graf/?ca=dnt-428[^]


I recently answered how to resize a bitmap using .NET. All I would to add just for you: do it in cycle and save all those files under the names of you choice. Please see this answer:
resize image in vb.net[^].

This is all really simple and can give you reasonable performance.

The second options is using the ready-to-use utility (and probably enjoying the boost in performance). I would strongly recommend FFmpeg or libavcodec utility. Please see:
http://en.wikipedia.org/wiki/Ffmpeg[^],
http://ffmpeg.org/[^],
http://en.wikipedia.org/wiki/Libavcodec[^],
http://libav.org/[^].

In both cases, you can get free open-source utilities which can make nearly everything. (And this is much better than ImageMagic which also I tried before, even though it would work for your, too. With ffMpeg, I used to solve most tricky problems when the solution was really hard to find.)

Now, even if you want to run it all through .NET application (even ASP.NET), you can simply run it as a separate process using System.Diagnostics.Process.Start. You can redirect the StandardOutput and StandardError, to capture output or to simply hide it. You will find more than enough examples in the documentation of this class. The file name for the start of process does not have to be the utility. It could also be a batch file starting the utility with different parameters. However, with thousands of images you have I would do it directly in code, not batch file, as you may need to calculate file names and a lot more.

There is another, more complex option: you can find a .NET wrapper library of the ffMPeg or LibAV library and use it immediately in your .NET application, but this would take more labor.

Anyway, if you need some more information, please ask your follow-up questions. I often do massing image and other media processing and know a big deal of it.

Good luck,
—SA


这篇关于重命名,调整大小并在文件夹中包含每个图像的多个版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆