Jump to content

Windows Registry Hacks/Other miscellaneous tweaks

From Wikibooks, open books for an open world

Adding Resize option to images

[edit | edit source]

This hack will allow any JPG file to be resized from the context-menu. First: get ImageMagick toolkit for windows from This site and install it. Next: create a cmd file (a batch file for windows NT,XP, Vista) with the following contents:

@echo off
set CONVERTPATH="C:\Program Files\ImageMagick-6.3.7-Q16\"
if "%2"=="" goto NoSizeArgument
set SizeVariable=%1
set FileOnly=%~n2
set FileExtension=%~x2
set FilePath=%~p2
set DriveLetter=%~d2
goto DoConvert
:noSizeArgument
set SizeVariable=1024
set FileOnly=%~n1
set FileExtension=%~x1
set FilePath=%~p1
set DriveLetter=%~d1
:DoConvert
%CONVERTPATH%convert.exe -resize "%SizeVariable%x%SizeVariable%>" "%DriveLetter%%FilePath%%FileOnly%%FileExtension%" "%DriveLetter%%FilePath%%FileOnly%_%SizeVariable%%FileExtension%"
echo resized %FileOnly%%FileExtension% to %FileOnly%_%SizeVariable%%FileExtension%

Let's say we name this file C:\Program Files\ImageMagick-6.3.7-Q16\convert1024.cmd Now we have the command at hand to resize an arbitrary image to max dimensions of 1024x1024, keeping the aspect ratio intact. Here's how we add this command to the context menu:

  1. Open any folder (e.g. My Documents)
  2. Go to Tools | Folder Options...
  3. On the opened dialog, go to the File Types tabsheet
  4. Select in the "registered file types" the file type you want to add the resize option for. E.g. choose JPG for the most commonly used file format.
  5. Click the 'Advanced' button.
  6. In the dialog that just opened, click the 'New...' button
  7. In 'Action' fill in the description of the resize action. E.g. enter 'Re&size to 1024x1024 max'
  8. Click the browse button, and navigate to the cmd file we created in the beginning. Select it, and Click OK to confirm it all.
  9. Close the File Types dialog, and presto: you now have a resize command at the ready.