How to make an image (width, height) smaller?

Ask for help and post your question on how to use XnView MP.

Moderators: helmut, XnTriq, xnview

Elk
Posts: 176
Joined: Wed Feb 27, 2019 6:17 pm

How to make an image (width, height) smaller?

Post by Elk »

I want to make an image smaller, its sizes, not the file size. So instead of being 2600x1400 px it shall be 600x400 px or so. The ratio kept
Something like that does not seem to work:
Image

How do I do it?

Nothing shall be cutted / cropped. The entire image shall be kept, but gettings smaller.
cday
XnThusiast
Posts: 4397
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to make an image (with, height) smaller?

Post by cday »

Elk wrote: Wed Nov 23, 2022 10:12 am I want to make an image smaller, its sizes, not the file size. So instead of being 2600x1400 px it shall be 600x400 px or so. The ratio kept

Nothing shall be cropped. The entire image shall be kept, but smaller.

How do I do it?
As your start image has pixel dimensions 2600x1400 px and a width-height ratio of 1.857, and the image you need has pixel dimensions of 600x400 px and a different width-height value of 1.5, and none of the content of the start image must be lost, the only option I can see is to add blank canvas where required in the final image to maintain the width-height ratio.

Would that be acceptable, or do you need to reconsider how you are approaching the problem? If it would, I think you probably only need a Canvas resize action with suitable settings.
Elk
Posts: 176
Joined: Wed Feb 27, 2019 6:17 pm

Re: How to make an image (width, height) smaller?

Post by Elk »

As your start image has pixel dimensions 2600x1400 px and a width-height ratio of 1.857, and the image you need has pixel dimensions of 600x400 px and a different width-height value of 1.5, and none of the content of the start image must be lost, the only option I can see is to add blank canvas where required in the final image to maintain the width-height ratio.
Sorry for the faulty dimensions. Should just have been an example (with wrong values).

E.g.: I want this photo
Image
look like this:
Image

So everything is kept, but the width and height are smaller. What exactly did I have to do?
If it would, I think you probably only need a Canvas resize action with suitable settings.
Yes, I would think so, too, but I am not able to get that work.

Doing this (with the image above)
Image
Image
gives that:
Image
cday
XnThusiast
Posts: 4397
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to make an image (width, height) smaller?

Post by cday »

If you want to keep the whole image content, but change the image pixel dimensions, and use a different width-height ratio, accepting that as in your posted images above the image will be slightly distorted, I think that you can do that with a Canvas resize with suitable values.

If you have difficulty doing that, post an example start image and the required pixel dimensions of the final image, but I may not have time to look at it until later today.

There might be another possible approach to your overall problem, that would avoid the final image being distorted, depending on how the final images will be used: add canvas as mentioned in my first post above, but use the option which I think is available to make the added canvas transparent. Then, depending on how the images are to be viewed, the full image content might be seen with the correct width-height ratio without the added canvas being visible.
Elk
Posts: 176
Joined: Wed Feb 27, 2019 6:17 pm

Re: How to make an image (width, height) smaller?

Post by Elk »

and use a different width-height ratio
No, no, the ratio not being changed, the ratio shall be kept. The same like it is on the examples above, the image, what you see just smaller, no changes, only smaller, the width shorter and the height short, but keeping the same aspect ratio, that shall be unchanged. Just the entire image smaller, the Surface. As can be seen in the example. Does the canvas resize do that? I would think so. But I am not able to do it with that option.
If you have difficulty doing that, post an example start image and the required pixel dimensions of the final image, but I may not have time to look at it until later today.
Thank you very much! I appreciate that very much. But I have to be able to it myself, there some more images to resize. Yes, extremely hard problems, looks extremeley easy, but I do not make it. May be a step by step explanation would help. So what do I have to set here:
[IMG]https://i.imgur.com/vGklxNw.pngIMG]
There might be another possible approach to your overall problem, that would avoid the final image being distorted, depending on how the final images will be used: add canvas as mentioned in my first post above, but use the option which I think is available to make the added canvas transparent. Then, depending on how the images are to be viewed, the full image content might be seen with the correct width-height ratio without the added canvas being visible.
OK, but the not distorted image would be good, just smaller, nothing changed but only the visible size. Without transparency. Just the pure image. ONLY smaller.

