How to crop from centre and then resize in one action?
Moderators: XnTriq, helmut, xnview
-
- Posts: 8
- Joined: Sat May 30, 2009 7:21 am
How to crop from centre and then resize in one action?
Can anybody guide me on how to crop a bunch of images from the centre and then resize to a specific size? Also is it possible to resize an image to 5 different sizes and rename each output image differently in a single action?
-
- XnThusiast
- Posts: 4138
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: How to crop from centre and then resize in one action?
You should be able to do that using the 'Image > Canvas resize' action: you may need to experiment to find the most suitable 'Keep ratio' and 'Follow orientation' settings.taksina wrote:Can anybody guide me on how to crop a bunch of images from the centre and then resize to a specific size?
No, it is only possible to output one image for each input file. You would have to run XnConvert five times with different settings, but it is possible to save the settings used when XnConvert is run as a script which can be reloaded later, so you could have five different scripts.Also is it possible to resize an image to 5 different sizes and rename each output image differently in a single action?
It should be possible to produce five different sized images with different file names directly using the command line utility NConvert, by creating a batch file that runs NConvert five times with different settings. But writing the script required if you are not used to using the command line would be rather more complex than using XnConvert.
You do not have the required permissions to view the files attached to this post.
Last edited by cday on Sat Jul 05, 2014 12:23 pm, edited 1 time in total.
-
- Posts: 8
- Joined: Sat May 30, 2009 7:21 am
Re: How to crop from centre and then resize in one action?
Thank you so much cday. I'll try that and will let you know.
-
- XnThusiast
- Posts: 4138
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: How to crop from centre and then resize in one action?
Thinking about your post again...
I think you need to follow the 'Canvas resize' action which should perform the crop you requested, with a 'Resize' action to produce the thumbnail dimensions you require for each of the five sizes...
Maybe you've already realised that?
I think you need to follow the 'Canvas resize' action which should perform the crop you requested, with a 'Resize' action to produce the thumbnail dimensions you require for each of the five sizes...
Maybe you've already realised that?
-
- Posts: 8
- Joined: Sat May 30, 2009 7:21 am
Re: How to crop from centre and then resize in one action?
I've tried the resize method and it works fine for photos with same orientation as the target size, which helps a lot. But there are some with different orientation like shown in the attachments here. Is there a way to do that? My goal is to resize/crop some photos to the target size (specifically 63x82 pixels) regardless of the orientation of the original. It's okay to lose details so long as the object in the centre is kept.
Thanks for your great help.
Thanks for your great help.
You do not have the required permissions to view the files attached to this post.
-
- XnThusiast
- Posts: 4138
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: How to crop from centre and then resize in one action?
I'm slightly confused but could you try the following settings and let me know if they produce the result you want for landscape images like the one you posted:
The first action crops the input image about the center to the pixel height of the 'Before' image and a width calculated from the pixel width of the 'Before' image and the 63/82 width/height ratio of the thumbnail you want.
The second action rescales the cropped image to the thumbnail dimensions you want -- you might try different resampling methods to see if there is any difference in quality.
My output JPG file has a noticably smaller file size than yours but I don't see any very obvious difference in quality -- you can experiment with the JPG save settings on the Output tab. My output image is also very slightly displaced from yours, probably because it is cropped from the exact input image center, whereas you probably cropped by eye.
Note that I haven't considered whether it is possible to use the same settings for both landscape and portrait images, but if the above settings are useful you could try experimenting a bit with the 'Follow orientation' setting and see if you can solve that one. If not, and I don't have experience of that myself, could you post portrait and landscape Before and desired thumnail test images.
The first action crops the input image about the center to the pixel height of the 'Before' image and a width calculated from the pixel width of the 'Before' image and the 63/82 width/height ratio of the thumbnail you want.
The second action rescales the cropped image to the thumbnail dimensions you want -- you might try different resampling methods to see if there is any difference in quality.
My output JPG file has a noticably smaller file size than yours but I don't see any very obvious difference in quality -- you can experiment with the JPG save settings on the Output tab. My output image is also very slightly displaced from yours, probably because it is cropped from the exact input image center, whereas you probably cropped by eye.
Note that I haven't considered whether it is possible to use the same settings for both landscape and portrait images, but if the above settings are useful you could try experimenting a bit with the 'Follow orientation' setting and see if you can solve that one. If not, and I don't have experience of that myself, could you post portrait and landscape Before and desired thumnail test images.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 8
- Joined: Sat May 30, 2009 7:21 am
Re: How to crop from centre and then resize in one action?
Dear cday,
Thanks for your advice. I have great success with most of my pictures with the canvas size of 1600 x 2050 pixels. At least I understand the steps to go about it. Thanks a lot for your kind help. I'm no expert on image and XN tools and boards rock!
Have a nice day,
Taksina
Thanks for your advice. I have great success with most of my pictures with the canvas size of 1600 x 2050 pixels. At least I understand the steps to go about it. Thanks a lot for your kind help. I'm no expert on image and XN tools and boards rock!
Have a nice day,
Taksina