My "ff-dice" program (together with "pngff" to decode PNG, and "ffpng" to encode PNG; these two also require LodePNG, which is included, and which itself has no other dependencies) also does that.
Netpbm also does this; you can use the "pamdice" program (together with "pngtopnm" and "pnmtopng" to decode and encode PNG). However, pamdice requires creating intermediate files, while ff-dice doesn't require that.
So, you have two more things to try if ImageMagick won't work.