Add Timestamp to Images

ImageMagick needs to be installed, including legacy tools, and in the path Takes files with the format yyyyMMdd.jpg in the current directory, and adds a stamp to the bottom-right corner in the MMM dd yyyy format. Creates a new file named “stamped.yyyyMMdd.jpg”

Convert PDF to JPG

This is a pretty limited use case, probably something that will never be needed, but if you need to convert a PDF file to a JPG image, you may be able to do it with this command: Prerequisites ImageMagick Ghostscript VC++ 2013 redistributable

Add timestamp to photo using ImageMagick

rem dptnt.com/2009/04/how-to-add-date-time-stamp-to-jpeg-photos-using-free-software/ @ECHO OFFSETLOCALFOR /R %%G IN (*.jpg) DO CALL :process “%%G”GOTO :end :process SET _inname=%1 identify -format %%w %_inname% >dttmpfile set /p width=<dttmpfile Set /a pointsize=%width%/50rem echo ZZ >> dttempfile DEL dttmpfile ECHO Processing %_inname% … convert %_inname% -gravity SouthEast -font Arial -pointsize %pointsize% -fill orange -annotate +%pointsize%+%pointsize% “%%[exif:DateTimeOriginal]” %_inname% EXIT /B:end

Shrink image with ImageMagick

@ECHO OFFSETLOCALFOR /R %%G IN (*.jpg) DO CALL :process “%%G”GOTO :end :process SET _inname=%1 SET _outname=%_inname:~0,-5%_1024.jpg” identify -format %%w %_inname% >width.txt identify -format %%h %_inname% >height.txt set /p width=<width.txt set /p height=<height.txt DEL width.txt DEL height.txt ECHO Processing %_inname% … if %width% gtr %height% call :landscape %_inname% %_outname% if %height% geq %width% call :portrait %_inname% […]

Add EXIF date to photo

If you have a photo that you need to add a timestamp to the EXIF information, you can use the following .NET code. Apparently there are a ridiculous number of formats and standards which are incompatible with each other and conflicting, but from what I’ve found, this should cover regular use cases. I’m sure there’s […]

Get EXIF date from photo

It’s not straightforward to retrieve the EXIF date from an image. Here’s a method to retrieve it using the MetadataExtractor package. It looks for the appropriate date, and if not found, falls back to the file properties. // <package id=”MetadataExtractor” version=”2.0.0″ targetFramework=”net40″ /> static DateTime GetImageDate(string file) { var directories = ImageMetadataReader.ReadMetadata(file); ExifSubIfdDirectory subIfdDirectory = […]

Add EXIF date to photo

If you have a photo that you need to add a timestamp to the EXIF information, you can use the following .NET code. Apparently there are a ridiculous number of formats and standards which are incompatible with each other and conflicting, but from what I’ve found, this should cover regular use cases. I’m sure there’s […]

Resize image in .NET

This will resize image to be 1024 height or width (whichever is bigger). Explore other options to look for things like image quality. using (var image = Image.FromFile(file.FullName)){ int newHeight, newWidth; if (image.Height > image.Width) { newHeight = 1024; newWidth = (int)(1024.0 * image.Width / image.Height); } else { newWidth = 1024; newHeight = (int)(1024.0 […]

Check if two images are similar

I was trying to dedupe my photos, and found that identical photos didn’t have identical file contents, because of the way they were stored in Google Photos, or iCloud, or Amazon Photos, or wherever else I had them stored. So this method will look at two photos, see if they have the same dimensions, then […]