Irfanview is free graphics editing software for Windows. It is meant for editing existing files, not drawing new images. Use Photoshop, Illustrator, Inkscape, Powerpoint, Paint, and other graphics programs to make new images. The purpose of Irfanview is "only" editing, but it is packed full of useful science tools such as cropping, resizing, bright/contrast/gamma/hue adjustments, image resolution changes, color replacement, conversion to grayscale or black/white, batch conversion of file type/size/name, and more.
I love Irfanview for renaming microscopy photos, which I show below.
Step 1: Download and install Irfanview.
Step 2: Save microscopy photos. If your microscope allows you to export photos but not to name them (like my example here), then take a "spacer photo" in between your samples so that you know when sample A ends and sample B begins. Spacer photos can be anything that looks different, for example a photo of a dark or white area that you will recognize is not either sample. In my example here, I took two photos of the text labeling on the hemacytometer, in between samples.
Step 3: Open Irfanview and select File:Batch Conversion/Rename...
Step 4: Select all the photos of your first sample and drag them to the "Input files:" window. Below, I have two spacer photos (see darker regions in ...4-19.jpg and ...4-29.jpg) that separate sample A and sample B.
Step 5: Click on "Sort Files" and sort by date so that your files won't be scrambled after renaming.
Select "Work as:" setting "Batch rename" for this example. Note that Irfanview also has other file conversion options such as re-saving as a different image filetype, different size image, and more.
Under "Batch rename settings:", fill in the "Name pattern:" text box with your desired new filename pattern. Here, I am using Irfanview's shorthands for two digit numbers (##) and the file extension ($O) which in this case is ".jpg" for all files. By default, Irfanview will replace ## with 01, 02, 03, 04, 05... etc. The name pattern options allow you to select a different starting number and increase number.
I expect the filenames to to progress as:
A_10x_01.jpg
A_10x_02.jpg
A_10x_03.jpg
etc.
If I wanted three digits instead, I would use ###
Here, I am ignoring "Output folder for result files:" because my batch rename settings are set to rename the original file (see Options), which Irfanview warns is risky.
Step 6: To reduce risk of something going wrong and losing my original files, I select "Run test rename" and examine the results for unwanted patterns. For example, if I forgot to add ## to the name pattern and only used "A_10x_$O" then each image would be renamed to:
A_10x_.jpg
A_10x_.jpg
A_10x_.jpg
etc.
That would be a mistake! However, I did not forget to add ## and I don't have more than 99 photos, so duplicate names are not a problem. "Run test rename" concludes with zero errors and zero warnings.
Once finished, click on "Return to batch".
Step 7: After examining the results of "Run test rename" and seeing no problems, then I run "Start Batch" to rename my actual files for real.
Once finished, click on "Return to batch".
Step 8: Under the "Input files:" window, click on "Remove all" to remove the original input files in preparation for your next batch rename.
Step 9: Now select sample B files and drag them to the the "Input files:" window. I am selecting the files after my two spacer photos. Do the same above steps, but with an updated name pattern specifically for sample B.
By the way, here is the window that comes up when I click "Batch rename settings:Name pattern:Options".
Step 10: After renaming sample A and sample B batches, I had regret. I should have added the cell stain I used! Oh no! But no worries, I don't need to re-select each sample batch and rename the batches separately. I can rename everything at once by adding all my updated files to the "Input files:" window and updating the name pattern options.
I don't need placeholder "##" to add numbers this time. I plan to edit the existing filenames, which are already unique.
Name pattern: $N$O will produce the filename and extension, for example "A_10x_01.jpg", where
$N = A_10x_01
$O = .jpg
This is what I want Irfanview to do this time:
- Replace text "A" with "trypanblue_A"
- Replace text "B" with "trypanblue_B"
I used "Run test rename" just in case I was not thinking of a possible error, but it looked fine, so I used "Start Batch" to rename all my files.
After finishing, I don't need to do anything else so I can click "Exit batch" to close the batch rename window entirely.
Extra example:
Irfanview has advanced pattern recognition options. I showed you ## (two digits placeholder) and $N$O (filename.extension) above, but you have many more options!
For example, if your camera has photos with names such as:
D30001.png
...And you want to rename your photos to have a consistent name pattern that includes the date, then using IrfanView with the pattern below will result in filenames such as:
Photo_2023-09_p01.png
Photo_2023-09_p02.png
In Irfanview, $T indicates the time the photo was taken, and the stuff in parentheses indicates how you want the time to be formatted.
Here is the beginning (not all!) of Irfanview's patterns for photo names:
According to this key, we could have used just $F instead of $N$O above.
No comments:
Post a Comment