Many thanks!
cday
XnThusiast
Posts: 4397
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to make an image (width, height) smaller?

Post by cday »

The images you posted in your previous post have a white border around them which didn't display in my XnView MP set to have a white background.

I can't continue at the moment, but do you want to retain the white border as part of the image, when you resize the image?

If so, could you please post the pixel dimensions and calculated ratio of width-height for the 'before' and 'after' example images to confirm that the requested ratios are the same.
Elk
Posts: 176
Joined: Wed Feb 27, 2019 6:17 pm

Re: How to make an image (width, height) smaller?

Post by Elk »

The images you posted in your previous post have a white border around them which didn't display in my XnView MP set to have a white background.
OK, they just were for demonstration purposes, just for viewing, to try to made understand what I meant. In fact, you could use any image for testing, so to speak, I just needed to know how I have to do it, what settings have to be changed.

Suppose, you have an image you want to put on a web page, but you need that same image smaller, in a smaller view to make it fit into the page.
I can't continue at the moment, but do you want to retain the white border as part of the image, when you resize the image?
So I want each image exactly how it looks like but smaller actually. EVERYTHING visible of an images shall keep staying the same, besides of its visible size, that should be come smaller.
If so, could you please post the pixel dimensions and calculated ratio of width-height for the 'before' and 'after' example images to confirm that the requested ratios are the same.
Actually there are no special dimensions, the images just should become smaller, so small that they e.g. fit into the width of a web page, say 400 px or 300 px width. I do not know the ratio of those images, I guess, it is 4:3. I just needed to know how I can achieve that.

Thank you very much!
cday
XnThusiast
Posts: 4397
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to make an image (width, height) smaller?

Post by cday »

I'll change the background colour in my XnView MP so that white at the edge of an image is visible, but it is noteworthy that a white border on an image posted on the forum is also not visible, at least with my Chromium browser.

To resize an entire image as I now understand you to need to do, you should only need to use Resize: the simplest way, which would avoid the need to calculate new pixel dimensions that accurately maintain the image width-height ratio, would be to resize using a percentage mode option, rather than by entering new pixel values. If that won't do for some reason, you would have to calculate new pixel sizes that maintain the existing ratio.
Elk
Posts: 176
Joined: Wed Feb 27, 2019 6:17 pm

Re: How to make an image (width, height) smaller?

Post by Elk »

OK, good.
To resize an entire image as I now understand you to need to do, you should only need to use Resize: the simplest way, which would avoid the need to calculate new pixel dimensions that accurately maintain the image width-height ratio, would be to resize using a percentage mode option, rather than by entering new pixel values. If that won't do for some reason, you would have to calculate new pixel sizes that maintain the existing ratio.
Yes, I tried that, but it does not resize the demensions here, but the file size, I guess:
Image

That is not what I want to do. I want the image size, the height and width to be shorter.

Many thanks for trying!
cday
XnThusiast
Posts: 4397
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to make an image (width, height) smaller?

Post by cday »

I have been seeing possible issues with XnConvert (and XnView MP Batch convert) concerning the Resize action, which has been modified more than once fairly recently.

Using the latest XnConvert 1.96 with your 9ZuEj0m.jpeg image, and a Resize 50% setting, I see these preview Before and After settings:

XnConvert_1.96_Resize_50%_Preview_Before.png

XnConvert_1.96_Resize_50%_Preview_After.png

Do those images look about right?

If so, perhaps you can try experimenting with resizes using percentages.
Elk
Posts: 176
Joined: Wed Feb 27, 2019 6:17 pm

Re: How to make an image (width, height) smaller?

