Re: Convert a 32-bit ARGB BMP to PNG
Posted: 2010-03-26T20:22:32-07:00
I've had success reading V3 ARGB uncompressed files as raw bytes. I've forgotten the syntax, but you tell IM the header size and dimensions, and away it goes.
Use https://github.com/ImageMagick/ImageMagick/discussions instead.
https://download.imagemagick.org/discourse-server/
https://download.imagemagick.org/discourse-server/viewtopic.php?t=15880
meh, guess I'll have to do that for now.fmw42 wrote:You can change the white to transparent
Well, I already found those, but thanks anyway...fmw42 wrote:see -crop at http://www.imagemagick.org/Usage/crop/#crop
and especially http://www.imagemagick.org/Usage/crop/#crop_equal
No, no, as in, I had already found those myself, and they did what I wanted them to do. Thanks for it anyway.fmw42 wrote:Does that not do what you want? If not, please explain and perhaps we can help further.
Code: Select all
#!/bin/sh
MATRIX='0 0 1 0
0 1 0 0
1 0 0 0
0 0 0 1'
IN_IMG="$1"
BASENAME="${IN_IMG%.*}"
RGBAIMG="${BASENAME}.rgba"
OUT_IMG="${BASENAME}.png"
HEADER_SIZE=54
width=$(identify -format "%w" "${IN_IMG}")
height=$(identify -format "%h" "${IN_IMG}")
dd if="${IN_IMG}" of="${RGBAIMG}" bs="${HEADER_SIZE}" skip=1
convert -size ${width}x${height} -depth 8 -flip "${RGBAIMG}" -recolor "${MATRIX}" "${OUT_IMG}"