Padded transparent background

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, helmut, xnview

Posts: 1
Joined: Thu Oct 27, 2022 8:19 pm

Padded transparent background

Post by bartcuijpers »


I'm trying to achieve the following:
- scale image to fit 1280x720
- set canvas to 1920x1080
- the padded background should be transparant, but should contain a colour when rendered to jpeg afterwards (for a thumbnail)
- maintain transparancy when existing

This script works...

Code: Select all

-ctype rgba -out png -clevel 6 -set_alpha -transpcolor 180 180 180 -ratio -rtype lanczos -bgcolor2 180 180 180 0 -resize 1920 1080 -canvas 1920 1080 center
...but it actually keys out the grey color. I want the original image to be untouched.

I can achieve the result I want using xnconvert... but when exporting a batch the result isn't the same :(

Hoping for some help!
Posts: 4022
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: padded transparant background

Post by cday »

This is probably not the type of problem where I can provide help, but how does the XnConvert-exported script differ from your NConvert code above?

Note that from memory code exported from XNConvert includes a number of terms, repressing default values I think, that need not be included; here you might look for code differences that could possibly be relevant to your issue.

Another thought: If you have based your NConvert code on code exported from XnConvert, have you checked that all the terms used are included in the NConvert help file? If the code runs I guess they should be...

If you have suitable images, it might also be helpful if you could provide an example output image from NConvert and also one from XnConvert to illustrate the problem.