The Image Command

I have some questions about the image command:

Does it resize it for the device? I have a rather large 2034x2048 image that I would like to display. In the past, I’ve made sure to convert it to .JPG This one is .PNG Is that a problem? Will it show actual size, which is way to big? Should I reduce it to another size, and if so, what size would be optimum?

I want to be sure that the options I choose work for publication, @dfabulich

Thanks!

4 Likes

Oddly I was just asking myself about this too. :blush: My testing suggests it does, but it would be nice if someone who knows more can confirm the resizing is foolproof on mobile devices

1 Like

Short answer: Yes.
Long answer: It uses CSS: max-width: 100%;

Secondary Notes:

  1. It’s preferable to use .png files for quality reasons.
  2. The full command is *image source alignment alt
    a. Source is the image name (with file extension).
    b. Alignment is either right, left, center or none. (Optional unless alt is used.)
    c. Alt is the text that is instead displayed to visually impaired users using a screen reader. If and image is important to the story, you should use alt text so that it is understandable by more players.
7 Likes

So, I can just *image the file using .PNG format and not worry about the picture size because it will choose the “max size” which is essentially a decent screen size?

Right. If the device is smaller than the width of the image, the image will be reduced to the device size (with a small margin on either side because of how things are set up).

1 Like

@Sithwist (Or anyone else with wiki access.) Any chance that we can get this information added to the image page on the wiki please?

3 Likes

Two quick questions before I add this to the wiki.

  • Which image file formats are supported?

  • Does the image file really need to be in the mygame folder? Is there a way for organization’s sake to put the images in an image folder and tell the command where to find the image? Something like *image mygame/myimages/wolf.png?

4 Likes

Any image format is supported. (That is, the only thing it does is grab the file name with extension and try to display it. How it’s displayed is determined by the device.) Unusual/non-standard inputs may lead to odd results (e.g. SVG files get squashed for some devices because no one appreciates dynamic images.)

I’d have to double check for all devices, but it should to work. (That is to say, off the top of my head, I don’t see why it would break, but that doesn’t mean it won’t break when packaged for publishing.)

2 Likes

Ok, I edited the wiki page. Thanks, as always @FairyGodfeather for calling my attention to this. Should be more complete now. :slight_smile:

For anyone interested, I just tested this and yes, you can put the images in a “myimages” folder in the “mygame” folder. You just have to say *image myimages/wolf.png, and that works fine. That folder can be called whatever you like, of course.

4 Likes

FWIW in the past I’ve manually shrunk the images to a size where they would be appropriate for iPad. Anything larger than that is just wasting space.

2 Likes