Page 1 of 1
Order of parameters execution in the script
Posted: Thu Dec 04, 2008 8:54 am
by Maxime000
Hello,
I have a problem with resizing images containing a transparency (alpha chanel).
What I am using in my conversion script is
(to get an autocrop on the whithish background of the images)
and then resizing the image.
If the image has a transparent background, the autocrop will not crop anything (because the transparent color doesn't match the white color). Therefore I need to remove the transparency with
This is where I have a problem : the autocroping is done before the alpha is removed. The image it produces is still not autocropped. Is there a way to make
first the
THEN , once the image is
flattened, the
in that order?
Re: Order of parameters execution in the script
Posted: Thu Dec 04, 2008 12:47 pm
by xnview
With
Code: Select all
-merge_alpha -autocrop 5 255 255 255
??
Re: Order of parameters execution in the script
Posted: Thu Dec 04, 2008 1:24 pm
by Maxime000
this is for detecting all the pixels arround the image that have the values between 250 250 250 and 255 255 255 (pure white). The autocrop will discard these pixels and try to remove them.
My complete batch is quite long with many more parameters. Maybe you'll understand better what i'm trying to do :
Here is the main part :
Code: Select all
"C:\Program Files\XnView\nconvert.exe" -o "%% larger.bmp" -npcd 2 -size 256x256+0 -merge_alpha -ctype grey -corder inter -out bmp -autocrop 5 255 255 255 -ratio -rflag decr -rtype lanczos -resize 200 200 %1
After that I'm calling an other batch to finish the job, but it's an other story

Re: Order of parameters execution in the script
Posted: Thu Dec 04, 2008 1:42 pm
by Maxime000
An example of the problem :
this is the original image with a transparent area arround the central part
this is what I want to obtain : the transparent part cropped and then the central part resized
and this is what I get

What the script does is
1- trying to crop the image,
2- cropping nothing since the transparent color is not matching the "255 255 255",
3- then transforming the transparent color in white with the "merge_alpha" command.
What I'd like to have :
1- first the "merge_alpha" command
2- then cropping the resulting image
Re: Order of parameters execution in the script
Posted: Thu Dec 04, 2008 8:05 pm
by xnview
ok, there is a problem. Merge_alpha is always before save
Re: Order of parameters execution in the script
Posted: Fri Dec 05, 2008 2:54 pm
by Maxime000
Thanks for the answer.
I guess I'll have to make a first batch file that would do the alpha merging and call for a second batch for the cropping.
In the future, do you think nconvert could parse the commands in the order they are written ?