Can I use the repo to merge 2 PNG files?
Closed this issue · 4 comments
zydjohnHotmail commented
zydjohnHotmail commented
zydjohnHotmail commented
arklumpus commented
Sorry for the delay.
Sure, it shouldn't be too hard! Make sure you are referencing VectSharp.MuPDFUtils
and VectSharp.Raster
, then you can do something like:
using VectSharp;
using VectSharp.MuPDFUtils;
using VectSharp.Raster;
// ...
// Create the page for the complete image
Page pag = new Page(1280, 720);
// Load the background and foreground image (the RasterImageFile class comes from VectSharp.MuPDFUtils)
using RasterImageFile foreground = new RasterImageFile("1.png");
using RasterImageFile background = new RasterImageFile("2.png");
// Draw the two images
pag.Graphics.DrawRasterImage(0, 0, 1280, 720, background);
pag.Graphics.DrawRasterImage(0, 0, 1280, 720, foreground);
// Save the output as a PNG file
pag.SaveAsPNG("3.png");
zydjohnHotmail commented
OK, thanks!