Page 1 of 1

Duplicate an image with no Alpha to the same image with Alpha.

Posted: Mon Apr 22, 2019 10:38 pm
by WexTwoTwo
Hello all,

I'm looking to duplicate one image that is missing alpha channel and just duplicate it while adding an alpha channel to the image.
I"m guessing it might come out black as when multiplying the channels, and there is no alpha channel and than adding one, the conversion will come out black.

But... any-ways... I kinda need it.

So here is what I have tried and failed.... a few things I tried.

Code: Select all

ffmpeg3 -y -i noAlpha.tif -pix_fmt rgba -vcodec tiff -frames:v 1 withAlpha.png

Code: Select all

ffmpeg3 -y -i noAlpha.tif -pix_fmt rgba -vcodec tiff -t withAlpha.png

Code: Select all

ffmpeg3 -y -i noAlpha.tif -pix_fmt rgba withAlpha.png
Yeah, I"m just not sure how to set it, how to make ffmpeg convert image to image, not a video.
My source image(noAlpha.###) could be .exr / .tif / .png, the output, I'm writing in a way that it will be as the noAlpha.### source.

I could not find alot of docs' with images alone, most of it is videos.
Any help will be... amazing!

Thank you.

Re: Duplicate an image with no Alpha to the same image with Alpha.

Posted: Sat Apr 27, 2019 9:44 am
by pandy
Seem alpha is not particularly easy in ffmpeg (at least not intuitive) - i was able to make it work somehow with example bellow:

Code: Select all

@ffmpeg.exe -hide_banner -v 32 -stats -strict -1 -i %filename% -an  -filter_complex "[0:v]scale=773:439:sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp:interl=-1:out_range=full,pad=1920:1080:990:224[a0];movie=bg.png,premultiply=inplace=1[b0];[a0][b0]overlay=0:0:alpha=premultiplied,scale=960:-2,format=pix_fmts=yuv420p" -c:v ffv1 -vsync 0 -f NUT - | ffplay.exe -hide_banner -loglevel 32 -autoexit -i -
I think you must explicitly call alpha channel and explicitly use it - command premultiply seem do the job - you need to modify this command to your needs but it should be relatively straightforward - ffmpeg pipe to ffplay so you can see on screen effect of video processing. Also remember on quantization range (in past i think ffmpeg failed on this, perhaps now it is improved - i mean YUV<>RGB converssion).

Re: Duplicate an image with no Alpha to the same image with Alpha.

Posted: Mon Apr 29, 2019 7:03 pm
by WexTwoTwo
I"ll take alook later this week.

Thank you so much for the reply

Re: Duplicate an image with no Alpha to the same image with Alpha.

Posted: Tue May 07, 2019 12:23 am
by WexTwoTwo
We ended up doing and using something else.
We used oiiotool for this.

Thank you for the reply