Automatically size images based on dimensions provided in filename (if present)

Some maps will come with their width and height (in cells) embedded in their filename (ex: cool_map_10x13.png). Dungeon Scrawl for example allows you to export your maps this way.

Shmeppy will now detect images with dimensions in their filenames and use those dimensions.

dimensions

Happy Shmepping ya’ll!

Some extra details for those interested:

  • Both dimensions need to be between 1 and 999 for Shmeppy to respect the value.
  • The dimensions need to be written as two numbers with only an x between them, no whitespace allowed. So 100x100 would work but 100 x 100 would not.
  • The dimensions need to be preceded and followed by a _, a ., a -, a space, or the beginning/end of the name. So 100x100.jpg, cool-map-100x10.jpg, and rad stuff 100x1.jpgwould all work butham100x100.jpg` would not.
  • If the named dimensions would cause the image to have cells 3 pixels or less wide/tall, they’ll be ignored.

For regular expression enthusiasts, here’s the regex Shmeppy is matching against: (?:[\s_.-]|^)([1-9][0-9]{0,2})x([1-9][0-9]{0,2})(?:[\s._-]|$)

3 Likes

Hey, I use Dungeon Scrawl sometimes! That’s super duper cool. Thanks for the update, John!

1 Like

can you add in an option to scale the image whether it has dimensions in the file name or not?

i like this idea, maybe a small popup to specify if the image doesn’t have dimensions in the file name? or a checkbox to toggle said popup?

1 Like

I did some experiments awhile ago in automatically detecting grids in images and had some decent success. I think it’ll work especially well with Shmeppy’s current UI because even if it’s not perfect it should be quite natural to nudge it to be perfect.

I’m going to try that first before adding in any UI elements to size by row and column, since I think that will end up being quite heavy.

1 Like

I’m a fan of the automagic approach, if that’s possible. It seems to work pretty well in other vtts.