Advice needed for displaying images with I7 in 2022

I have someone who is making some art for my game, and I’d like to give players a good experience with it. I’ve just looked over the documentation. It seems that Inform doesn’t do anything fancy out of the box, which is fine. I just want to display the art at specific points in the narrative.

It seems that with default I7, the resolution of the image is a consideration. It doesn’t seem that images can be scaled to window size (I saw no mention of it), so I think it would be important to decide on a good resolution. That’s a moving target, but I can at least be intentional about it.

Or perhaps there is an extension that handles this kind of thing? I’d love some advice.

I am assuming that this would be a good job for Vorple, but I want to maximize portability to various interpreters, which doesn’t seem to be Vorple’s thing.

2 Likes

The interpreter is expected to display the image at a reasonable size by default, like how it’s expected to have a reasonable font size and such. The author’s ability to tweak this directly is pretty limited.

2 Likes

The image will have a resolution, though, which the author does control. I think it would be a bad idea to specify an image with 8k resolution, and likewise it’s probably a bad idea to do a 320x200 image. Since there are bad ideas (or at least less broadly appealing ones), there might be good ideas. I wonder what resolutions have authors used in the past.

2 Likes

If you’re showing graphics in a graphics window, then you can set the window to be of a maximum pixel size so that it will never be stretched larger. But you’d also want to set a maximum proportional size so that it doesn’t consume the whole game window if the window is small. See Counterfeit Monkey for an example of how this works. I don’t remember if this functionality was included in Flexible Windows by default yet; it may need some extra code.

But that said, this doesn’t account for higher pixel densities. I proposed a Glk extension to expose pixel densities, but there hasn’t been any interest for it yet. You could just fudge it by always using a double density image.

4 Likes

Thanks! I’ll go take a look at Counterfeit Monkey and return if I have questions.

2 Likes

It occurs to me that I could have a player select a resolution up front. That would make for a big game file, but I’m not sure there would be other downsides. I’d probably do 480p, 720p, and 1080p. And an alt text mode, of course. There’s some variation between popular terps (at least that’s what I’m seeing), so I would likely need to present options regardless of window resolution.

I’m still interested in graphics windows, too. Could splash the whole image, then put a crop of it in a window. If I can get that working in time for Spring Thing.

1 Like

I would say if you only want to show a graphic occasionally during the game, and you don’t want/need it to sit onscreen afterwards in any special way, consider going with Inform’s native treatment. I.e “Display the figure of Yada yada.”

If the graphics are all wider than taller, they’re all going to be scaled to fit the interpreter width. So if you put in graphics that are large (horizontally larger than is needed) you can roughly guarantee they’ll fill the screen width, with a bit of text appearing above and continuing below. Most players will size the screen to be not super wide, due to the fact it’s easier to read narrower columns.

This all sounds kind of vague, but graphics always are. You either nail everything down in a framework with extra programming then suffer when resolutions increase in the future, or you can put in larger-than-necessary graphics now, with no extra programming required, and the option to replace just the graphics files in the future. Again, this is assuming you’re mostly using wider-than-taller graphics. If you use a graphics window, it’s potentially clunky if it has to appear and disappear. I guess my overall advice is - don’t go to any extra windows or programming unless you find you need it. The built-in scaling to fit the window might cover your needs. Especially since graphics tools for I10 aren’t advanced yet.

-Wade

3 Likes

I’ve only made this thread because that isn’t my experience. I put a 3000x2000 (ish) image in a test project. Here are the outcomes. Note I’ve downscaled the screenshots to keep things manageable, and please further note that I have not done a lot of configuration (with the exception of Gargoyle, because it invites that) to these terps. If I’ve made a silly configuration mistake, please advise!

Lectrote:


WinGlulxe:

Parchment:

Gargoyle:

These are just the ones that I use frequently. I’m fairly certain that if I maxed the right-hand story pane of the Windows IDE, it would scale, too.

Resizing to 1500p and re-releasing didn’t change the outcomes (some scaled and some didn’t).

Just for scientific purposes, I compiled with an 8K image. Nothing scaled that one. So there are clearly limits.

Edit:
Resolution 2.8k.gblorb (810.3 KB)
Resolution 1080p.gblorb (819.6 KB)

2 Likes

I don’t see anything in the Glk spec requiring or even suggesting that images in buffer windows be scaled to fit, but it does sound like a sensible thing to do. I could add it to AsyncGlk/Parchment.

3 Likes

Nice. I was surprised by Wade’s comment, just because I’d never seen scaling mentioned as a given.

As is, it seems like the friendliest thing to do would be to allow the player to choose and just compile with multiple image sizes.

1 Like

Personally I’d avoid asking the player for something like this, because I think you can do pretty well without. And there’s the risk of confusing players if the question is quite technical. (Questions like “Are you using a screenreader?” are harder to misunderstand than what resolution someone has.) But a question like “Big, medium, or small images” would be okay.

Are you aware that you can measure the size of the interpreter window in pixels? You just can’t measure the pixel density.

1 Like

I thought I’d just say small medium large, then show a test image with a y/n

Is that in the docs? I’m not smart enough to know things that aren’t in the docs. I’m guessing that’s printable area and not window size? That’d be handy

1 Like

If you open up a temporary graphics window then glk_window_get_size will return pixel measurements instead of characters. But that does mean that an internal window margin (padding in CSS terms) wouldn’t be accounted for, so if you set an image to the measured pixel size it would be slightly too big.

I’m thinking I should add my pixel ratio extension, it won’t actually be too hard to do. Only question is how to return the ratio. 32 bit float? Multiply by 1 million and send as a uint32?

3 Likes

Oops, sorry. It’s obviously been longer than I thought since I tried things the simple way.

Looking at Parchment / Lectrote’s output alone, you will have to use a graphics window so that the scaling is done by your program and not the interpreter.

-Wade

2 Likes

Are you using I7 6M62 or Inform 10? (Phil’s parallel thread is about v10, but I think your version wasn’t explicitly mentioned in this thread, unless I missed it.)

Going by the “2022” from the thread title, I guess you are probably employing the latest version.
But if you are still writing in I7 6M62, you can use Emily Short’s “Simple Graphical Window” extension, for example. With that, images which are too large should be scaled down by default.

2 Likes

I am current. I don’t use a lot of extensions, so it may not be hard to go back. I’ll mess with it and see how it goes.

1 Like

I’m working on this now, too. I had an image that was huge, even maximizing Gargoyle on my laptop couldn’t display it all.

Now I shrunk it a bit and it looks like this:

image

This is in Gargoyle’s default size. I’m thinking of shrinking it to fit nicely into default Gargoyle’s window. Does that sound like a good idea?

(I could just make this version web-only and use CSS to scale it to window width, but I’m kind of leaning toward a standalone file).

Is there no autofit feature? ideally the picture would scale with window resize.

1 Like

Gargoyle doesn’t have that feature. I could just bundle with Lectrote and modify CSS before doing so, but it’s very hard to get that working on PC. So given what I’m working with (interpreters that don’t auto-scale), I’m looking to see what people prefer. I also want to think about mobile (Frotz specifically).

Edit:

Looks like Frotz autoscales:

This isn’t where that image will go in the long run, I’m just checking things.

2 Likes

Autofitting and resizing needs code to implement it. Ideally there’d be extensions to do it. Though it’s probably not possible to change the size of an image in a buffer window after it’s already been added.

1 Like