How to properly use the Slicr command line tool?

Started by woozyvision, October 16, 2018, 09:03:13 PM

Previous topic - Next topic



I'm having trouble understanding the Slicr command line tool and how to use the snippets properly in the documentation. I'm usually able to search google and piece something together. I must be looking in the wrong places.

All I want to do is make a command line prompt that automatically slices as many 300 x 600 pixel images from the selected image or images. The slices are automatically saved to the location of the original file that was selected and processed. The original file is left untouched.

Ideally, I don't want to have to input any file names or destinations. I plan to add an option in the context menu, so I can just select my photos, right click and say left click "slicr 300 x 600" and it handles the rest for me.

I apologize if there is any confusion on the goal at hand. I don't know how to further explain. Anyone who could help me accomplish this would be much appreciated.


Richard Moss


Welcome to the forums and thanks for the question.

Are you able to clarify which version of the tool you're using? There are a number of bugs and documentation errors in how 0.3 processes files, so you should probably use 0.4 if you're not already.

The following command line should take the source input file and slice it up in 300x600 chunks. Each chunk will be saved in the working directory with a filename based on the source image, overwriting any existing files.

grid.png /a:fixed /z 300 /v 600 /y

There are a few caveats however

  • The CLI doesn't allow for wildcards in filenames yet so it can only do one file at a time. This sounds like it should be fine in your scenario as if you mean an Explorer context menu I believe it will execute the action once per file
  • Images will generated for any left-over pieces at the right and bottom of the image. Now that I've seen this behaviour I don't like it so I've logged an issue (#335) to let the behaviour be controlled

If you wanted to manipulate the filename slightly to avoid any chance of clashes, you can specify a custom string that still means you don't need to provide any concrete filenames, but Slicr will fill the bits, for example

grid.png $(ImageName)-Partial-$(SliceIndex).$(SliceExt) /a:fixed /z 300 /v 600 /y

However, as I said, this will only work with 0.4 as 0.3 had quite a few bugs in command line processing (and no doubt there's still a few more to go).

I will review the documentation as well as it doesn't seem to be helpful enough as it is!

Hopefully this information helps, please let me know if it doesn't. If you do decide to use Slicr for your processing then any feedback would be gratefully received.

Richard Moss
Read "Before You Post" before posting. Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.