Why I did this is a short story that I can share here, I downloaded a free pack of icons in PNG format, now all of them were really good. The number of icons in icon pack was roughly just over 200. Now I wanted them to be 24×24 pixels. I know that I could have done some CSS magic and bring the size down to 24×24 but I thought may be I haven’t done anything in C# in a while so why not see how difficult it will be to create a command line tool that just do resizing and watermarking on the images.
I did couple of hours reading turn out to be that It actually simple to manipulate Images in .NET with all the classes such as Image, Bitmap, Graphics available to assist me. SO I thought well the reason is there so lets start. I quickly assembled the requirement of what I wanted and started coding.
Now I have touched c# after a while so it took me couple of hours to get used to using DOT (.) rather than (->) that I use in PHP for Object manipulations and use.
Ok so I know this could not be the best of the util available but I think I did just enough to convince anyone or primarily myself that its a sharable FREE product that could be handy tool for some.
I did lot of readings on Image manipulations with .NET so hopefully this tool is just reflection of my readings.
When I started to write this tool, it just started with Resizing an Image (v0.9) but then I thought may be watermarking can also be done in Image iteration loop then why not introduce that too.
I am doing a website just for this util because I think it could be a helpful tool. So more documentation and usage example will be available from there.
Alright enough of chit chat lets start by looking at this util now.
jcResizerCmd – A command line util.
How to use it
Here is the command structure
Ok so as you can see that there are few options available thats all I needed. May be I should think of adding image rotation angle too. But I thought that may not be important.
All the options are self explanatory but just in case you want to know more jump on to the dedicated website for the tool and learn more about it.
The best part of this util is when I added -recursive switch to it in version 1.0. What this option does is, say you have folder A which has sub folder B and C. When you use this switch it will search for all the images in the subfolders as well, it does not matter what depth your file lives in. Best part is that It will create exact same structure in the target folder specified with resized or watermarked images. I know that primary school programming but I just got excited there
- Initial Release
- Added watermark texts
- Added recursion for file lookup
- Folder structure will be copied to target folder if -recursion is used
- Added Image watermark opacity option
- Added -copy-meta-info switch that allows you to keep original Image meta data such as modified time etc.
So I used this command on my son’s picture
- c:\jcResizerCmd>jcResizerCmd.exe -source=g:\resizetest -target=g:\resizeresult -resizetype=percentage -resizevalue=5 -wm-text="copyright jaspreetchahal.org 2012" -wm-style=medium -wm-position=center -extension=jpeg -wm-img-opacity=3
Now the result of that is shown below
Because the Image is really big thus I used to reduce the size to 5% of the original size
Result below is 10% of the original size and save
- c:\jcResizerCmd>jcResizerCmd.exe -source=g:\resizetest -target=g:\resizeresult -resizetype=percentage -resizevalue=10 -wm-text="copyright jaspreetchahal.org 2012" -wm-style=medium -wm-position=center -extension=jpeg
Now you can add Images as water marks too.
Examples – Image watermarks
I got another Image that I will be using with my son’s picture (another one) as a watermark so I will change the above command to look like this
- c:\jcResizerCmd>jcResizerCmd.exe -source=g:\resizetest -target=g:\resizeresult -resizetype=percentage -resizevalue=10 -wm-text="copyright jaspreetchahal.org 2012" -wm-style=medium -wm-position=center -extension=jpeg -wm-img-opacity=3 -wm-image=g:\watermark.jpg
You will have to change the path to make this work for you. The result of my above command will look like this
The watermark image is below
So you see that there are many other options that you can play with e.g.
- setting Image watermark opacity
- setting size in pixels
- setting size
- image meta info
- watermark text
- converting images from one type to another
- recursive look up
- watermark positioning
- and much more
Ok so another question is where to download.
Surprise Surprise. Archive is only 10Kb and the jcResizer.exe is on 22KB
Now its just one exe file that does all this which is really great. I can only guarantee that file downloaded from this site or the utility site will be free of Viruses. If you are downloading from another source I cannot guarantee that.
Use http://www.implbits.com/HashTab/HashTabWindows.aspx to verify checksums.
[No membership required]
Just leave a comment with Message starting with
your comment may not appear when you prefix your message with any of the above message because it will land them directly to my bug tracking system after I approve them. As this is new post thus new general comments will now be accepted.
- .NET framework 2+
- Valid image files
I will appreciate that If you can donate some Ice Tea
Fixed bugs in v1.1
- Left positioning of Image watermarks
- -resizetype switch value ‘set‘ is now known as ‘pixel‘.
- -wm-style “big” does not go beyond Image width.
This tool is one of its kind and saved me hell amount of time, it does what its meant to do without any fuss or problems. v1.0 is awesome. Better than 0.9. Are you planning UI version?? - Navs
Follow me on some well known social media sites to get no so exciting updates from me I can make you laugh occasionally that’s a guarantee.
I hope you will enjoy this tool
you feedback is much appreciated.