Viewer: Grow-to-page breaks 'Auto-size viewer window' option 'To fit the first picture'

I'm not sure whether to consider this a bug or feature request, but the issue sure is annoying. If there is already a way to resolve it that I'm missing, please let me know!

Problem:
When I change the Viewer to 'Grow To Page' mode while cycling through a directory of images, the next time I open a new Viewer window, it makes the window as large as possible, ignoring that I have set the 'Auto-size viewer window' option 'To fit the first picture'.

In my case, I never want to make the image fill the screen like this but I can't figure out how to avoid the behavior.

Request:
Make a sub-option to respect 'To fit the first picture' setting even when 'Grow To Page' is enabled.

Use case:
I am working with a lot of images created with Stable Diffusion AI image generation (which is all the rage, these days). They're often created in large batches, and very typically there will be a smaller (first pass) image followed by an upscaled (second pass) image that was based on the first.

While evaluating the effects on the images from countless parameter changes, I am very frequently opening and closing multiple side-by-side Viewer windows, cycling through the image lists in each Viewer, and also switching between modes 'Original size' and 'Grow to page'.

The scaling mode I use depends on if I want to see the images 'pixel perfect', or compare the general composition of the first pass vs. second pass images at matching scale (either side-by-side or flipping back and forth with mousewheel).

Unfortunately, the current behavior of 'Grow to page' making the next viewer window as large as possible causes a lot of aggravation. To avoid the issue, I'm forced to try and remember to switch back to 'Original size' mode every single time, or when I inevitably forget, I have to switch modes -> close the Viewer -> open a new Viewer.

Manually resizing the window is likewise tedious, as well as manifests the terrible scaling quality from the built-in Windows functions. Furthermore I constantly end up with the wrong window size when switching back to 'Original Size' mode, causing scrollbars to appear, making me resize the Viewer again.

Directory Opus is nearly perfect for my workflow, I think this issue and the terrible image scaling quality remaining after all these years are the only flaws.

(You guys really are working on the Viewer rewrite you've mentioned in other posts, right? riiiiigghht? :wink:)

That's what "Grow to Page" does. It displays the image as large as possible while keeping all of it on-screen.

Use "Fit to Page", next to it, instead if you only want to reduce images larger than the screen and not enlarge images smaller than it.

Thanks for the fast response! Yeah, I know the difference between the two, but I want the Viewer window to stay at the size of the first image opened, so that later images I cycle between are then affected by 'Grow to Page'.

For example: I want to open a second-pass (larger) image first, with it sizing the Viewer to the original image size. Then when I cycle through the smaller first-pass image (and later images), they will all fit that same window (per Grow to page).

Currently, the Viewer window size will automatically fill the Desktop area as much as it can, which I don't want.

I think I understand. Try this...

Set:

  • Auto-size viewer window = To fit the first picture
  • Reset zoom level for each picture to = Fit to Page

Drag this script to Preferences / Toolbars / Scripts (or to the /scripts folder alias):

function OnInit(initData)
{
	initData.name = "ViewerInitialSize";
	initData.version = "1.0";
	initData.copyright = "(c) 2023 Leo Davidson";
	initData.url = "https://resource.dopus.com/t/viewer-grow-to-page-breaks-auto-size-viewer-window-option-to-fit-the-first-picture/44255/4";
	initData.desc = "Switch viewer to grow mode after loading first image.";
	initData.default_enable = true;
	initData.min_version = "12.0";
}

function OnViewerEvent(viewerEventData)
{
	if (viewerEventData.event == "load")
	{
		viewerEventData.viewer.Command("zoom,grow");
	}
}

That should result in what you want, with one caveat that the subsequent images (if smaller than the window) will appear at 100% size very briefly but then immediately enlarge to fill the window. The window will stay the size of the first image.

Thanks! I will try out how it works tonight and report back.

I tried it out, however it causes another side-effect besides the flickering for smaller images.

It doesn't let me use other zoom modes, such as 'Original Size' (which I use about half of the time), since cycling to the next image always sets it back to "zoom, grow".

Between these effects, it's unfortunately not viable for me.

Would it be a small and easy enough change to add an option in a future release like "Fits the first picture in Grow To Page mode" in Preferences->Viewer->Appearance ?

Of course, it only makes sense if "To fit the first picture" is selected for 'Auto-size viewer window', so I guess grayed out otherwise.

Here's a mockup of what I imagine (change in red):

Meanwhile I also tried to find some kind of way to change the zoom mode to "Original Size" when closing the viewer, if it is set to "Grow To Page" at the time. It would have to be before it's destroyed I think, but it doesn't appear that such an 'on-close' event exists.