Page 1 of 1
How to crop from centre and then resize in one action?
Posted: Sat Jul 05, 2014 2:13 am
by taksina
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?
Re: How to crop from centre and then resize in one action?
Posted: Sat Jul 05, 2014 6:40 am
by cday
taksina wrote:Can anybody guide me on how to crop a bunch of images from the centre and then resize to a specific size?
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.
Also is it possible to resize an image to 5 different sizes and rename each output image differently in a single action?
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.
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.

Re: How to crop from centre and then resize in one action?
Posted: Sat Jul 05, 2014 7:51 am
by taksina
Thank you so much cday. I'll try that and will let you know.
Re: How to crop from centre and then resize in one action?
Posted: Sun Jul 06, 2014 6:08 am
by cday
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?

Re: How to crop from centre and then resize in one action?
Posted: Mon Jul 07, 2014 3:14 am
by taksina
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.

- This is the original file, full size.

- This is the result I'm trying to achieve.
- After.jpg (17.3 KiB) Viewed 6229 times
Re: How to crop from centre and then resize in one action?
Posted: Mon Jul 07, 2014 8:19 am
by cday
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.
Re: How to crop from centre and then resize in one action?
Posted: Tue Jul 08, 2014 3:07 am
by taksina
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