Jump to content

Wrote batch conversion utility but I can't post it


Recommended Posts

I had several hundred "full resolution" scanned tif files that I wanted to make working jpg copies of, at reduced size.

I've used Paint.NET for a while, and the older paint programs I used to have that included batch capabilities all seem to be dead and gone.

I looked in the plugins list here for a batch processing plugin but found that the only two plugins listed that said anything about batching had both been deleted from the board by the admin.

It turned out to still be faster for me to write a command-line utility that uses the PDN built-in FileType's support to convert them all, than it would have been to process hundreds of files by hand.

When I was done and the project in the state useful to me was checked into my svn server, I thought, "hey, maybe someone else could use this...". I made a few improvements in error handling, wrote a readme file, added copyright notice and Apache 2.0 open-source license, and zipped up the whole c# project without the build and svn artifacts.

Then I joined this forum thinking that I could "publish" it here in the plugins board. But I cannot do that, because the forum's policy is that as a "newbie" I cannot create a topic there until I have made 10 posts elsewhere in the forum. Well, it's your forum, and you surely get to set the rules. But... I'm a professional software developer with 30+ years experience, not a bot or troll; I don't have 9 more things I'd like to post about here; and I don't feel like jumping through any more hoops (such as maybe creating a google code project) to complete the impulse of giving this away. If you'd like to enable me to post in Plugins, please let me know and I'll come back and upload the code. If not, I still want to thank you for making Paint.NET available, I certainly find it useful.

thank you,

-tom-

PS. FWIW, here is the readme file that is included in the zip with the source and exe, perhaps it will help you decide if you even want it here or not:

1. Basics

SimplePdnBatch is a utility for batches of simple transformations

of image files, between files types and optionally resized, using

Paint.net image processing. No attempt is made to use the async

capabilities in Paint.NET: in the occaisional-use scenario this

was originally written for, the observed throughput of 5 minutes

per gigabyte of input files was good-enough and the added complexity

not justified. Quality options supported by paint dot net are all

allowed to default. In the case of a resize, the Bicubic algorithm

is used. Works with the paint dot net internal file types, those

being bmp, gif, jpg, png, tga, tif, and pdn.

Author - [deleted]

Copyright © 2012 [deleted]

Licensed under the Apache License, Version 2.0 (the "License");

you may not use this file except in compliance with the License.

You may obtain a copy of the License at

*

http://www.apache.or...ses/LICENSE-2.0

*

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an "AS IS" BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

2. Usage

To run successfully you need to put the SimplePdnBatch.exe in the

Paint.NET directory in Program Files (or, it may work if you put

SimplePdnBatch somewhere else but make the Paint.NET directory your

current directory). This is necessary so that code in Paint.NET

dll's can find required resources.

The command line is simple:

SimplePdnBatch pathToScriptFile

The script file is a simple text file with a series of lines of the

form

{option}={value}

where the following are supported (and a valiant effort is made to

ignore all else):

OutDirectory=directoryPath

Sets the output directory for subsequent files to the given directoryPath.

If the directory does not exist it will be created.

ScaleX=number

ScaleY=number

Sets the horizontal and vertical scale for subsequent files to the given

numbers, e.g. 0.5 for 50%.

OutType=extension

Sets the output file type for subsequent files to the type matching the

extension, i.e. bmp, gif, jpg, png, tga, tif, pdn and their synonyms.

InFile=filePath

Requests to process the indicated file with the current settings. Thus to

reduce to 25% size (50% each way) set ScaleX and ScaleY to 0.5 BEFORE

the line naming the file. If the settings result in the output path

matching the input path exactly the operation will be rejected: the input

file will not be overwritten. But if the output file already exists it

will be replaced without notice.

InDirectory=directoryPath

Requests to process the all recognized image files in the indicated directory

using the current settings.

//[anything]

A comment or commented-out line

Example: convert all images in C:\Images\Master to 1/4 size png files

in C:\Images\Web.

OutDirectory=C:\Images\Web

OutType=png

ScaleX=0.5

ScaleY=0.5

InDirectory=C:\Images\Master

Edited by spacecat56
Link to comment
Share on other sites

Utilities like this aren't allowed on the forum either. Only effect and file type plugins. Paint.NET isn't an image processing library, it's not licensed to permit such a thing.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Feel free to do whatever you'd like for personal use, I'm not in the business of trying to be totalitarian. It's just not permitted for the forum, and technically not permitted by the license for any type of distribution. But I don't really care what you do in the privacy of your own home, so to speak.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...