Post by Elk »

OK, I absolutely do not make it here. I use XnView MP. I give up, I guess. Any idea how to achieve that.
Do those images look about right?
Yes, they do.
If so, perhaps you can try experimenting with resizes using percentages.
Yes, I already did a few times with XnView MP before and again. Do not get it working.

The same with that XnConvert, the newest:
Image

Image

Image

And:
Image

Image

May be there is another setting being important, I do not have any idea.
cday
XnThusiast
Posts: 4397
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to make an image (width, height) smaller?

Post by cday »

Yes, puzzling and frustrating, and since some changes were made to the Resize action earlier in the year, one of which I supported without fully understanding the request, I no longer fully understand the Resize action, and am not sure whether it is now operating as intended? :(

There is one difference between your settings and my setting, the Preset value selected, but changing my value doesn't produce your preview. I also downloaded your original image again in case there was any confusion while I was working, copy attched in a ZIP.

Could you try clicking on the Preview window magnifying glass '-' button to reduce the size of the displayed preview in case some of the full image is not visible? But in any case the white border isn't apparent in your preview??

I am also attaching my exported xbs script for my settings that you could try loading.

9ZuEj0m (1).jpeg.zip
(196.02 KiB) Downloaded 49 times
Resize script.xbs.zip
(805 Bytes) Downloaded 26 times
Elk
Posts: 176
Joined: Wed Feb 27, 2019 6:17 pm

Re: How to make an image (width, height) smaller?

Post by Elk »

Yes, actually it should be extremely simple. And there are not that many settings. So may be there is some setting at another place causing this.

Many thanks for your script and the image!


Could you try clicking on the Preview window magnifying glass '-' button to reduce the size of the displayed preview in case some of the full image is not visible?
Yes, I had tried already the best fit icon, but the view keeps staying as it is, nothing changes, but somehow

All done with the original image:

Image

Two clicks on the minus magnifying glass:
Image

When switching between after and before the view is not kept, so one has to click the magnifying glass again always. Cannot get it working here.

Clicked "Best fit", does not work obviously:
Image

Best fit again:
Image

Converting does not change the size of the visible image, but the file size. I would think the correct option should be canvas, crop cuts the images. But I am not sure.
Could you try clicking on the Preview window magnifying glass '-' button to reduce the size of the displayed preview in case some of the full image is not visible? But in any case the white border isn't apparent in your preview??

Your image, best fit clicked, that's the white border, I think:
Image

Image
cday
XnThusiast
Posts: 4397
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to make an image (width, height) smaller?

Post by cday »

Isn't the last screenshot the result you that want? Can you now get that result on your computer one way or another?

I think in general when viewing previews with borders it is probably best to click the preview '-' icon enough times to be sure that you are viewing the whole before and after images. You can also if necessary change the preview background colour, if it might be helpful in Settings tab > Preview background color, although your current black background shouldn't be a problem at the moment.
Elk
Posts: 176
Joined: Wed Feb 27, 2019 6:17 pm

Re: How to make an image (width, height) smaller?

Post by Elk »

Isn't the last screenshot the result you that want? Can you now get that result on your computer one way or another?
Unfortunately it is not. When...holy...shiiii...I guess, I found the cause in this moment I am writing here, it is not the output, but the input so to say when I view the result: there somewhere is a setting, cannot find it at the moment, which extends each image to the maximum, not matter how the dimension is. So I just always saw the image over the entire screen even if it was small like this one:
Image
I think in general when viewing previews with borders it is probably best to click the preview '-' icon enough times to be sure that you are viewing the whole before and after images. You can also if necessary change the preview background colour, if it might be helpful in Settings tab > Preview background color, although your current black background shouldn't be a problem at the moment.
So I guess this indeed is / was the cause. But the display in the convert dialog somehow does not work correctly, I would think. Best fit does Or it was completely my failure, not sure.

Unbelievable, the completely wrong place I looked for the cause.
Post Reply