Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you remove the alpha channel in a PNG with SIPS?

Trying to stay native in SIPS when removing the alpha channel from images I am familiar with the process in ImageMagick with:

convert -flatten test.png test-white.png

or:

convert test.png -background white -alpha remove test.png

but when I reference the man page on ss4 and Library it tells me that hasAlpa is a boolean read only when I run:

sips -g hasAlpha test.png

Per searching under the tag sips and with:

  • sips transparency
  • sips remove

there wasn't anything mentioned for removing transparency. Can you remove transparency with SIPS?

like image 267
DᴀʀᴛʜVᴀᴅᴇʀ Avatar asked Oct 20 '25 03:10

DᴀʀᴛʜVᴀᴅᴇʀ


1 Answers

Using ImageMagick or GraphicsMagick would be better idea, but if you really want to use SIPS, you could try to remove transparency by converting image to BMP, and then back to PNG again:

sips -s format bmp input.png --out tmp.bmp
sips -s format png tmp.bmp --out output.png

Unfortunately you cannot choose background color, transparent parts of image will be replaced with black.

like image 159
qzb Avatar answered Oct 21 '25 21:10

qzb