compose one transparent png(as mask) with one jpg
Posted: 2019-09-28T05:57:50-07:00
I have 2 type of images.
Some hundreds of png images with just one color(gray) and some transparent zones then must be transparent even in final result.
Over 30 thousands of jpg images with many size. I must estrapolate from jpg images the gray zones of png files.
Now i use something like this :
convert JPG_FILE.jpg -resize WIDTH_OF_PNGxHEIGHT_OF_PNG^ -gravity Center -crop WIDTH_OF_PNGxHEIGHT_OF_PNG+0+0 -alpha Set PNG_FILE.png ( -clone 0,1 -alpha Opaque -compose Hardlight -composite ) -delete 0 -compose In -composite RESULT_IMAGE.png
it works very good but its a bit slow
any suggestion for faster execution?
Some hundreds of png images with just one color(gray) and some transparent zones then must be transparent even in final result.
Over 30 thousands of jpg images with many size. I must estrapolate from jpg images the gray zones of png files.
Now i use something like this :
convert JPG_FILE.jpg -resize WIDTH_OF_PNGxHEIGHT_OF_PNG^ -gravity Center -crop WIDTH_OF_PNGxHEIGHT_OF_PNG+0+0 -alpha Set PNG_FILE.png ( -clone 0,1 -alpha Opaque -compose Hardlight -composite ) -delete 0 -compose In -composite RESULT_IMAGE.png
it works very good but its a bit slow
any suggestion for faster execution?