[Script] A bat script implementation for BMP to EPS conversion (requires installation of bmeps)

Source: Internet
Author: User

Recently, using Latex to write articles, images need to use EPS format. If you have installed the Bmeps tool (typically you have ctex on it), you can open the CMD window in the directory you want to convert, and then enter:

Bmeps-c a.jpg A.eps

The-c parameter means to keep the color information, and if you don't add this parameter sometimes something strange happens ...

A.jpg can also be BMP, but preferably JPG, otherwise there will be strange things happen ...

Then wrote a batch code for the batch conversion, very short, as follows:

1 @echo off2 setlocal enabledelayedexpansion3 Echoplease put JPG files that need to be processed in this script directory4 EchoAll outputs are located in./eps/5 Echo;6 Pause7 EchoStart Conversion ...8 Echo;9 Ten ifNot exist log\ MD log One ifNot exist eps\ MD EPS A ifexist log\list.txt del log\list.txt -  - dir/a/b *.jpg >Log\list.txt the  -set/a count =0 -  for/F"delims=."%%iinch(Log\list.txt) Do ( -     ifExistI.jpg ( +Bmeps-c%%i.jpg eps\%%i.eps -set/a Count + =1 +     ) A ) at  - EchoConversion complete, co-processing%count%a file - Echo;  -rd/s/Q Log -Pause

The core section is 17 to 22 rows.

Line 14th Prints the file name of all JPG files to a text file

17 rows/F parameter indicates that the collection of loops is from the file

Delims stands for separators, here with '. ' To split to get all filenames without a suffix

(I won't tell you I didn't find a way to use the string substitution)

Those on the Internet.

Set a = aaabbbset b=!a:aaa=bbb!

Purely nonsense, anyway, I tried completely useless, there is a percent of the party, the position of the exclamation point I also for a number of combinations, all are nonsense.

%%i is the name of the local variable for the For loop

Later, it is easier to call the Bmeps tool.

[Script] A bat script implementation for BMP to EPS conversion (requires installation of bmeps)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.